diff options
Diffstat (limited to 't')
-rw-r--r-- | t/README | 1 | ||||
-rwxr-xr-x | t/t4014-format-patch.sh | 69 | ||||
-rwxr-xr-x | t/t7201-co.sh | 72 | ||||
-rwxr-xr-x | t/t8001-annotate.sh | 6 | ||||
-rwxr-xr-x | t/t9001-send-email.sh | 11 |
5 files changed, 155 insertions, 4 deletions
@@ -73,6 +73,7 @@ First digit tells the family: 4 - the diff commands 5 - the pull and exporting commands 6 - the revision tree commands (even e.g. merge-base) + 7 - the porcelainish commands concerning the working tree Second digit tells the particular command we are testing. diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh new file mode 100755 index 0000000000..4795872a77 --- /dev/null +++ b/t/t4014-format-patch.sh @@ -0,0 +1,69 @@ +#!/bin/sh +# +# Copyright (c) 2006 Junio C Hamano +# + +test_description='Format-patch skipping already incorporated patches' + +. ./test-lib.sh + +test_expect_success setup ' + + for i in 1 2 3 4 5 6 7 8 9 10; do echo "$i"; done >file && + git add file && + 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 && + git update-index file && + git commit -m "Side change #1" && + + for i in D E F; do echo "$i"; done >>file && + git update-index file && + git commit -m "Side change #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 && + git commit -m "Side change #3" && + + git checkout master && + git diff-tree -p C2 | git apply --index && + git commit -m "Master accepts moral equivalent of #2" + +' + +test_expect_success "format-patch --ignore-if-in-upstream" ' + + git format-patch --stdout master..side >patch0 && + cnt=`grep "^From " patch0 | wc -l` && + test $cnt = 3 + +' + +test_expect_success "format-patch --ignore-if-in-upstream" ' + + git format-patch --stdout \ + --ignore-if-in-upstream master..side >patch1 && + cnt=`grep "^From " patch1 | wc -l` && + test $cnt = 2 + +' + +test_expect_success "format-patch result applies" ' + + git checkout -b rebuild-0 master && + git am -3 patch0 && + cnt=`git rev-list master.. | wc -l` && + test $cnt = 2 +' + +test_expect_success "format-patch --ignore-if-in-upstream result applies" ' + + git checkout -b rebuild-1 master && + git am -3 patch1 && + cnt=`git rev-list master.. | wc -l` && + test $cnt = 2 +' + +test_done diff --git a/t/t7201-co.sh b/t/t7201-co.sh new file mode 100755 index 0000000000..b64e8b7d77 --- /dev/null +++ b/t/t7201-co.sh @@ -0,0 +1,72 @@ +#!/bin/sh +# +# Copyright (c) 2006 Junio C Hamano +# + +test_description='git-checkout tests.' + +. ./test-lib.sh + +fill () { + for i + do + echo "$i" + done +} + +test_expect_success setup ' + + fill 1 2 3 4 5 >one && + fill a b c d e >two && + git add one two && + git commit -m "Initial A one, A two" && + + git checkout -b side && + fill 1 2 3 >one && + fill A B C D E >three && + rm -f two && + git update-index --add --remove one two three && + git commit -m "Side M one, D two, A three" && + + git checkout master +' + +test_expect_success "checkout with dirty tree without -m" ' + + fill 0 1 2 3 4 5 >one && + if git checkout side + then + echo Not happy + false + else + echo "happy - failed correctly" + fi + +' + +test_expect_success "checkout -m with dirty tree" ' + + git checkout -f master && + git clean && + + fill 0 1 2 3 4 5 >one && + git checkout -m side && + + fill " master" "* side" >expect.branch && + git branch >current.branch && + diff expect.branch current.branch && + + fill "M one" "A three" "D two" >expect.master && + git diff --name-status master >current.master && + diff expect.master current.master && + + fill "M one" >expect.side && + git diff --name-status side >current.side && + diff expect.side current.side && + + : >expect.index && + git diff --cached >current.index && + diff expect.index current.index +' + +test_done diff --git a/t/t8001-annotate.sh b/t/t8001-annotate.sh index 2496397da3..3a6490e8f8 100755 --- a/t/t8001-annotate.sh +++ b/t/t8001-annotate.sh @@ -6,4 +6,10 @@ test_description='git-annotate' PROG='git annotate' . ../annotate-tests.sh +test_expect_success \ + 'Annotating an old revision works' \ + '[ $(git annotate file master | awk "{print \$3}" | grep -c "^A$") -eq 2 ] && \ + [ $(git annotate file master | awk "{print \$3}" | grep -c "^B$") -eq 2 ]' + + test_done diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index a61da1efbd..e9ea33c18d 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -25,10 +25,13 @@ test_expect_success \ git add fake.sendmail GIT_AUTHOR_NAME="A" git commit -a -m "Second."' -test_expect_success \ - 'Extract patches and send' \ - 'git format-patch -n HEAD^1 - git send-email -from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" ./0001*txt' +test_expect_success 'Extract patches' ' + patches=`git format-patch -n HEAD^1` +' + +test_expect_success 'Send patches' ' + git send-email -from="Example <nobody@example.com>" --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors +' cat >expected <<\EOF !nobody@example.com! |