diff options
Diffstat (limited to 't')
-rw-r--r-- | t/Makefile | 2 | ||||
-rwxr-xr-x | t/aggregate-results.sh | 10 | ||||
-rw-r--r-- | t/lib-git-svn.sh | 2 | ||||
-rwxr-xr-x | t/t3401-rebase-partial.sh | 4 | ||||
-rwxr-xr-x | t/t3404-rebase-interactive.sh | 8 | ||||
-rwxr-xr-x | t/t3407-rebase-abort.sh | 4 | ||||
-rwxr-xr-x | t/t4150-am.sh | 22 | ||||
-rwxr-xr-x | t/t4200-rerere.sh | 32 | ||||
-rwxr-xr-x | t/t5100-mailinfo.sh | 2 | ||||
-rw-r--r-- | t/t5100/0010 | 35 | ||||
-rw-r--r-- | t/t5100/info0010 | 5 | ||||
-rw-r--r-- | t/t5100/msg0010 | 5 | ||||
-rw-r--r-- | t/t5100/patch0010 | 20 | ||||
-rw-r--r-- | t/t5100/sample.mbox | 35 | ||||
-rwxr-xr-x | t/t6008-rev-list-submodule.sh | 2 | ||||
-rwxr-xr-x | t/t6011-rev-list-with-bad-commit.sh | 60 | ||||
-rwxr-xr-x | t/t6021-merge-criss-cross.sh | 4 | ||||
-rwxr-xr-x | t/t7600-merge.sh | 78 | ||||
-rwxr-xr-x | t/t7601-merge-pull-config.sh | 129 | ||||
-rwxr-xr-x | t/t7602-merge-octopus-many.sh | 52 | ||||
-rwxr-xr-x | t/t7603-merge-reduce-heads.sh | 63 | ||||
-rwxr-xr-x | t/t7604-merge-custom-message.sh | 37 | ||||
-rwxr-xr-x | t/t7605-merge-resolve.sh | 46 | ||||
-rwxr-xr-x | t/t9106-git-svn-commit-diff-clobber.sh | 2 | ||||
-rwxr-xr-x | t/t9110-git-svn-use-svm-props.sh | 9 | ||||
-rwxr-xr-x | t/t9600-cvsimport.sh | 4 |
26 files changed, 601 insertions, 71 deletions
diff --git a/t/Makefile b/t/Makefile index a778865ae7..0d65cedaa6 100644 --- a/t/Makefile +++ b/t/Makefile @@ -26,7 +26,7 @@ clean: $(RM) -r 'trash directory' test-results aggregate-results: - ./aggregate-results.sh test-results/t*-* + '$(SHELL_PATH_SQ)' ./aggregate-results.sh test-results/t*-* # we can test NO_OPTIMIZE_COMMITS independently of LC_ALL full-svn-test: diff --git a/t/aggregate-results.sh b/t/aggregate-results.sh index 52e88e3046..d5bab75d7d 100755 --- a/t/aggregate-results.sh +++ b/t/aggregate-results.sh @@ -10,9 +10,9 @@ for file do while read type value do - case $type in - '') - continue ;; + case $type in + '') + continue ;; fixed) fixed=$(($fixed + $value)) ;; success) @@ -20,9 +20,9 @@ do failed) failed=$(($failed + $value)) ;; broken) - broken=$(( $broken + $value)) ;; + broken=$(($broken + $value)) ;; total) - total=$(( $total + $value)) ;; + total=$(($total + $value)) ;; esac done <"$file" done diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index 5d3bd9dda9..a841df2a9e 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -98,7 +98,7 @@ LoadModule dav_module $SVN_HTTPD_MODULE_PATH/mod_dav.so LoadModule dav_svn_module $SVN_HTTPD_MODULE_PATH/mod_dav_svn.so <Location /$repo_base_path> DAV svn - SVNPath $rawsvnrepo + SVNPath "$rawsvnrepo" </Location> EOF "$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k start diff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh index 4934a4e010..36d9a2ae3a 100755 --- a/t/t3401-rebase-partial.sh +++ b/t/t3401-rebase-partial.sh @@ -50,12 +50,12 @@ test_debug \ test_expect_success \ 'rebase topic branch against new master and check git-am did not get halted' \ - 'git-rebase master && test ! -d .dotest' + 'git-rebase master && test ! -d .git/rebase' test_expect_success \ 'rebase --merge topic branch that was partially merged upstream' \ 'git-checkout -f my-topic-branch-merge && git-rebase --merge master-merge && - test ! -d .git/.dotest-merge' + test ! -d .git/rebase-merge' test_done diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 092aa26573..ffe3dd97b7 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -159,19 +159,19 @@ test_expect_success 'stop on conflicting pick' ' git tag new-branch1 && test_must_fail git rebase -i master && test "$(git rev-parse HEAD~3)" = "$(git rev-parse master)" && - test_cmp expect .git/.dotest-merge/patch && + test_cmp expect .git/rebase-merge/patch && test_cmp expect2 file1 && test "$(git-diff --name-status | sed -n -e "/^U/s/^U[^a-z]*//p")" = file1 && - test 4 = $(grep -v "^#" < .git/.dotest-merge/done | wc -l) && - test 0 = $(grep -c "^[^#]" < .git/.dotest-merge/git-rebase-todo) + test 4 = $(grep -v "^#" < .git/rebase-merge/done | wc -l) && + test 0 = $(grep -c "^[^#]" < .git/rebase-merge/git-rebase-todo) ' test_expect_success 'abort' ' git rebase --abort && test $(git rev-parse new-branch1) = $(git rev-parse HEAD) && test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch1" && - ! test -d .git/.dotest-merge + ! test -d .git/rebase-merge ' test_expect_success 'retain authorship' ' diff --git a/t/t3407-rebase-abort.sh b/t/t3407-rebase-abort.sh index 1777ffe8a2..12c8804a03 100755 --- a/t/t3407-rebase-abort.sh +++ b/t/t3407-rebase-abort.sh @@ -74,7 +74,7 @@ testrebase() { ' } -testrebase "" .dotest -testrebase " --merge" .git/.dotest-merge +testrebase "" .git/rebase +testrebase " --merge" .git/rebase-merge test_done diff --git a/t/t4150-am.sh b/t/t4150-am.sh index bc982607d0..5cbd5ef679 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -102,7 +102,7 @@ test_expect_success 'am applies patch correctly' ' git checkout first && test_tick && git am <patch1 && - ! test -d .dotest && + ! test -d .git/rebase && test -z "$(git diff second)" && test "$(git rev-parse second)" = "$(git rev-parse HEAD)" && test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)" @@ -123,7 +123,7 @@ test_expect_success 'am changes committer and keeps author' ' test_tick && git checkout first && git am patch2 && - ! test -d .dotest && + ! test -d .git/rebase && test "$(git rev-parse master^^)" = "$(git rev-parse HEAD^^)" && test -z "$(git diff master..HEAD)" && test -z "$(git diff master^..HEAD^)" && @@ -163,7 +163,7 @@ test_expect_success 'am without --keep removes Re: and [PATCH] stuff' ' test_expect_success 'am --keep really keeps the subject' ' git checkout HEAD^ && git am --keep patch4 && - ! test -d .dotest && + ! test -d .git/rebase && git-cat-file commit HEAD | grep -q -F "Re: Re: Re: [PATCH 1/5 v2] third" ' @@ -176,19 +176,19 @@ test_expect_success 'am -3 falls back to 3-way merge' ' test_tick && git commit -m "copied stuff" && git am -3 lorem-move.patch && - ! test -d .dotest && + ! test -d .git/rebase && test -z "$(git diff lorem)" ' test_expect_success 'am pauses on conflict' ' git checkout lorem2^^ && ! git am lorem-move.patch && - test -d .dotest + test -d .git/rebase ' test_expect_success 'am --skip works' ' git am --skip && - ! test -d .dotest && + ! test -d .git/rebase && test -z "$(git diff lorem2^^ -- file)" && test goodbye = "$(cat another)" ' @@ -196,31 +196,31 @@ test_expect_success 'am --skip works' ' test_expect_success 'am --resolved works' ' git checkout lorem2^^ && ! git am lorem-move.patch && - test -d .dotest && + test -d .git/rebase && echo resolved >>file && git add file && git am --resolved && - ! test -d .dotest && + ! test -d .git/rebase && test goodbye = "$(cat another)" ' test_expect_success 'am takes patches from a Pine mailbox' ' git checkout first && cat pine patch1 | git am && - ! test -d .dotest && + ! test -d .git/rebase && test -z "$(git diff master^..HEAD)" ' test_expect_success 'am fails on mail without patch' ' ! git am <failmail && - rm -r .dotest/ + rm -r .git/rebase/ ' test_expect_success 'am fails on empty patch' ' echo "---" >>failmail && ! git am <failmail && git am --skip && - ! test -d .dotest + ! test -d .git/rebase ' test_expect_success 'am works from stdin in subdirectory' ' diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh index a64727d5ad..b5a4202998 100755 --- a/t/t4200-rerere.sh +++ b/t/t4200-rerere.sh @@ -9,6 +9,8 @@ test_description='git rerere . ./test-lib.sh cat > a1 << EOF +Some title +========== Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take arms against a sea of troubles, @@ -24,6 +26,8 @@ git commit -q -a -m initial git checkout -b first cat >> a1 << EOF +Some title +========== To die, to sleep; To sleep: perchance to dream: ay, there's the rub; For in that sleep of death what dreams may come @@ -35,7 +39,7 @@ git commit -q -a -m first git checkout -b second master git show first:a1 | -sed -e 's/To die, t/To die! T/' > a1 +sed -e 's/To die, t/To die! T/' -e 's/Some title/Some Title/' > a1 echo "* END *" >>a1 git commit -q -a -m second @@ -53,16 +57,16 @@ test_expect_success 'conflicting merge' ' ! git merge first ' -sha1=$(sed -e 's/ .*//' .git/rr-cache/MERGE_RR) +sha1=$(sed -e 's/ .*//' .git/MERGE_RR) rr=.git/rr-cache/$sha1 -test_expect_success 'recorded preimage' "grep ======= $rr/preimage" +test_expect_success 'recorded preimage' "grep ^=======$ $rr/preimage" test_expect_success 'rerere.enabled works, too' ' rm -rf .git/rr-cache && git config rerere.enabled true && git reset --hard && ! git merge first && - grep ======= $rr/preimage + grep ^=======$ $rr/preimage ' test_expect_success 'no postimage or thisimage yet' \ @@ -71,7 +75,7 @@ test_expect_success 'no postimage or thisimage yet' \ test_expect_success 'preimage has right number of lines' ' cnt=$(sed -ne "/^<<<<<<</,/^>>>>>>>/p" $rr/preimage | wc -l) && - test $cnt = 9 + test $cnt = 13 ' @@ -80,13 +84,23 @@ git show first:a1 > a1 cat > expect << EOF --- a/a1 +++ b/a1 -@@ -6,17 +6,9 @@ +@@ -1,4 +1,4 @@ +-Some Title ++Some title + ========== + Whether 'tis nobler in the mind to suffer + The slings and arrows of outrageous fortune, +@@ -8,21 +8,11 @@ The heart-ache and the thousand natural shocks That flesh is heir to, 'tis a consummation Devoutly to be wish'd. -<<<<<<< +-Some Title +-========== -To die! To sleep; -======= + Some title + ========== To die, to sleep; ->>>>>>> To sleep: perchance to dream: ay, there's the rub; @@ -124,12 +138,12 @@ test_expect_success 'another conflicting merge' ' ' git show first:a1 | sed 's/To die: t/To die! T/' > expect -test_expect_success 'rerere kicked in' "! grep ======= a1" +test_expect_success 'rerere kicked in' "! grep ^=======$ a1" test_expect_success 'rerere prefers first change' 'test_cmp a1 expect' rm $rr/postimage -echo "$sha1 a1" | perl -pe 'y/\012/\000/' > .git/rr-cache/MERGE_RR +echo "$sha1 a1" | perl -pe 'y/\012/\000/' > .git/MERGE_RR test_expect_success 'rerere clear' 'git rerere clear' @@ -176,7 +190,7 @@ test_expect_success 'file2 added differently in two branches' ' git add file2 && git commit -m version2 && ! git merge fourth && - sha1=$(sed -e "s/ .*//" .git/rr-cache/MERGE_RR) && + sha1=$(sed -e "s/ .*//" .git/MERGE_RR) && rr=.git/rr-cache/$sha1 && echo Cello > file2 && git add file2 && diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh index 577ecc210a..e9f3e72c7e 100755 --- a/t/t5100-mailinfo.sh +++ b/t/t5100-mailinfo.sh @@ -11,7 +11,7 @@ test_expect_success 'split sample box' \ 'git mailsplit -o. ../t5100/sample.mbox >last && last=`cat last` && echo total is $last && - test `cat last` = 9' + test `cat last` = 10' for mail in `echo 00*` do diff --git a/t/t5100/0010 b/t/t5100/0010 new file mode 100644 index 0000000000..f5892c9da7 --- /dev/null +++ b/t/t5100/0010 @@ -0,0 +1,35 @@ +From b9704a518e21158433baa2cc2d591fea687967f6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lukas=20Sandstr=C3=B6m?= <lukass@etek.chalmers.se> +Date: Thu, 10 Jul 2008 23:41:33 +0200 +Subject: Re: discussion that lead to this patch +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[PATCH] git-mailinfo: Fix getting the subject from the body + +"Subject: " isn't in the static array "header", and thus +memcmp("Subject: ", header[i], 7) will never match. + +Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se> +Signed-off-by: Junio C Hamano <gitster@pobox.com> +--- + builtin-mailinfo.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c +index 962aa34..2d1520f 100644 +--- a/builtin-mailinfo.c ++++ b/builtin-mailinfo.c +@@ -334,7 +334,7 @@ static int check_header(char *line, unsigned linesize, char **hdr_data, int over + return 1; + if (!memcmp("[PATCH]", line, 7) && isspace(line[7])) { + for (i = 0; header[i]; i++) { +- if (!memcmp("Subject: ", header[i], 9)) { ++ if (!memcmp("Subject", header[i], 7)) { + if (! handle_header(line, hdr_data[i], 0)) { + return 1; + } +-- +1.5.6.2.455.g1efb2 + diff --git a/t/t5100/info0010 b/t/t5100/info0010 new file mode 100644 index 0000000000..1791241e46 --- /dev/null +++ b/t/t5100/info0010 @@ -0,0 +1,5 @@ +Author: Lukas Sandström +Email: lukass@etek.chalmers.se +Subject: git-mailinfo: Fix getting the subject from the body +Date: Thu, 10 Jul 2008 23:41:33 +0200 + diff --git a/t/t5100/msg0010 b/t/t5100/msg0010 new file mode 100644 index 0000000000..a96c230092 --- /dev/null +++ b/t/t5100/msg0010 @@ -0,0 +1,5 @@ +"Subject: " isn't in the static array "header", and thus +memcmp("Subject: ", header[i], 7) will never match. + +Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se> +Signed-off-by: Junio C Hamano <gitster@pobox.com> diff --git a/t/t5100/patch0010 b/t/t5100/patch0010 new file mode 100644 index 0000000000..f055481d56 --- /dev/null +++ b/t/t5100/patch0010 @@ -0,0 +1,20 @@ +--- + builtin-mailinfo.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c +index 962aa34..2d1520f 100644 +--- a/builtin-mailinfo.c ++++ b/builtin-mailinfo.c +@@ -334,7 +334,7 @@ static int check_header(char *line, unsigned linesize, char **hdr_data, int over + return 1; + if (!memcmp("[PATCH]", line, 7) && isspace(line[7])) { + for (i = 0; header[i]; i++) { +- if (!memcmp("Subject: ", header[i], 9)) { ++ if (!memcmp("Subject", header[i], 7)) { + if (! handle_header(line, hdr_data[i], 0)) { + return 1; + } +-- +1.5.6.2.455.g1efb2 + diff --git a/t/t5100/sample.mbox b/t/t5100/sample.mbox index 0476b96c33..aba57f922b 100644 --- a/t/t5100/sample.mbox +++ b/t/t5100/sample.mbox @@ -430,3 +430,38 @@ index b426a14..97756ec 100644 =20 =20 2. When the environment variable 'GIT_EXTERNAL_DIFF' is set, the +From b9704a518e21158433baa2cc2d591fea687967f6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lukas=20Sandstr=C3=B6m?= <lukass@etek.chalmers.se> +Date: Thu, 10 Jul 2008 23:41:33 +0200 +Subject: Re: discussion that lead to this patch +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +[PATCH] git-mailinfo: Fix getting the subject from the body + +"Subject: " isn't in the static array "header", and thus +memcmp("Subject: ", header[i], 7) will never match. + +Signed-off-by: Lukas Sandström <lukass@etek.chalmers.se> +Signed-off-by: Junio C Hamano <gitster@pobox.com> +--- + builtin-mailinfo.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c +index 962aa34..2d1520f 100644 +--- a/builtin-mailinfo.c ++++ b/builtin-mailinfo.c +@@ -334,7 +334,7 @@ static int check_header(char *line, unsigned linesize, char **hdr_data, int over + return 1; + if (!memcmp("[PATCH]", line, 7) && isspace(line[7])) { + for (i = 0; header[i]; i++) { +- if (!memcmp("Subject: ", header[i], 9)) { ++ if (!memcmp("Subject", header[i], 7)) { + if (! handle_header(line, hdr_data[i], 0)) { + return 1; + } +-- +1.5.6.2.455.g1efb2 + diff --git a/t/t6008-rev-list-submodule.sh b/t/t6008-rev-list-submodule.sh index 88e96fb91b..c4af9ca0a7 100755 --- a/t/t6008-rev-list-submodule.sh +++ b/t/t6008-rev-list-submodule.sh @@ -23,7 +23,7 @@ test_expect_success 'setup' ' : > super-file && git add super-file && - git submodule add . sub && + git submodule add "$(pwd)" sub && git symbolic-ref HEAD refs/heads/super && test_tick && git commit -m super-initial && diff --git a/t/t6011-rev-list-with-bad-commit.sh b/t/t6011-rev-list-with-bad-commit.sh new file mode 100755 index 0000000000..e51eb41f4b --- /dev/null +++ b/t/t6011-rev-list-with-bad-commit.sh @@ -0,0 +1,60 @@ +#!/bin/sh + +test_description='git rev-list should notice bad commits' + +. ./test-lib.sh + +# Note: +# - compression level is set to zero to make "corruptions" easier to perform +# - reflog is disabled to avoid extra references which would twart the test + +test_expect_success 'setup' \ + ' + git init && + git config core.compression 0 && + git config core.logallrefupdates false && + echo "foo" > foo && + git add foo && + git commit -m "first commit" && + echo "bar" > bar && + git add bar && + git commit -m "second commit" && + echo "baz" > baz && + git add baz && + git commit -m "third commit" && + echo "foo again" >> foo && + git add foo && + git commit -m "fourth commit" && + git repack -a -f -d + ' + +test_expect_success 'verify number of revisions' \ + ' + revs=$(git rev-list --all | wc -l) && + test $revs -eq 4 && + first_commit=$(git rev-parse HEAD~3) + ' + +test_expect_success 'corrupt second commit object' \ + ' + perl -i.bak -pe "s/second commit/socond commit/" .git/objects/pack/*.pack && + test_must_fail git fsck --full + ' + +test_expect_success 'rev-list should fail' \ + ' + test_must_fail git rev-list --all > /dev/null + ' + +test_expect_success 'git repack _MUST_ fail' \ + ' + test_must_fail git repack -a -f -d + ' + +test_expect_success 'first commit is still available' \ + ' + git log $first_commit + ' + +test_done + diff --git a/t/t6021-merge-criss-cross.sh b/t/t6021-merge-criss-cross.sh index 0ab14a6e81..331b9b07d4 100755 --- a/t/t6021-merge-criss-cross.sh +++ b/t/t6021-merge-criss-cross.sh @@ -89,4 +89,8 @@ EOF test_expect_success 'Criss-cross merge result' 'cmp file file-expect' +test_expect_success 'Criss-cross merge fails (-s resolve)' \ +'git reset --hard A^ && +test_must_fail git merge -s resolve -m "final merge" B' + test_done diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh index d21cd290d3..9ab5bdacc4 100755 --- a/t/t7600-merge.sh +++ b/t/t7600-merge.sh @@ -221,37 +221,13 @@ test_expect_success 'setup' ' test_debug 'gitk --all' -test_expect_success 'test option parsing' ' - if git merge -$ c1 - then - echo "[OOPS] -$ accepted" - false - fi && - if git merge --no-such c1 - then - echo "[OOPS] --no-such accepted" - false - fi && - if git merge -s foobar c1 - then - echo "[OOPS] -s foobar accepted" - false - fi && - if git merge -s=foobar c1 - then - echo "[OOPS] -s=foobar accepted" - false - fi && - if git merge -m - then - echo "[OOPS] missing commit msg accepted" - false - fi && - if git merge - then - echo "[OOPS] missing commit references accepted" - false - fi +test_expect_failure 'test option parsing' ' + test_must_fail git merge -$ c1 && + test_must_fail git merge --no-such c1 && + test_must_fail git merge -s foobar c1 && + test_must_fail git merge -s=foobar c1 && + test_must_fail git merge -m && + test_must_fail git merge ' test_expect_success 'merge c0 with c1' ' @@ -465,11 +441,51 @@ test_expect_success 'merge log message' ' git merge --no-log c2 && git show -s --pretty=format:%b HEAD >msg.act && verify_diff msg.nolog msg.act "[OOPS] bad merge log message" && + git merge --log c3 && git show -s --pretty=format:%b HEAD >msg.act && + verify_diff msg.log msg.act "[OOPS] bad merge log message" && + + git reset --hard HEAD^ && + git config merge.log yes && + git merge c3 && + git show -s --pretty=format:%b HEAD >msg.act && verify_diff msg.log msg.act "[OOPS] bad merge log message" ' test_debug 'gitk --all' +test_expect_success 'merge c1 with c0, c2, c0, and c1' ' + git reset --hard c1 && + git config branch.master.mergeoptions "" && + test_tick && + git merge c0 c2 c0 c1 && + verify_merge file result.1-5 && + verify_parents $c1 $c2 +' + +test_debug 'gitk --all' + +test_expect_success 'merge c1 with c0, c2, c0, and c1' ' + git reset --hard c1 && + git config branch.master.mergeoptions "" && + test_tick && + git merge c0 c2 c0 c1 && + verify_merge file result.1-5 && + verify_parents $c1 $c2 +' + +test_debug 'gitk --all' + +test_expect_success 'merge c1 with c1 and c2' ' + git reset --hard c1 && + git config branch.master.mergeoptions "" && + test_tick && + git merge c1 c2 && + verify_merge file result.1-5 && + verify_parents $c1 $c2 +' + +test_debug 'gitk --all' + test_done diff --git a/t/t7601-merge-pull-config.sh b/t/t7601-merge-pull-config.sh new file mode 100755 index 0000000000..95b4d71c51 --- /dev/null +++ b/t/t7601-merge-pull-config.sh @@ -0,0 +1,129 @@ +#!/bin/sh + +test_description='git-merge + +Testing pull.* configuration parsing.' + +. ./test-lib.sh + +test_expect_success 'setup' ' + echo c0 >c0.c && + git add c0.c && + git commit -m c0 && + git tag c0 && + echo c1 >c1.c && + git add c1.c && + git commit -m c1 && + git tag c1 && + git reset --hard c0 && + echo c2 >c2.c && + git add c2.c && + git commit -m c2 && + git tag c2 && + git reset --hard c0 && + echo c3 >c3.c && + git add c3.c && + git commit -m c3 && + git tag c3 +' + +test_expect_success 'merge c1 with c2' ' + git reset --hard c1 && + test -f c0.c && + test -f c1.c && + test ! -f c2.c && + test ! -f c3.c && + git merge c2 && + test -f c1.c && + test -f c2.c +' + +test_expect_success 'merge c1 with c2 (ours in pull.twohead)' ' + git reset --hard c1 && + git config pull.twohead ours && + git merge c2 && + test -f c1.c && + ! test -f c2.c +' + +test_expect_success 'merge c1 with c2 and c3 (recursive in pull.octopus)' ' + git reset --hard c1 && + git config pull.octopus "recursive" && + test_must_fail git merge c2 c3 && + test "$(git rev-parse c1)" = "$(git rev-parse HEAD)" +' + +test_expect_success 'merge c1 with c2 and c3 (recursive and octopus in pull.octopus)' ' + git reset --hard c1 && + git config pull.octopus "recursive octopus" && + git merge c2 c3 && + test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" && + test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" && + test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" && + test "$(git rev-parse c3)" = "$(git rev-parse HEAD^3)" && + git diff --exit-code && + test -f c0.c && + test -f c1.c && + test -f c2.c && + test -f c3.c +' + +conflict_count() +{ + { + git diff-files --name-only + git ls-files --unmerged + } | wc -l +} + +# c4 - c5 +# \ c6 +# +# There are two conflicts here: +# +# 1) Because foo.c is renamed to bar.c, recursive will handle this, +# resolve won't. +# +# 2) One in conflict.c and that will always fail. + +test_expect_success 'setup conflicted merge' ' + git reset --hard c0 && + echo A >conflict.c && + git add conflict.c && + echo contents >foo.c && + git add foo.c && + git commit -m c4 && + git tag c4 && + echo B >conflict.c && + git add conflict.c && + git mv foo.c bar.c && + git commit -m c5 && + git tag c5 && + git reset --hard c4 && + echo C >conflict.c && + git add conflict.c && + echo secondline >> foo.c && + git add foo.c && + git commit -m c6 && + git tag c6 +' + +# First do the merge with resolve and recursive then verify that +# recusive is choosen. + +test_expect_success 'merge picks up the best result' ' + git config pull.twohead "recursive resolve" && + git reset --hard c5 && + git merge -s resolve c6 + resolve_count=$(conflict_count) && + git reset --hard c5 && + git merge -s recursive c6 + recursive_count=$(conflict_count) && + git reset --hard c5 && + git merge c6 + auto_count=$(conflict_count) && + test $auto_count = $recursive_count && + test $auto_count != $resolve_count +' + +test_done diff --git a/t/t7602-merge-octopus-many.sh b/t/t7602-merge-octopus-many.sh new file mode 100755 index 0000000000..fcb8285746 --- /dev/null +++ b/t/t7602-merge-octopus-many.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +test_description='git-merge + +Testing octopus merge with more than 25 refs.' + +. ./test-lib.sh + +test_expect_success 'setup' ' + echo c0 > c0.c && + git add c0.c && + git commit -m c0 && + git tag c0 && + i=1 && + while test $i -le 30 + do + git reset --hard c0 && + echo c$i > c$i.c && + git add c$i.c && + git commit -m c$i && + git tag c$i && + i=`expr $i + 1` || return 1 + done +' + +test_expect_success 'merge c1 with c2, c3, c4, ... c29' ' + git reset --hard c1 && + i=2 && + refs="" && + while test $i -le 30 + do + refs="$refs c$i" + i=`expr $i + 1` + done + git merge $refs && + test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" && + i=1 && + while test $i -le 30 + do + test "$(git rev-parse c$i)" = "$(git rev-parse HEAD^$i)" && + i=`expr $i + 1` || return 1 + done && + git diff --exit-code && + i=1 && + while test $i -le 30 + do + test -f c$i.c && + i=`expr $i + 1` || return 1 + done +' + +test_done diff --git a/t/t7603-merge-reduce-heads.sh b/t/t7603-merge-reduce-heads.sh new file mode 100755 index 0000000000..17b19dc11f --- /dev/null +++ b/t/t7603-merge-reduce-heads.sh @@ -0,0 +1,63 @@ +#!/bin/sh + +test_description='git-merge + +Testing octopus merge when reducing parents to independent branches.' + +. ./test-lib.sh + +# 0 - 1 +# \ 2 +# \ 3 +# \ 4 - 5 +# +# So 1, 2, 3 and 5 should be kept, 4 should be avoided. + +test_expect_success 'setup' ' + echo c0 > c0.c && + git add c0.c && + git commit -m c0 && + git tag c0 && + echo c1 > c1.c && + git add c1.c && + git commit -m c1 && + git tag c1 && + git reset --hard c0 && + echo c2 > c2.c && + git add c2.c && + git commit -m c2 && + git tag c2 && + git reset --hard c0 && + echo c3 > c3.c && + git add c3.c && + git commit -m c3 && + git tag c3 && + git reset --hard c0 && + echo c4 > c4.c && + git add c4.c && + git commit -m c4 && + git tag c4 && + echo c5 > c5.c && + git add c5.c && + git commit -m c5 && + git tag c5 +' + +test_expect_success 'merge c1 with c2, c3, c4, c5' ' + git reset --hard c1 && + git merge c2 c3 c4 c5 && + test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" && + test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" && + test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" && + test "$(git rev-parse c3)" = "$(git rev-parse HEAD^3)" && + test "$(git rev-parse c5)" = "$(git rev-parse HEAD^4)" && + git diff --exit-code && + test -f c0.c && + test -f c1.c && + test -f c2.c && + test -f c3.c && + test -f c4.c && + test -f c5.c +' + +test_done diff --git a/t/t7604-merge-custom-message.sh b/t/t7604-merge-custom-message.sh new file mode 100755 index 0000000000..6081677d23 --- /dev/null +++ b/t/t7604-merge-custom-message.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +test_description='git-merge + +Testing merge when using a custom message for the merge commit.' + +. ./test-lib.sh + +test_expect_success 'setup' ' + echo c0 > c0.c && + git add c0.c && + git commit -m c0 && + git tag c0 && + echo c1 > c1.c && + git add c1.c && + git commit -m c1 && + git tag c1 && + git reset --hard c0 && + echo c2 > c2.c && + git add c2.c && + git commit -m c2 && + git tag c2 +' + +cat >expected <<\EOF +custom message + +Merge commit 'c2' +EOF +test_expect_success 'merge c2 with a custom message' ' + git reset --hard c1 && + git merge -m "custom message" c2 && + git cat-file commit HEAD | sed -e "1,/^$/d" > actual && + test_cmp expected actual +' + +test_done diff --git a/t/t7605-merge-resolve.sh b/t/t7605-merge-resolve.sh new file mode 100755 index 0000000000..ee21a107fd --- /dev/null +++ b/t/t7605-merge-resolve.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +test_description='git-merge + +Testing the resolve strategy.' + +. ./test-lib.sh + +test_expect_success 'setup' ' + echo c0 > c0.c && + git add c0.c && + git commit -m c0 && + git tag c0 && + echo c1 > c1.c && + git add c1.c && + git commit -m c1 && + git tag c1 && + git reset --hard c0 && + echo c2 > c2.c && + git add c2.c && + git commit -m c2 && + git tag c2 && + git reset --hard c0 && + echo c3 > c2.c && + git add c2.c && + git commit -m c3 && + git tag c3 +' + +test_expect_success 'merge c1 to c2' ' + git reset --hard c1 && + git merge -s resolve c2 && + test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" && + test "$(git rev-parse c1)" = "$(git rev-parse HEAD^1)" && + test "$(git rev-parse c2)" = "$(git rev-parse HEAD^2)" && + git diff --exit-code && + test -f c0.c && + test -f c1.c && + test -f c2.c +' + +test_expect_success 'merge c2 to c3 (fails)' ' + git reset --hard c2 && + test_must_fail git merge -s resolve c3 +' +test_done diff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh index 58a3a7b1c3..27a65e05df 100755 --- a/t/t9106-git-svn-commit-diff-clobber.sh +++ b/t/t9106-git-svn-commit-diff-clobber.sh @@ -87,7 +87,7 @@ test_expect_success 'multiple dcommit from git-svn will not clobber svn' " " -test_expect_success 'check that rebase really failed' 'test -d .dotest' +test_expect_success 'check that rebase really failed' 'test -d .git/rebase' test_expect_success 'resolve, continue the rebase and dcommit' " echo clobber and I really mean it > file && diff --git a/t/t9110-git-svn-use-svm-props.sh b/t/t9110-git-svn-use-svm-props.sh index 047659fde1..04d2a65c08 100755 --- a/t/t9110-git-svn-use-svm-props.sh +++ b/t/t9110-git-svn-use-svm-props.sh @@ -49,4 +49,13 @@ test_expect_success 'verify metadata for /dir' " grep '^git-svn-id: $dir_url@1 $uuid$' " +test_expect_success 'find commit based on SVN revision number' " + git-svn find-rev r12 | + grep `git rev-parse HEAD` + " + +test_expect_success 'empty rebase' " + git-svn rebase + " + test_done diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh index 655f88270b..1e01e5c748 100755 --- a/t/t9600-cvsimport.sh +++ b/t/t9600-cvsimport.sh @@ -18,7 +18,7 @@ fi cvsps_version=`cvsps -h 2>&1 | sed -ne 's/cvsps version //p'` case "$cvsps_version" in -2.1) +2.1 | 2.2*) ;; '') say 'skipping cvsimport tests, cvsps not found' @@ -26,7 +26,7 @@ case "$cvsps_version" in exit ;; *) - say 'skipping cvsimport tests, cvsps too old' + say 'skipping cvsimport tests, unsupported cvsps version' test_done exit ;; |