diff options
author | Xiaolong Ye <xiaolong.ye@intel.com> | 2016-04-26 15:51:24 +0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-26 10:52:57 -0700 |
commit | bb52995f3ec7fac2b282a91af4230e4f387af234 (patch) | |
tree | 42bdf3c3090d6c3481ea44abe712680d97047c2c /t/t4014-format-patch.sh | |
parent | 3de665175f3433ccd1dadd4d5d09fa9553948e55 (diff) | |
download | git-bb52995f3ec7fac2b282a91af4230e4f387af234.tar.gz git-bb52995f3ec7fac2b282a91af4230e4f387af234.tar.xz |
format-patch: introduce format.useAutoBase configuration
This allows to record the base commit automatically, it is equivalent
to set --base=auto in cmdline.
The format.useAutoBase has lower priority than command line option,
so if user set format.useAutoBase and pass the command line option in
the meantime, base_commit will be the one passed to command line
option.
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4014-format-patch.sh')
-rwxr-xr-x | t/t4014-format-patch.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index 1bfd868f6..ab98cefe0 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -1546,4 +1546,23 @@ test_expect_success 'format-patch errors out when history involves criss-cross' test_must_fail git format-patch --base=auto -1 ' +test_expect_success 'format-patch format.useAutoBaseoption' ' + test_when_finished "git config --unset format.useAutoBase" && + git checkout local && + git config format.useAutoBase true && + git format-patch --stdout -1 >patch && + grep "^base-commit:" patch >actual && + echo "base-commit: $(git rev-parse upstream)" >expected && + test_cmp expected actual +' + +test_expect_success 'format-patch --base overrides format.useAutoBase' ' + test_when_finished "git config --unset format.useAutoBase" && + git config format.useAutoBase true && + git format-patch --stdout --base=HEAD~1 -1 >patch && + grep "^base-commit:" patch >actual && + echo "base-commit: $(git rev-parse HEAD~1)" >expected && + test_cmp expected actual +' + test_done |