From 6426f2d2afb42e51dac901ff666c3296424c6f5c Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Sat, 28 Aug 2010 01:58:15 +0530 Subject: t4014-format-patch: Call test_tick before committing Call test_tick before attempting to commit in the setup routine to preserve the order of the commits. Signed-off-by: Ramkumar Ramachandra Signed-off-by: Junio C Hamano --- t/t4014-format-patch.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 't') diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index d21c37f3a2..6321ac88aa 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -12,24 +12,29 @@ test_expect_success setup ' for i in 1 2 3 4 5 6 7 8 9 10; do echo "$i"; done >file && cat file >elif && git add file elif && + test_tick && git commit -m Initial && git checkout -b side && for i in 1 2 5 6 A B C 7 8 9 10; do echo "$i"; done >file && test_chmod +x elif && + test_tick && git commit -m "Side changes #1" && for i in D E F; do echo "$i"; done >>file && git update-index file && + test_tick && git commit -m "Side changes #2" && git tag C2 && for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >file && git update-index file && + test_tick && git commit -m "Side changes #3 with \\n backslash-n in it." && git checkout master && git diff-tree -p C2 | git apply --index && + test_tick && git commit -m "Master accepts moral equivalent of #2" ' -- cgit v1.2.1 From 2c642ed8668745271a714f0a672dbfcd6b0a6fa8 Mon Sep 17 00:00:00 2001 From: Ramkumar Ramachandra Date: Sat, 28 Aug 2010 01:58:16 +0530 Subject: format-patch: Don't go over merge commits If the topmost three commits in a branch were merge commits, 'git format-patch -3' used to output nothing. Since Git can't prepare patches out of merge commits anyway, don't go over them in the first place. 'git format-patch -3' now prepares three patches from the topmost three commits without counting merge commits. Also add a corresponding test in t4014-format-patch and update documentation. Signed-off-by: Ramkumar Ramachandra Signed-off-by: Junio C Hamano --- t/t4014-format-patch.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 't') diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index 6321ac88aa..2e78c9e662 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -56,6 +56,22 @@ test_expect_success "format-patch --ignore-if-in-upstream" ' ' +test_expect_success "format-patch doesn't consider merge commits" ' + + git checkout -b slave master && + echo "Another line" >>file && + test_tick && + git commit -am "Slave change #1" && + echo "Yet another line" >>file && + test_tick && + git commit -am "Slave change #2" && + git checkout -b merger master && + test_tick && + git merge --no-ff slave && + cnt=`git format-patch -3 --stdout | grep "^From " | wc -l` && + test $cnt = 3 +' + test_expect_success "format-patch result applies" ' git checkout -b rebuild-0 master && -- cgit v1.2.1