diff options
author | Xiaolong Ye <xiaolong.ye@intel.com> | 2016-04-26 15:51:23 +0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-04-26 10:51:50 -0700 |
commit | 3de665175f3433ccd1dadd4d5d09fa9553948e55 (patch) | |
tree | 41b30294951a8a74f3aa46daed76ee1594b9feee /t | |
parent | format-patch: add '--base' option to record base tree info (diff) | |
download | tgif-3de665175f3433ccd1dadd4d5d09fa9553948e55.tar.xz |
format-patch: introduce --base=auto option
Introduce --base=auto to record the base commit info automatically, the
base_commit will be the merge base of tip commit of the upstream branch
and revision-range specified in cmdline.
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t4014-format-patch.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index edf07eefd4..1bfd868f6d 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -1507,4 +1507,43 @@ test_expect_success 'format-patch --base errors out when base commit is not ance test_cmp expected actual ' +test_expect_success 'format-patch --base=auto' ' + git checkout -b upstream master && + git checkout -b local upstream && + git branch --set-upstream-to=upstream && + test_commit N1 && + test_commit N2 && + git format-patch --stdout --base=auto -2 >patch && + grep "^base-commit:" patch >actual && + echo "base-commit: $(git rev-parse upstream)" >expected && + test_cmp expected actual +' + +test_expect_success 'format-patch errors out when history involves criss-cross' ' + # setup criss-cross history + # + # B---M1---D + # / \ / + # A X + # \ / \ + # C---M2---E + # + git checkout master && + test_commit A && + git checkout -b xb master && + test_commit B && + git checkout -b xc master && + test_commit C && + git checkout -b xbc xb -- && + git merge xc && + git checkout -b xcb xc -- && + git branch --set-upstream-to=xbc && + git merge xb && + git checkout xbc && + test_commit D && + git checkout xcb && + test_commit E && + test_must_fail git format-patch --base=auto -1 +' + test_done |