From ea4b52a86f6b6b8e5aef8e47fb557f37422512bf Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 7 Apr 2007 05:42:01 -0700 Subject: t1000: fix case table. Case #10 is not handled with unpack-trees.c:threeway_merge() internally, unless under the agressive rule, and it is not a bug. As the test expects, ND (one side did not do anything, other side deleted) case was meant to be handled by the caller's policy (e.g. git-merge-one-file or git-merge-recursive). Signed-off-by: Junio C Hamano --- t/t1000-read-tree-m-3way.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t1000-read-tree-m-3way.sh b/t/t1000-read-tree-m-3way.sh index e26a36cf0f..de4e5eb61f 100755 --- a/t/t1000-read-tree-m-3way.sh +++ b/t/t1000-read-tree-m-3way.sh @@ -184,7 +184,7 @@ checked. 9 exists O!=A missing no merge must match A and be up-to-date, if exists. ------------------------------------------------------------------ - 10 exists O==A missing remove ditto + 10 exists O==A missing no merge must match A ------------------------------------------------------------------ 11 exists O!=A O!=B no merge must match A and be A!=B up-to-date, if exists. -- cgit v1.2.3 From 885b98107547fe3f6d17ca0af0578e040f7600d0 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 7 Apr 2007 07:17:35 -0700 Subject: t3030: merge-recursive backend test. We have fairly extensive coverage of read-tree 3-way machinery, and many Porcelain-ish tests use git-merge front-end tests, but we did not have good basic test for merge-recursive, which made it very hard to hack on it. I used this during the recent work to teach D/F conflicts to merge-recursive. Signed-off-by: Junio C Hamano --- t/t3030-merge-recursive.sh | 528 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 528 insertions(+) create mode 100755 t/t3030-merge-recursive.sh (limited to 't') diff --git a/t/t3030-merge-recursive.sh b/t/t3030-merge-recursive.sh new file mode 100755 index 0000000000..aef92b9b92 --- /dev/null +++ b/t/t3030-merge-recursive.sh @@ -0,0 +1,528 @@ +#!/bin/sh + +test_description='merge-recursive backend test' + +. ./test-lib.sh + +test_expect_success 'setup 1' ' + + echo hello >a && + o0=$(git hash-object a) && + cp a b && + cp a A && + mkdir d && + cp a d/e && + + test_tick && + git add a b A d/e && + git commit -m initial && + c0=$(git rev-parse --verify HEAD) && + git branch side && + git branch df-1 && + git branch df-2 && + git branch df-3 && + git branch remove && + + echo hello >>a && + cp a d/e && + o1=$(git hash-object a) && + + git add a d/e && + + test_tick && + git commit -m "master modifies a and d/e" && + c1=$(git rev-parse --verify HEAD) && + ( git ls-tree -r HEAD ; git ls-files -s ) >actual && + ( + echo "100644 blob $o0 A" + echo "100644 blob $o1 a" + echo "100644 blob $o0 b" + echo "100644 blob $o1 d/e" + echo "100644 $o0 0 A" + echo "100644 $o1 0 a" + echo "100644 $o0 0 b" + echo "100644 $o1 0 d/e" + ) >expected && + git diff -u expected actual +' + +test_expect_success 'setup 2' ' + + rm -rf [Aabd] && + git checkout side && + ( git ls-tree -r HEAD ; git ls-files -s ) >actual && + ( + echo "100644 blob $o0 A" + echo "100644 blob $o0 a" + echo "100644 blob $o0 b" + echo "100644 blob $o0 d/e" + echo "100644 $o0 0 A" + echo "100644 $o0 0 a" + echo "100644 $o0 0 b" + echo "100644 $o0 0 d/e" + ) >expected && + git diff -u expected actual && + + echo goodbye >>a && + o2=$(git hash-object a) && + + git add a && + + test_tick && + git commit -m "side modifies a" && + c2=$(git rev-parse --verify HEAD) && + ( git ls-tree -r HEAD ; git ls-files -s ) >actual && + ( + echo "100644 blob $o0 A" + echo "100644 blob $o2 a" + echo "100644 blob $o0 b" + echo "100644 blob $o0 d/e" + echo "100644 $o0 0 A" + echo "100644 $o2 0 a" + echo "100644 $o0 0 b" + echo "100644 $o0 0 d/e" + ) >expected && + git diff -u expected actual +' + +test_expect_success 'setup 3' ' + + rm -rf [Aabd] && + git checkout df-1 && + ( git ls-tree -r HEAD ; git ls-files -s ) >actual && + ( + echo "100644 blob $o0 A" + echo "100644 blob $o0 a" + echo "100644 blob $o0 b" + echo "100644 blob $o0 d/e" + echo "100644 $o0 0 A" + echo "100644 $o0 0 a" + echo "100644 $o0 0 b" + echo "100644 $o0 0 d/e" + ) >expected && + git diff -u expected actual && + + rm -f b && mkdir b && echo df-1 >b/c && git add b/c && + o3=$(git hash-object b/c) && + + test_tick && + git commit -m "df-1 makes b/c" && + c3=$(git rev-parse --verify HEAD) && + ( git ls-tree -r HEAD ; git ls-files -s ) >actual && + ( + echo "100644 blob $o0 A" + echo "100644 blob $o0 a" + echo "100644 blob $o3 b/c" + echo "100644 blob $o0 d/e" + echo "100644 $o0 0 A" + echo "100644 $o0 0 a" + echo "100644 $o3 0 b/c" + echo "100644 $o0 0 d/e" + ) >expected && + git diff -u expected actual +' + +test_expect_success 'setup 4' ' + + rm -rf [Aabd] && + git checkout df-2 && + ( git ls-tree -r HEAD ; git ls-files -s ) >actual && + ( + echo "100644 blob $o0 A" + echo "100644 blob $o0 a" + echo "100644 blob $o0 b" + echo "100644 blob $o0 d/e" + echo "100644 $o0 0 A" + echo "100644 $o0 0 a" + echo "100644 $o0 0 b" + echo "100644 $o0 0 d/e" + ) >expected && + git diff -u expected actual && + + rm -f a && mkdir a && echo df-2 >a/c && git add a/c && + o4=$(git hash-object a/c) && + + test_tick && + git commit -m "df-2 makes a/c" && + c4=$(git rev-parse --verify HEAD) && + ( git ls-tree -r HEAD ; git ls-files -s ) >actual && + ( + echo "100644 blob $o0 A" + echo "100644 blob $o4 a/c" + echo "100644 blob $o0 b" + echo "100644 blob $o0 d/e" + echo "100644 $o0 0 A" + echo "100644 $o4 0 a/c" + echo "100644 $o0 0 b" + echo "100644 $o0 0 d/e" + ) >expected && + git diff -u expected actual +' + +test_expect_success 'setup 5' ' + + rm -rf [Aabd] && + git checkout remove && + ( git ls-tree -r HEAD ; git ls-files -s ) >actual && + ( + echo "100644 blob $o0 A" + echo "100644 blob $o0 a" + echo "100644 blob $o0 b" + echo "100644 blob $o0 d/e" + echo "100644 $o0 0 A" + echo "100644 $o0 0 a" + echo "100644 $o0 0 b" + echo "100644 $o0 0 d/e" + ) >expected && + git diff -u expected actual && + + rm -f b && + echo remove-conflict >a && + + git add a && + git rm b && + o5=$(git hash-object a) && + + test_tick && + git commit -m "remove removes b and modifies a" && + c5=$(git rev-parse --verify HEAD) && + ( git ls-tree -r HEAD ; git ls-files -s ) >actual && + ( + echo "100644 blob $o0 A" + echo "100644 blob $o5 a" + echo "100644 blob $o0 d/e" + echo "100644 $o0 0 A" + echo "100644 $o5 0 a" + echo "100644 $o0 0 d/e" + ) >expected && + git diff -u expected actual + +' + +test_expect_success 'setup 6' ' + + rm -rf [Aabd] && + git checkout df-3 && + ( git ls-tree -r HEAD ; git ls-files -s ) >actual && + ( + echo "100644 blob $o0 A" + echo "100644 blob $o0 a" + echo "100644 blob $o0 b" + echo "100644 blob $o0 d/e" + echo "100644 $o0 0 A" + echo "100644 $o0 0 a" + echo "100644 $o0 0 b" + echo "100644 $o0 0 d/e" + ) >expected && + git diff -u expected actual && + + rm -fr d && echo df-3 >d && git add d && + o6=$(git hash-object d) && + + test_tick && + git commit -m "df-3 makes d" && + c6=$(git rev-parse --verify HEAD) && + ( git ls-tree -r HEAD ; git ls-files -s ) >actual && + ( + echo "100644 blob $o0 A" + echo "100644 blob $o0 a" + echo "100644 blob $o0 b" + echo "100644 blob $o6 d" + echo "100644 $o0 0 A" + echo "100644 $o0 0 a" + echo "100644 $o0 0 b" + echo "100644 $o6 0 d" + ) >expected && + git diff -u expected actual +' + +test_expect_success 'merge-recursive simple' ' + + rm -fr [Aabd] && + git checkout -f "$c2" && + + git-merge-recursive "$c0" -- "$c2" "$c1" + status=$? + case "$status" in + 1) + : happy + ;; + *) + echo >&2 "why status $status!!!" + false + ;; + esac +' + +test_expect_success 'merge-recursive result' ' + + git ls-files -s >actual && + ( + echo "100644 $o0 0 A" + echo "100644 $o0 1 a" + echo "100644 $o2 2 a" + echo "100644 $o1 3 a" + echo "100644 $o0 0 b" + echo "100644 $o1 0 d/e" + ) >expected && + git diff -u expected actual + +' + +test_expect_success 'merge-recursive remove conflict' ' + + rm -fr [Aabd] && + git checkout -f "$c1" && + + git-merge-recursive "$c0" -- "$c1" "$c5" + status=$? + case "$status" in + 1) + : happy + ;; + *) + echo >&2 "why status $status!!!" + false + ;; + esac +' + +test_expect_success 'merge-recursive remove conflict' ' + + git ls-files -s >actual && + ( + echo "100644 $o0 0 A" + echo "100644 $o0 1 a" + echo "100644 $o1 2 a" + echo "100644 $o5 3 a" + echo "100644 $o1 0 d/e" + ) >expected && + git diff -u expected actual + +' + +test_expect_success 'merge-recursive d/f simple' ' + rm -fr [Aabd] && + git reset --hard && + git checkout -f "$c1" && + + git-merge-recursive "$c0" -- "$c1" "$c3" +' + +test_expect_success 'merge-recursive result' ' + + git ls-files -s >actual && + ( + echo "100644 $o0 0 A" + echo "100644 $o1 0 a" + echo "100644 $o3 0 b/c" + echo "100644 $o1 0 d/e" + ) >expected && + git diff -u expected actual + +' + +test_expect_success 'merge-recursive d/f conflict' ' + + rm -fr [Aabd] && + git reset --hard && + git checkout -f "$c1" && + + git-merge-recursive "$c0" -- "$c1" "$c4" + status=$? + case "$status" in + 1) + : happy + ;; + *) + echo >&2 "why status $status!!!" + false + ;; + esac +' + +test_expect_success 'merge-recursive d/f conflict result' ' + + git ls-files -s >actual && + ( + echo "100644 $o0 0 A" + echo "100644 $o0 1 a" + echo "100644 $o1 2 a" + echo "100644 $o4 0 a/c" + echo "100644 $o0 0 b" + echo "100644 $o1 0 d/e" + ) >expected && + git diff -u expected actual + +' + +test_expect_success 'merge-recursive d/f conflict the other way' ' + + rm -fr [Aabd] && + git reset --hard && + git checkout -f "$c4" && + + git-merge-recursive "$c0" -- "$c4" "$c1" + status=$? + case "$status" in + 1) + : happy + ;; + *) + echo >&2 "why status $status!!!" + false + ;; + esac +' + +test_expect_success 'merge-recursive d/f conflict result the other way' ' + + git ls-files -s >actual && + ( + echo "100644 $o0 0 A" + echo "100644 $o0 1 a" + echo "100644 $o1 3 a" + echo "100644 $o4 0 a/c" + echo "100644 $o0 0 b" + echo "100644 $o1 0 d/e" + ) >expected && + git diff -u expected actual + +' + +test_expect_success 'merge-recursive d/f conflict' ' + + rm -fr [Aabd] && + git reset --hard && + git checkout -f "$c1" && + + git-merge-recursive "$c0" -- "$c1" "$c6" + status=$? + case "$status" in + 1) + : happy + ;; + *) + echo >&2 "why status $status!!!" + false + ;; + esac +' + +test_expect_success 'merge-recursive d/f conflict result' ' + + git ls-files -s >actual && + ( + echo "100644 $o0 0 A" + echo "100644 $o1 0 a" + echo "100644 $o0 0 b" + echo "100644 $o6 3 d" + echo "100644 $o0 1 d/e" + echo "100644 $o1 2 d/e" + ) >expected && + git diff -u expected actual + +' + +test_expect_success 'merge-recursive d/f conflict' ' + + rm -fr [Aabd] && + git reset --hard && + git checkout -f "$c6" && + + git-merge-recursive "$c0" -- "$c6" "$c1" + status=$? + case "$status" in + 1) + : happy + ;; + *) + echo >&2 "why status $status!!!" + false + ;; + esac +' + +test_expect_success 'merge-recursive d/f conflict result' ' + + git ls-files -s >actual && + ( + echo "100644 $o0 0 A" + echo "100644 $o1 0 a" + echo "100644 $o0 0 b" + echo "100644 $o6 2 d" + echo "100644 $o0 1 d/e" + echo "100644 $o1 3 d/e" + ) >expected && + git diff -u expected actual + +' + +test_expect_success 'reset and 3-way merge' ' + + git reset --hard "$c2" && + git read-tree -m "$c0" "$c2" "$c1" + +' + +test_expect_success 'reset and bind merge' ' + + git reset --hard master && + git read-tree --prefix=M/ master && + git ls-files -s >actual && + ( + echo "100644 $o0 0 A" + echo "100644 $o0 0 M/A" + echo "100644 $o1 0 M/a" + echo "100644 $o0 0 M/b" + echo "100644 $o1 0 M/d/e" + echo "100644 $o1 0 a" + echo "100644 $o0 0 b" + echo "100644 $o1 0 d/e" + ) >expected && + git diff -u expected actual && + + git read-tree --prefix=a1/ master && + git ls-files -s >actual && + ( + echo "100644 $o0 0 A" + echo "100644 $o0 0 M/A" + echo "100644 $o1 0 M/a" + echo "100644 $o0 0 M/b" + echo "100644 $o1 0 M/d/e" + echo "100644 $o1 0 a" + echo "100644 $o0 0 a1/A" + echo "100644 $o1 0 a1/a" + echo "100644 $o0 0 a1/b" + echo "100644 $o1 0 a1/d/e" + echo "100644 $o0 0 b" + echo "100644 $o1 0 d/e" + ) >expected && + git diff -u expected actual + + git read-tree --prefix=z/ master && + git ls-files -s >actual && + ( + echo "100644 $o0 0 A" + echo "100644 $o0 0 M/A" + echo "100644 $o1 0 M/a" + echo "100644 $o0 0 M/b" + echo "100644 $o1 0 M/d/e" + echo "100644 $o1 0 a" + echo "100644 $o0 0 a1/A" + echo "100644 $o1 0 a1/a" + echo "100644 $o0 0 a1/b" + echo "100644 $o1 0 a1/d/e" + echo "100644 $o0 0 b" + echo "100644 $o1 0 d/e" + echo "100644 $o0 0 z/A" + echo "100644 $o1 0 z/a" + echo "100644 $o0 0 z/b" + echo "100644 $o1 0 z/d/e" + ) >expected && + git diff -u expected actual + +' + +test_done + -- cgit v1.2.3 From 171ddd91771f042e49db49ff068694b5ed6f845d Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Wed, 11 Apr 2007 16:58:08 -0700 Subject: Add testcase for format-patch --subject-prefix (take 3) Add testcase for format-patch --subject-prefix support. Signed-off-by: Robin H. Johnson Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 1 + ...tdout_--subject-prefix=TESTCASE_initial..master | 164 +++++++++++++++++++++ 2 files changed, 165 insertions(+) create mode 100644 t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master (limited to 't') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 488e075c16..8f4c29a6b5 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -241,6 +241,7 @@ format-patch --attach --stdout initial..master format-patch --inline --stdout initial..side format-patch --inline --stdout initial..master^ format-patch --inline --stdout initial..master +format-patch --inline --stdout --subject-prefix=TESTCASE initial..master diff --abbrev initial..side diff -r initial..side diff --git a/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master b/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master new file mode 100644 index 0000000000..a8093be7ca --- /dev/null +++ b/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master @@ -0,0 +1,164 @@ +$ git format-patch --inline --stdout --subject-prefix=TESTCASE initial..master +From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001 +From: A U Thor +Date: Mon, 26 Jun 2006 00:01:00 +0000 +Subject: [TESTCASE] Second +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" + +This is a multi-part message in MIME format. +--------------g-i-t--v-e-r-s-i-o-n +Content-Type: text/plain; charset=UTF-8; format=fixed +Content-Transfer-Encoding: 8bit + + +This is the second commit. +--- + dir/sub | 2 ++ + file0 | 3 +++ + file2 | 3 --- + 3 files changed, 5 insertions(+), 3 deletions(-) + delete mode 100644 file2 +--------------g-i-t--v-e-r-s-i-o-n +Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" +Content-Transfer-Encoding: 8bit +Content-Disposition: inline; filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" + +diff --git a/dir/sub b/dir/sub +index 35d242b..8422d40 100644 +--- a/dir/sub ++++ b/dir/sub +@@ -1,2 +1,4 @@ + A + B ++C ++D +diff --git a/file0 b/file0 +index 01e79c3..b414108 100644 +--- a/file0 ++++ b/file0 +@@ -1,3 +1,6 @@ + 1 + 2 + 3 ++4 ++5 ++6 +diff --git a/file2 b/file2 +deleted file mode 100644 +index 01e79c3..0000000 +--- a/file2 ++++ /dev/null +@@ -1,3 +0,0 @@ +-1 +-2 +-3 + +--------------g-i-t--v-e-r-s-i-o-n-- + + + +From 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0 Mon Sep 17 00:00:00 2001 +From: A U Thor +Date: Mon, 26 Jun 2006 00:02:00 +0000 +Subject: [TESTCASE] Third +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" + +This is a multi-part message in MIME format. +--------------g-i-t--v-e-r-s-i-o-n +Content-Type: text/plain; charset=UTF-8; format=fixed +Content-Transfer-Encoding: 8bit + +--- + dir/sub | 2 ++ + file1 | 3 +++ + 2 files changed, 5 insertions(+), 0 deletions(-) + create mode 100644 file1 +--------------g-i-t--v-e-r-s-i-o-n +Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" +Content-Transfer-Encoding: 8bit +Content-Disposition: inline; filename="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" + +diff --git a/dir/sub b/dir/sub +index 8422d40..cead32e 100644 +--- a/dir/sub ++++ b/dir/sub +@@ -2,3 +2,5 @@ A + B + C + D ++E ++F +diff --git a/file1 b/file1 +new file mode 100644 +index 0000000..b1e6722 +--- /dev/null ++++ b/file1 +@@ -0,0 +1,3 @@ ++A ++B ++C + +--------------g-i-t--v-e-r-s-i-o-n-- + + + +From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001 +From: A U Thor +Date: Mon, 26 Jun 2006 00:03:00 +0000 +Subject: [TESTCASE] Side +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" + +This is a multi-part message in MIME format. +--------------g-i-t--v-e-r-s-i-o-n +Content-Type: text/plain; charset=UTF-8; format=fixed +Content-Transfer-Encoding: 8bit + +--- + dir/sub | 2 ++ + file0 | 3 +++ + file3 | 4 ++++ + 3 files changed, 9 insertions(+), 0 deletions(-) + create mode 100644 file3 +--------------g-i-t--v-e-r-s-i-o-n +Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" +Content-Transfer-Encoding: 8bit +Content-Disposition: inline; filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" + +diff --git a/dir/sub b/dir/sub +index 35d242b..7289e35 100644 +--- a/dir/sub ++++ b/dir/sub +@@ -1,2 +1,4 @@ + A + B ++1 ++2 +diff --git a/file0 b/file0 +index 01e79c3..f4615da 100644 +--- a/file0 ++++ b/file0 +@@ -1,3 +1,6 @@ + 1 + 2 + 3 ++A ++B ++C +diff --git a/file3 b/file3 +new file mode 100644 +index 0000000..7289e35 +--- /dev/null ++++ b/file3 +@@ -0,0 +1,4 @@ ++A ++B ++1 ++2 + +--------------g-i-t--v-e-r-s-i-o-n-- + + +$ -- cgit v1.2.3 From 39551b6926ef869e15af41f4eaa9356da98b2b5e Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Wed, 11 Apr 2007 13:35:13 -0400 Subject: use test-genrandom in tests instead of /dev/urandom This way tests are completely deterministic and possibly more portable. Signed-off-by: Nicolas Pitre --- t/t5301-sliding-window.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh index a6dbb04a86..fce77f1255 100755 --- a/t/t5301-sliding-window.sh +++ b/t/t5301-sliding-window.sh @@ -12,7 +12,7 @@ test_expect_success \ for i in a b c do echo $i >$i && - dd if=/dev/urandom bs=32k count=1 >>$i && + test-genrandom "$i" 32768 >>$i && git-update-index --add $i || return 1 done && echo d >d && cat c >>d && git-update-index --add d && -- cgit v1.2.3 From 6e5417769c587c8b1f3412e19a1f80645fe82a3c Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Tue, 10 Apr 2007 16:26:10 -0400 Subject: tests for various pack index features This is a fairly complete list of tests for various aspects of pack index versions 1 and 2. Tests on index v2 include 32-bit and 64-bit offsets, as well as a nice demonstration of the flawed repacking integrity checks that index version 2 intend to solve over index version 1 with the per object CRC. Signed-off-by: Nicolas Pitre Signed-off-by: Junio C Hamano --- t/t5302-pack-index.sh | 146 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100755 t/t5302-pack-index.sh (limited to 't') diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh new file mode 100755 index 0000000000..232e5f1964 --- /dev/null +++ b/t/t5302-pack-index.sh @@ -0,0 +1,146 @@ +#!/bin/sh +# +# Copyright (c) 2007 Nicolas Pitre +# + +test_description='pack index with 64-bit offsets and object CRC' +. ./test-lib.sh + +test_expect_success \ + 'setup' \ + 'rm -rf .git + git-init && + for i in `seq -w 100` + do + echo $i >file_$i && + test-genrandom "$i" 8192 >>file_$i && + git-update-index --add file_$i || return 1 + done && + echo 101 >file_101 && tail -c 8192 file_100 >>file_101 && + git-update-index --add file_101 && + tree=`git-write-tree` && + commit=`git-commit-tree $tree obj-list && + git-update-ref HEAD $commit' + +test_expect_success \ + 'pack-objects with index version 1' \ + 'pack1=$(git-pack-objects --index-version=1 test-1 blob_1 && + chmod +w ".git/objects/pack/pack-${pack1}.pack" && + dd of=".git/objects/pack/pack-${pack1}.pack" seek=$(($delta_offs + 1)) \ + if=".git/objects/pack/pack-${pack1}.idx" skip=$((256 * 4 + 4)) \ + bs=1 count=20 conv=notrunc && + git-cat-file blob "$delta_sha1" > blob_2 )' + +test_expect_failure \ + '[index v1] 3) corrupted delta happily returned wrong data' \ + 'cmp blob_1 blob_2' + +test_expect_failure \ + '[index v1] 4) confirm that the pack is actually corrupted' \ + 'git-fsck --full $commit' + +test_expect_success \ + '[index v1] 5) pack-objects happily reuses corrupted data' \ + 'pack4=$(git-pack-objects test-4 blob_3 && + chmod +w ".git/objects/pack/pack-${pack1}.pack" && + dd of=".git/objects/pack/pack-${pack1}.pack" seek=$(($delta_offs + 1)) \ + if=".git/objects/pack/pack-${pack1}.idx" skip=$((8 + 256 * 4)) \ + bs=1 count=20 conv=notrunc && + git-cat-file blob "$delta_sha1" > blob_4 )' + +test_expect_failure \ + '[index v2] 3) corrupted delta happily returned wrong data' \ + 'cmp blob_3 blob_4' + +test_expect_failure \ + '[index v2] 4) confirm that the pack is actually corrupted' \ + 'git-fsck --full $commit' + +test_expect_failure \ + '[index v2] 5) pack-objects refuses to reuse corrupted data' \ + 'git-pack-objects test-5 Date: Thu, 12 Apr 2007 22:30:05 -0700 Subject: Define 'crlf' attribute. This defines the semantics of 'crlf' attribute as an example. When a path has this attribute unset (i.e. '!crlf'), autocrlf line-end conversion is not applied. Eventually we would want to let users to build a pipeline of processing to munge blob data to filesystem format (and in the other direction) based on combination of attributes, and at that point the mechanism in convert_to_{git,working_tree}() that looks at 'crlf' attribute needs to be enhanced. Perhaps the existing 'crlf' would become the first step in the input chain, and the last step in the output chain. Signed-off-by: Junio C Hamano --- t/t0020-crlf.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 't') diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh index 723b29ad17..600dcd30a0 100755 --- a/t/t0020-crlf.sh +++ b/t/t0020-crlf.sh @@ -214,4 +214,28 @@ test_expect_success 'apply patch --index (autocrlf=true)' ' } ' +test_expect_success '.gitattributes says two is binary' ' + + echo "two !crlf" >.gitattributes && + rm -f tmp one dir/two && + git repo-config core.autocrlf true && + git read-tree --reset -u HEAD && + + if remove_cr dir/two >/dev/null + then + echo "Huh?" + false + else + : happy + fi && + + if remove_cr one >/dev/null + then + : happy + else + echo "Huh?" + false + fi +' + test_done -- cgit v1.2.3 From e4aee10a2eaf0937d86d046f85ee569a75cae9ac Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 15 Apr 2007 14:56:09 -0700 Subject: Change attribute negation marker from '!' to '-'. At the same time, we do not want to allow arbitrary strings for attribute names, as we are likely to want to extend the syntax later. Allow only alnum, dash, underscore and dot for now. Signed-off-by: Junio C Hamano --- t/t0020-crlf.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh index 600dcd30a0..cf84f0a1ab 100755 --- a/t/t0020-crlf.sh +++ b/t/t0020-crlf.sh @@ -216,7 +216,7 @@ test_expect_success 'apply patch --index (autocrlf=true)' ' test_expect_success '.gitattributes says two is binary' ' - echo "two !crlf" >.gitattributes && + echo "two -crlf" >.gitattributes && rm -f tmp one dir/two && git repo-config core.autocrlf true && git read-tree --reset -u HEAD && -- cgit v1.2.3 From b48caa20de7f62f648de7d3dbb0ceb462879e903 Mon Sep 17 00:00:00 2001 From: Steven Grimm Date: Mon, 16 Apr 2007 00:46:48 -0700 Subject: Add --quiet option to suppress output of "rm" commands for removed files. Signed-off-by: Steven Grimm Signed-off-by: Junio C Hamano --- t/t3600-rm.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 't') diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index e31cf93a00..da9da92180 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -84,6 +84,26 @@ test_expect_success \ 'When the rm in "git-rm -f" fails, it should not remove the file from the index' \ 'git-ls-files --error-unmatch baz' +test_expect_success '"rm" command printed' ' + echo frotz > test-file && + git add test-file && + git commit -m "add file for rm test" && + git rm test-file > rm-output && + test `egrep "^rm " rm-output | wc -l` = 1 && + rm -f test-file rm-output && + git commit -m "remove file from rm test" +' + +test_expect_success '"rm" command suppressed with --quiet' ' + echo frotz > test-file && + git add test-file && + git commit -m "add file for rm --quiet test" && + git rm --quiet test-file > rm-output && + test `wc -l < rm-output` = 0 && + rm -f test-file rm-output && + git commit -m "remove file from rm --quiet test" +' + # Now, failure cases. test_expect_success 'Re-add foo and baz' ' git add foo baz && @@ -154,4 +174,8 @@ test_expect_success 'Recursive with -r -f' ' ! test -d frotz ' +test_expect_failure 'Remove nonexistent file returns nonzero exit status' ' + git rm nonexistent +' + test_done -- cgit v1.2.3 From f948792990f82a35bf0c98510e7511ef8acb9cd3 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Tue, 17 Apr 2007 06:51:48 +0200 Subject: Bisect: rename "t/t6030-bisect-run.sh" to "t/t6030-bisect-porcelain.sh". [jc: also fix 0a5280a9 that incorrectly changed the title of one test.] Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- t/t6030-bisect-porcelain.sh | 102 ++++++++++++++++++++++++++++++++++++++++++++ t/t6030-bisect-run.sh | 102 -------------------------------------------- 2 files changed, 102 insertions(+), 102 deletions(-) create mode 100755 t/t6030-bisect-porcelain.sh delete mode 100755 t/t6030-bisect-run.sh (limited to 't') diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh new file mode 100755 index 0000000000..13e9379236 --- /dev/null +++ b/t/t6030-bisect-porcelain.sh @@ -0,0 +1,102 @@ +#!/bin/sh +# +# Copyright (c) 2007 Christian Couder +# +test_description='Tests git-bisect functionality' + +exec > $_file || return $? + MSG="Add <$_line> into <$_file>." + else + echo "$_line" > $_file || return $? + git add $_file || return $? + MSG="Create file <$_file> with <$_line> inside." + fi + + git-commit -m "$MSG" $_file +} + +HASH1= +HASH3= +HASH4= + +test_expect_success \ + 'set up basic repo with 1 file (hello) and 4 commits' \ + 'add_line_into_file "1: Hello World" hello && + add_line_into_file "2: A new day for git" hello && + add_line_into_file "3: Another new day for git" hello && + add_line_into_file "4: Ciao for now" hello && + HASH1=$(git rev-list HEAD | tail -1) && + HASH3=$(git rev-list HEAD | head -2 | tail -1) && + HASH4=$(git rev-list HEAD | head -1)' + +test_expect_success 'bisect starts with only one bad' ' + git bisect reset && + git bisect start && + git bisect bad $HASH4 && + git bisect next +' + +test_expect_success 'bisect does not start with only one good' ' + git bisect reset && + git bisect start && + git bisect good $HASH1 || return 1 + + if git bisect next + then + echo Oops, should have failed. + false + else + : + fi +' + +test_expect_success 'bisect start with one bad and good' ' + git bisect reset && + git bisect start && + git bisect good $HASH1 && + git bisect bad $HASH4 && + git bisect next +' + +# We want to automatically find the commit that +# introduced "Another" into hello. +test_expect_success \ + '"git bisect run" simple case' \ + 'echo "#"\!"/bin/sh" > test_script.sh && + echo "grep Another hello > /dev/null" >> test_script.sh && + echo "test \$? -ne 0" >> test_script.sh && + chmod +x test_script.sh && + git bisect start && + git bisect good $HASH1 && + git bisect bad $HASH4 && + git bisect run ./test_script.sh > my_bisect_log.txt && + grep "$HASH3 is first bad commit" my_bisect_log.txt && + git bisect reset' + +# We want to automatically find the commit that +# introduced "Ciao" into hello. +test_expect_success \ + '"git bisect run" with more complex "git bisect start"' \ + 'echo "#"\!"/bin/sh" > test_script.sh && + echo "grep Ciao hello > /dev/null" >> test_script.sh && + echo "test \$? -ne 0" >> test_script.sh && + chmod +x test_script.sh && + git bisect start $HASH4 $HASH1 && + git bisect run ./test_script.sh > my_bisect_log.txt && + grep "$HASH4 is first bad commit" my_bisect_log.txt && + git bisect reset' + +# +# +test_done + diff --git a/t/t6030-bisect-run.sh b/t/t6030-bisect-run.sh deleted file mode 100755 index de3123522a..0000000000 --- a/t/t6030-bisect-run.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2007 Christian Couder -# -test_description='Tests git-bisect functionality' - -exec > $_file || return $? - MSG="Add <$_line> into <$_file>." - else - echo "$_line" > $_file || return $? - git add $_file || return $? - MSG="Create file <$_file> with <$_line> inside." - fi - - git-commit -m "$MSG" $_file -} - -HASH1= -HASH3= -HASH4= - -test_expect_success \ - 'set up basic repo with 1 file (hello) and 4 commits' \ - 'add_line_into_file "1: Hello World" hello && - add_line_into_file "2: A new day for git" hello && - add_line_into_file "3: Another new day for git" hello && - add_line_into_file "4: Ciao for now" hello && - HASH1=$(git rev-list HEAD | tail -1) && - HASH3=$(git rev-list HEAD | head -2 | tail -1) && - HASH4=$(git rev-list HEAD | head -1)' - -test_expect_success 'bisect starts with only one bad' ' - git bisect reset && - git bisect start && - git bisect bad $HASH4 && - git bisect next -' - -test_expect_success 'bisect starts with only one good' ' - git bisect reset && - git bisect start && - git bisect good $HASH1 || return 1 - - if git bisect next - then - echo Oops, should have failed. - false - else - : - fi -' - -test_expect_success 'bisect start with one bad and good' ' - git bisect reset && - git bisect start && - git bisect good $HASH1 && - git bisect bad $HASH4 && - git bisect next -' - -# We want to automatically find the commit that -# introduced "Another" into hello. -test_expect_success \ - '"git bisect run" simple case' \ - 'echo "#"\!"/bin/sh" > test_script.sh && - echo "grep Another hello > /dev/null" >> test_script.sh && - echo "test \$? -ne 0" >> test_script.sh && - chmod +x test_script.sh && - git bisect start && - git bisect good $HASH1 && - git bisect bad $HASH4 && - git bisect run ./test_script.sh > my_bisect_log.txt && - grep "$HASH3 is first bad commit" my_bisect_log.txt && - git bisect reset' - -# We want to automatically find the commit that -# introduced "Ciao" into hello. -test_expect_success \ - '"git bisect run" with more complex "git bisect start"' \ - 'echo "#"\!"/bin/sh" > test_script.sh && - echo "grep Ciao hello > /dev/null" >> test_script.sh && - echo "test \$? -ne 0" >> test_script.sh && - chmod +x test_script.sh && - git bisect start $HASH4 $HASH1 && - git bisect run ./test_script.sh > my_bisect_log.txt && - grep "$HASH4 is first bad commit" my_bisect_log.txt && - git bisect reset' - -# -# -test_done - -- cgit v1.2.3 From b9849a1ab63143c3b70e339491a897ef62a4173b Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 16 Apr 2007 00:42:29 -0700 Subject: Make sure quickfetch is not fooled with a previous, incomplete fetch. This updates git-rev-list --objects to be a bit more careful when listing a blob object to make sure the blob actually exists, and uses it to make sure the quick-fetch optimization we introduced earlier is not fooled by a previous incomplete fetch. The quick-fetch optimization works by running this command: git rev-list --objects <> --not --all where <> is a list of commits that we are going to fetch from the other side. If there is any object missing to complete the <>, the rev-list would fail and die (say, the commit was in our repository, but its tree wasn't -- then it will barf while trying to list the blobs the tree contains because it cannot read that tree). Usually we do not have the objects (otherwise why would we fetching?), but in one important special case we do: when the remote repository is used as an alternate object store (i.e. pointed by .git/objects/info/alternates). We could check .git/objects/info/alternates to see if the remote we are interacting with is one of them (or is used as an alternate, recursively, by one of them), but that check is more cumbersome than it is worth. The above check however did not catch missing blob, because object listing code did not read nor check blob objects, knowing that blobs do not contain any further references to other objects. This commit fixes it with practically unmeasurable overhead. I've benched this with git rev-list --objects --all >/dev/null in the kernel repository, with three different implementations of the "check-blob". - Checking with has_sha1_file() has negligible (unmeasurable) performance penalty. - Checking with sha1_object_info() makes it somewhat slower, perhaps by 5%. - Checking with read_sha1_file() to cause a fully re-validation is prohibitively expensive (about 4 times as much runtime). In my original patch, I had this as a command line option, but the overhead is small enough that it is not really worth it. Signed-off-by: Junio C Hamano --- t/t5502-quickfetch.sh | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100755 t/t5502-quickfetch.sh (limited to 't') diff --git a/t/t5502-quickfetch.sh b/t/t5502-quickfetch.sh new file mode 100755 index 0000000000..b4760f2dc0 --- /dev/null +++ b/t/t5502-quickfetch.sh @@ -0,0 +1,89 @@ +#!/bin/sh + +test_description='test quickfetch from local' + +. ./test-lib.sh + +test_expect_success setup ' + + test_tick && + echo ichi >file && + git add file && + git commit -m initial && + + cnt=$( ( + git count-objects | sed -e "s/ *objects,.*//" + ) ) && + test $cnt -eq 3 +' + +test_expect_success 'clone without alternate' ' + + ( + mkdir cloned && + cd cloned && + git init-db && + git remote add -f origin .. + ) && + cnt=$( ( + cd cloned && + git count-objects | sed -e "s/ *objects,.*//" + ) ) && + test $cnt -eq 3 +' + +test_expect_success 'further commits in the original' ' + + test_tick && + echo ni >file && + git commit -a -m second && + + cnt=$( ( + git count-objects | sed -e "s/ *objects,.*//" + ) ) && + test $cnt -eq 6 +' + +test_expect_success 'copy commit and tree but not blob by hand' ' + + git rev-list --objects HEAD | + git pack-objects --stdout | + ( + cd cloned && + git unpack-objects + ) && + + cnt=$( ( + cd cloned && + git count-objects | sed -e "s/ *objects,.*//" + ) ) && + test $cnt -eq 6 + + blob=$(git rev-parse HEAD:file | sed -e "s|..|&/|") && + test -f "cloned/.git/objects/$blob" && + rm -f "cloned/.git/objects/$blob" && + + cnt=$( ( + cd cloned && + git count-objects | sed -e "s/ *objects,.*//" + ) ) && + test $cnt -eq 5 + +' + +test_expect_success 'quickfetch should not leave a corrupted repository' ' + + ( + cd cloned && + git fetch + ) && + + cnt=$( ( + cd cloned && + git count-objects | sed -e "s/ *objects,.*//" + ) ) && + test $cnt -eq 6 + +' + +test_done -- cgit v1.2.3 From bb1faf0d5bc53b193bbe25e7425458c8eb85efa3 Mon Sep 17 00:00:00 2001 From: Steven Grimm Date: Mon, 16 Apr 2007 00:53:24 -0700 Subject: Add --ignore-unmatch option to exit with zero status when no files are removed. Signed-off-by: Steven Grimm Signed-off-by: Junio C Hamano --- t/t3600-rm.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 't') diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index da9da92180..0a97b75288 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -84,6 +84,10 @@ test_expect_success \ 'When the rm in "git-rm -f" fails, it should not remove the file from the index' \ 'git-ls-files --error-unmatch baz' +test_expect_success 'Remove nonexistent file with --ignore-unmatch' ' + git rm --ignore-unmatch nonexistent +' + test_expect_success '"rm" command printed' ' echo frotz > test-file && git add test-file && -- cgit v1.2.3 From 47579efc009c6f7afaf31be107eb92395a4f10db Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 17 Apr 2007 00:05:00 -0700 Subject: Add a demonstration/test of customized merge. This demonstrates how the new low-level per-path merge backends, union and ours, work, and shows how they are controlled by the gitattribute mechanism. Signed-off-by: Junio C Hamano --- t/t6026-merge-attr.sh | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 t/t6026-merge-attr.sh (limited to 't') diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh new file mode 100755 index 0000000000..5daa2236de --- /dev/null +++ b/t/t6026-merge-attr.sh @@ -0,0 +1,72 @@ +#!/bin/sh +# +# Copyright (c) 2007 Junio C Hamano +# + +test_description='per path merge controlled by merge attribute' + +. ./test-lib.sh + +test_expect_success setup ' + + for f in text binary union + do + echo Initial >$f && git add $f || break + done && + test_tick && + git commit -m Initial && + + git branch side && + for f in text binary union + do + echo Master >>$f && git add $f || break + done && + test_tick && + git commit -m Master && + + git checkout side && + for f in text binary union + do + echo Side >>$f && git add $f || break + done && + test_tick && + git commit -m Side + +' + +test_expect_success merge ' + + { + echo "binary -merge" + echo "union merge=union" + } >.gitattributes && + + if git merge master + then + echo Gaah, should have conflicted + false + else + echo Ok, conflicted. + fi +' + +test_expect_success 'check merge result in index' ' + + git ls-files -u | grep binary && + git ls-files -u | grep text && + ! (git ls-files -u | grep union) + +' + +test_expect_success 'check merge result in working tree' ' + + git cat-file -p HEAD:binary >binary-orig && + grep "<<<<<<<" text && + cmp binary-orig binary && + ! grep "<<<<<<<" union && + grep Master union && + grep Side union + +' + +test_done -- cgit v1.2.3 From f3ef6b6bbe9bfd3d09130f7e26b87dbe11b93c5b Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 17 Apr 2007 22:51:45 -0700 Subject: Custom low-level merge driver support. This allows users to specify custom low-level merge driver per path, using the attributes mechanism. Just like you can specify one of built-in "text", "binary", "union" low-level merge drivers by saying: * merge=text .gitignore merge=union *.jpg merge=binary pick a name of your favorite merge driver, and assign it as the value of the 'merge' attribute. A custom low-level merge driver is defined via the config mechanism. This patch introduces 'merge.driver', a multi-valued configuration. Its value is the name (i.e. the one you use as the value of 'merge' attribute) followed by a command line specification. The command line can contain %O, %A, and %B to be interpolated with the names of temporary files that hold the common ancestor version, the version from your branch, and the version from the other branch, and the resulting command is spawned. The low-level merge driver is expected to update the temporary file for your branch (i.e. %A) with the result and exit with status 0 for a clean merge, and non-zero status for a conflicted merge. A new test in t6026 demonstrates a sample usage. Signed-off-by: Junio C Hamano --- t/t6026-merge-attr.sh | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh index 5daa2236de..1732b60ed8 100755 --- a/t/t6026-merge-attr.sh +++ b/t/t6026-merge-attr.sh @@ -30,8 +30,9 @@ test_expect_success setup ' echo Side >>$f && git add $f || break done && test_tick && - git commit -m Side + git commit -m Side && + git tag anchor ' test_expect_success merge ' @@ -69,4 +70,72 @@ test_expect_success 'check merge result in working tree' ' ' +cat >./custom-merge <<\EOF +#!/bin/sh + +orig="$1" ours="$2" theirs="$3" exit="$4" +( + echo "orig is $orig" + echo "ours is $ours" + echo "theirs is $theirs" + echo "=== orig ===" + cat "$orig" + echo "=== ours ===" + cat "$ours" + echo "=== theirs ===" + cat "$theirs" +) >"$ours+" +cat "$ours+" >"$ours" +rm -f "$ours+" +exit "$exit" +EOF +chmod +x ./custom-merge + +test_expect_success 'custom merge backend' ' + + echo "* merge=union" >.gitattributes && + echo "text merge=custom" >>.gitattributes && + + git reset --hard anchor && + git config --replace-all \ + merge.driver "custom ./custom-merge %O %A %B 0" && + + git merge master && + + cmp binary union && + sed -e 1,3d text >check-1 && + o=$(git-unpack-file master^:text) && + a=$(git-unpack-file side^:text) && + b=$(git-unpack-file master:text) && + sh -c "./custom-merge $o $a $b 0" && + sed -e 1,3d $a >check-2 && + cmp check-1 check-2 && + rm -f $o $a $b +' + +test_expect_success 'custom merge backend' ' + + git reset --hard anchor && + git config --replace-all \ + merge.driver "custom ./custom-merge %O %A %B 1" && + + if git merge master + then + echo "Eh? should have conflicted" + false + else + echo "Ok, conflicted" + fi && + + cmp binary union && + sed -e 1,3d text >check-1 && + o=$(git-unpack-file master^:text) && + a=$(git-unpack-file anchor:text) && + b=$(git-unpack-file master:text) && + sh -c "./custom-merge $o $a $b 0" && + sed -e 1,3d $a >check-2 && + cmp check-1 check-2 && + rm -f $o $a $b +' + test_done -- cgit v1.2.3 From 153920da5b62024c0aceef23252b82ad18e5fe22 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 18 Apr 2007 11:27:32 -0700 Subject: Custom low-level merge driver: change the configuration scheme. This changes the configuration syntax for defining a low-level merge driver to be: [merge "<>"] driver = "<>" name = "<>" which is much nicer to read and is extensible. Credit goes to Martin Waitz and Linus. In addition, when we use an external low-level merge driver, it is reported as an extra output from merge-recursive, using the value of merge.<.name variable. The demonstration in t6026 has also been updated. Signed-off-by: Junio C Hamano --- t/t6026-merge-attr.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t6026-merge-attr.sh b/t/t6026-merge-attr.sh index 1732b60ed8..56fc341768 100755 --- a/t/t6026-merge-attr.sh +++ b/t/t6026-merge-attr.sh @@ -98,7 +98,9 @@ test_expect_success 'custom merge backend' ' git reset --hard anchor && git config --replace-all \ - merge.driver "custom ./custom-merge %O %A %B 0" && + merge.custom.driver "./custom-merge %O %A %B 0" && + git config --replace-all \ + merge.custom.name "custom merge driver for testing" && git merge master && @@ -117,7 +119,9 @@ test_expect_success 'custom merge backend' ' git reset --hard anchor && git config --replace-all \ - merge.driver "custom ./custom-merge %O %A %B 1" && + merge.custom.driver "./custom-merge %O %A %B 1" && + git config --replace-all \ + merge.custom.name "custom merge driver for testing" && if git merge master then -- cgit v1.2.3 From 0afa7644f2f3543a033d327468ab97d7581f9d13 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Wed, 18 Apr 2007 23:58:56 +0200 Subject: Fix overwriting of files when applying contextually independent diffs Noticed by applying two diffs of different contexts to the same file. The check for existence of a file was wrong: the test assumed it was a directory and reset the errno (twice: directly and by calling lstat). So if an entry existed and was _not_ a directory no attempt was made to rename into it, because the errno (expected by renaming code) was already reset to 0. This resulted in error: fatal: unable to write file file mode 100644 For Linux, removing "errno = 0" is enough, as lstat wont modify errno if it was successful. The behavior should not be depended upon, though, so modify the "if" as well. The test simulates this situation. Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- t/t4121-apply-diffs.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 t/t4121-apply-diffs.sh (limited to 't') diff --git a/t/t4121-apply-diffs.sh b/t/t4121-apply-diffs.sh new file mode 100755 index 0000000000..2b2f1eda21 --- /dev/null +++ b/t/t4121-apply-diffs.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +test_description='git-apply for contextually independent diffs' +. ./test-lib.sh + +echo '1 +2 +3 +4 +5 +6 +7 +8' >file + +test_expect_success 'setup' \ + 'git add file && + git commit -q -m 1 && + git checkout -b test && + mv file file.tmp && + echo 0 >file && + cat file.tmp >>file && + rm file.tmp && + git commit -a -q -m 2 && + echo 9 >>file && + git commit -a -q -m 3 && + git checkout master' + +test_expect_success \ + 'check if contextually independent diffs for the same file apply' \ + '( git diff test~2 test~1; git diff test~1 test~0 )| git apply' + +test_done + -- cgit v1.2.3 From 1c3e5c4ebc326c5c70350d3f4dc7f2b29e813480 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Thu, 19 Apr 2007 01:55:45 +0200 Subject: Tests for core subproject support The following tests available: - create subprojects: create a directory in the superproject, initialize a git repo in it, and try adding it in super project. Make a commit in superproject - check if fsck ignores the subprojects: it just should give no errors - check if commit in a subproject detected: make a commit in subproject, git-diff-files in superproject should detect it - check if a changed subproject HEAD can be committed: try "git-commit -a" in superproject. It should commit changed HEAD of a subproject - check if diff-index works for subproject elements: compare the index (changed by previuos tests) with the initial commit (which created two subprojects). Should show a change for the recently changed subproject - check if diff-tree works for subproject elements: do the same, just use git-diff-tree. This test is somewhat redundant, I just added it for completeness (diff, diff-files, and diff-index are already used) - check if git diff works for subproject elements: try to limit the diff for the name of a subproject in superproject: git diff HEAD^ HEAD -- subproject - check if clone works: try a clone of superproject and compare "git ls-files -s" output in superproject and cloned repo - removing and adding subproject: rename test. Currently implemented as "git-update-index --force-remove", "mv" and "git-add". - checkout in superproject: try to checkout the initial commit Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- t/t3040-subprojects-basic.sh | 85 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100755 t/t3040-subprojects-basic.sh (limited to 't') diff --git a/t/t3040-subprojects-basic.sh b/t/t3040-subprojects-basic.sh new file mode 100755 index 0000000000..79b9f23654 --- /dev/null +++ b/t/t3040-subprojects-basic.sh @@ -0,0 +1,85 @@ +#!/bin/sh + +test_description='Basic subproject functionality' +. ./test-lib.sh + +test_expect_success 'Super project creation' \ + ': >Makefile && + git add Makefile && + git commit -m "Superproject created"' + + +cat >expected <Makefile && git add * && + git commit -q -m "subproject 1" ) && + mkdir sub2 && + ( cd sub2 && git init && : >Makefile && git add * && + git commit -q -m "subproject 2" ) && + git update-index --add sub1 && + git add sub2 && + git commit -q -m "subprojects added" && + git diff-tree --abbrev=5 HEAD^ HEAD |cut -d" " -f-3,5- >current && + git diff expected current' + +git branch save HEAD + +test_expect_success 'check if fsck ignores the subprojects' \ + 'git fsck --full' + +test_expect_success 'check if commit in a subproject detected' \ + '( cd sub1 && + echo "all:" >>Makefile && + echo " true" >>Makefile && + git commit -q -a -m "make all" ) && { + git diff-files --exit-code + test $? = 1 + }' + +test_expect_success 'check if a changed subproject HEAD can be committed' \ + 'git commit -q -a -m "sub1 changed" && { + git diff-tree --exit-code HEAD^ HEAD + test $? = 1 + }' + +test_expect_success 'check if diff-index works for subproject elements' \ + 'git diff-index --exit-code --cached save -- sub1 + test $? = 1' + +test_expect_success 'check if diff-tree works for subproject elements' \ + 'git diff-tree --exit-code HEAD^ HEAD -- sub1 + test $? = 1' + +test_expect_success 'check if git diff works for subproject elements' \ + 'git diff --exit-code HEAD^ HEAD + test $? = 1' + +test_expect_success 'check if clone works' \ + 'git ls-files -s >expected && + git clone -l -s . cloned && + ( cd cloned && git ls-files -s ) >current && + git diff expected current' + +test_expect_success 'removing and adding subproject' \ + 'git update-index --force-remove -- sub2 && + mv sub2 sub3 && + git add sub3 && + git commit -q -m "renaming a subproject" && { + git diff -M --name-status --exit-code HEAD^ HEAD + test $? = 1 + }' + +# the index must contain the object name the HEAD of the +# subproject sub1 was at the point "save" +test_expect_success 'checkout in superproject' \ + 'git checkout save && + git diff-index --exit-code --raw --cached save -- sub1' + +# just interesting what happened... +# git diff --name-status -M save master + +test_done -- cgit v1.2.3 From 163b95919428cd7d782af91296e0b886683f2daa Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 19 Apr 2007 22:37:19 -0700 Subject: Update 'crlf' attribute semantics. This updates the semantics of 'crlf' so that .gitattributes file can say "this is text, even though it may look funny". Setting the `crlf` attribute on a path is meant to mark the path as a "text" file. 'core.autocrlf' conversion takes place without guessing the content type by inspection. Unsetting the `crlf` attribute on a path is meant to mark the path as a "binary" file. The path never goes through line endings conversion upon checkin/checkout. Unspecified `crlf` attribute tells git to apply the `core.autocrlf` conversion when the file content looks like text. Setting the `crlf` attribut to string value "input" is similar to setting the attribute to `true`, but also forces git to act as if `core.autocrlf` is set to `input` for the path. Signed-off-by: Junio C Hamano --- t/t0020-crlf.sh | 74 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 63 insertions(+), 11 deletions(-) (limited to 't') diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh index cf84f0a1ab..fe1dfd08a0 100755 --- a/t/t0020-crlf.sh +++ b/t/t0020-crlf.sh @@ -4,6 +4,10 @@ test_description='CRLF conversion' . ./test-lib.sh +q_to_nul () { + tr Q '\0' +} + append_cr () { sed -e 's/$/Q/' | tr Q '\015' } @@ -20,6 +24,7 @@ test_expect_success setup ' for w in Hello world how are you; do echo $w; done >one && mkdir dir && for w in I am very very fine thank you; do echo $w; done >dir/two && + for w in Oh here is NULQin text here; do echo $w; done | q_to_nul >three && git add . && git commit -m initial && @@ -27,6 +32,7 @@ test_expect_success setup ' one=`git rev-parse HEAD:one` && dir=`git rev-parse HEAD:dir` && two=`git rev-parse HEAD:dir/two` && + three=`git rev-parse HEAD:three` && for w in Some extra lines here; do echo $w; done >>one && git diff >patch.file && @@ -38,7 +44,7 @@ test_expect_success setup ' test_expect_success 'update with autocrlf=input' ' - rm -f tmp one dir/two && + rm -f tmp one dir/two three && git read-tree --reset -u HEAD && git repo-config core.autocrlf input && @@ -62,7 +68,7 @@ test_expect_success 'update with autocrlf=input' ' test_expect_success 'update with autocrlf=true' ' - rm -f tmp one dir/two && + rm -f tmp one dir/two three && git read-tree --reset -u HEAD && git repo-config core.autocrlf true && @@ -86,7 +92,7 @@ test_expect_success 'update with autocrlf=true' ' test_expect_success 'checkout with autocrlf=true' ' - rm -f tmp one dir/two && + rm -f tmp one dir/two three && git repo-config core.autocrlf true && git read-tree --reset -u HEAD && @@ -110,7 +116,7 @@ test_expect_success 'checkout with autocrlf=true' ' test_expect_success 'checkout with autocrlf=input' ' - rm -f tmp one dir/two && + rm -f tmp one dir/two three && git repo-config core.autocrlf input && git read-tree --reset -u HEAD && @@ -136,7 +142,7 @@ test_expect_success 'checkout with autocrlf=input' ' test_expect_success 'apply patch (autocrlf=input)' ' - rm -f tmp one dir/two && + rm -f tmp one dir/two three && git repo-config core.autocrlf input && git read-tree --reset -u HEAD && @@ -149,7 +155,7 @@ test_expect_success 'apply patch (autocrlf=input)' ' test_expect_success 'apply patch --cached (autocrlf=input)' ' - rm -f tmp one dir/two && + rm -f tmp one dir/two three && git repo-config core.autocrlf input && git read-tree --reset -u HEAD && @@ -162,7 +168,7 @@ test_expect_success 'apply patch --cached (autocrlf=input)' ' test_expect_success 'apply patch --index (autocrlf=input)' ' - rm -f tmp one dir/two && + rm -f tmp one dir/two three && git repo-config core.autocrlf input && git read-tree --reset -u HEAD && @@ -176,7 +182,7 @@ test_expect_success 'apply patch --index (autocrlf=input)' ' test_expect_success 'apply patch (autocrlf=true)' ' - rm -f tmp one dir/two && + rm -f tmp one dir/two three && git repo-config core.autocrlf true && git read-tree --reset -u HEAD && @@ -189,7 +195,7 @@ test_expect_success 'apply patch (autocrlf=true)' ' test_expect_success 'apply patch --cached (autocrlf=true)' ' - rm -f tmp one dir/two && + rm -f tmp one dir/two three && git repo-config core.autocrlf true && git read-tree --reset -u HEAD && @@ -202,7 +208,7 @@ test_expect_success 'apply patch --cached (autocrlf=true)' ' test_expect_success 'apply patch --index (autocrlf=true)' ' - rm -f tmp one dir/two && + rm -f tmp one dir/two three && git repo-config core.autocrlf true && git read-tree --reset -u HEAD && @@ -216,8 +222,8 @@ test_expect_success 'apply patch --index (autocrlf=true)' ' test_expect_success '.gitattributes says two is binary' ' + rm -f tmp one dir/two three && echo "two -crlf" >.gitattributes && - rm -f tmp one dir/two && git repo-config core.autocrlf true && git read-tree --reset -u HEAD && @@ -230,6 +236,52 @@ test_expect_success '.gitattributes says two is binary' ' fi && if remove_cr one >/dev/null + then + : happy + else + echo "Huh?" + false + fi && + + if remove_cr three >/dev/null + then + echo "Huh?" + false + else + : happy + fi +' + +test_expect_success '.gitattributes says two is input' ' + + rm -f tmp one dir/two three && + echo "two crlf=input" >.gitattributes && + git read-tree --reset -u HEAD && + + if remove_cr dir/two >/dev/null + then + echo "Huh?" + false + else + : happy + fi +' + +test_expect_success '.gitattributes says two and three are text' ' + + rm -f tmp one dir/two three && + echo "t* crlf" >.gitattributes && + git read-tree --reset -u HEAD && + + if remove_cr dir/two >/dev/null + then + : happy + else + echo "Huh?" + false + fi && + + if remove_cr three >/dev/null then : happy else -- cgit v1.2.3 From 744747ef1d75c85fb3a1785cb08d36497128d3d3 Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Thu, 19 Apr 2007 00:51:06 -0400 Subject: Remove case-sensitive file in t3030-merge-recursive. Rename "A" to the unused "c" Signed-off-by: Brian Gernhardt Signed-off-by: Junio C Hamano --- t/t3030-merge-recursive.sh | 104 ++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 52 deletions(-) (limited to 't') diff --git a/t/t3030-merge-recursive.sh b/t/t3030-merge-recursive.sh index aef92b9b92..86ee2b0bd3 100755 --- a/t/t3030-merge-recursive.sh +++ b/t/t3030-merge-recursive.sh @@ -9,12 +9,12 @@ test_expect_success 'setup 1' ' echo hello >a && o0=$(git hash-object a) && cp a b && - cp a A && + cp a c && mkdir d && cp a d/e && test_tick && - git add a b A d/e && + git add a b c d/e && git commit -m initial && c0=$(git rev-parse --verify HEAD) && git branch side && @@ -34,13 +34,13 @@ test_expect_success 'setup 1' ' c1=$(git rev-parse --verify HEAD) && ( git ls-tree -r HEAD ; git ls-files -s ) >actual && ( - echo "100644 blob $o0 A" echo "100644 blob $o1 a" echo "100644 blob $o0 b" + echo "100644 blob $o0 c" echo "100644 blob $o1 d/e" - echo "100644 $o0 0 A" echo "100644 $o1 0 a" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o1 0 d/e" ) >expected && git diff -u expected actual @@ -48,17 +48,17 @@ test_expect_success 'setup 1' ' test_expect_success 'setup 2' ' - rm -rf [Aabd] && + rm -rf [abcd] && git checkout side && ( git ls-tree -r HEAD ; git ls-files -s ) >actual && ( - echo "100644 blob $o0 A" echo "100644 blob $o0 a" echo "100644 blob $o0 b" + echo "100644 blob $o0 c" echo "100644 blob $o0 d/e" - echo "100644 $o0 0 A" echo "100644 $o0 0 a" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o0 0 d/e" ) >expected && git diff -u expected actual && @@ -73,13 +73,13 @@ test_expect_success 'setup 2' ' c2=$(git rev-parse --verify HEAD) && ( git ls-tree -r HEAD ; git ls-files -s ) >actual && ( - echo "100644 blob $o0 A" echo "100644 blob $o2 a" echo "100644 blob $o0 b" + echo "100644 blob $o0 c" echo "100644 blob $o0 d/e" - echo "100644 $o0 0 A" echo "100644 $o2 0 a" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o0 0 d/e" ) >expected && git diff -u expected actual @@ -87,17 +87,17 @@ test_expect_success 'setup 2' ' test_expect_success 'setup 3' ' - rm -rf [Aabd] && + rm -rf [abcd] && git checkout df-1 && ( git ls-tree -r HEAD ; git ls-files -s ) >actual && ( - echo "100644 blob $o0 A" echo "100644 blob $o0 a" echo "100644 blob $o0 b" + echo "100644 blob $o0 c" echo "100644 blob $o0 d/e" - echo "100644 $o0 0 A" echo "100644 $o0 0 a" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o0 0 d/e" ) >expected && git diff -u expected actual && @@ -110,13 +110,13 @@ test_expect_success 'setup 3' ' c3=$(git rev-parse --verify HEAD) && ( git ls-tree -r HEAD ; git ls-files -s ) >actual && ( - echo "100644 blob $o0 A" echo "100644 blob $o0 a" echo "100644 blob $o3 b/c" + echo "100644 blob $o0 c" echo "100644 blob $o0 d/e" - echo "100644 $o0 0 A" echo "100644 $o0 0 a" echo "100644 $o3 0 b/c" + echo "100644 $o0 0 c" echo "100644 $o0 0 d/e" ) >expected && git diff -u expected actual @@ -124,17 +124,17 @@ test_expect_success 'setup 3' ' test_expect_success 'setup 4' ' - rm -rf [Aabd] && + rm -rf [abcd] && git checkout df-2 && ( git ls-tree -r HEAD ; git ls-files -s ) >actual && ( - echo "100644 blob $o0 A" echo "100644 blob $o0 a" echo "100644 blob $o0 b" + echo "100644 blob $o0 c" echo "100644 blob $o0 d/e" - echo "100644 $o0 0 A" echo "100644 $o0 0 a" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o0 0 d/e" ) >expected && git diff -u expected actual && @@ -147,13 +147,13 @@ test_expect_success 'setup 4' ' c4=$(git rev-parse --verify HEAD) && ( git ls-tree -r HEAD ; git ls-files -s ) >actual && ( - echo "100644 blob $o0 A" echo "100644 blob $o4 a/c" echo "100644 blob $o0 b" + echo "100644 blob $o0 c" echo "100644 blob $o0 d/e" - echo "100644 $o0 0 A" echo "100644 $o4 0 a/c" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o0 0 d/e" ) >expected && git diff -u expected actual @@ -161,17 +161,17 @@ test_expect_success 'setup 4' ' test_expect_success 'setup 5' ' - rm -rf [Aabd] && + rm -rf [abcd] && git checkout remove && ( git ls-tree -r HEAD ; git ls-files -s ) >actual && ( - echo "100644 blob $o0 A" echo "100644 blob $o0 a" echo "100644 blob $o0 b" + echo "100644 blob $o0 c" echo "100644 blob $o0 d/e" - echo "100644 $o0 0 A" echo "100644 $o0 0 a" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o0 0 d/e" ) >expected && git diff -u expected actual && @@ -188,11 +188,11 @@ test_expect_success 'setup 5' ' c5=$(git rev-parse --verify HEAD) && ( git ls-tree -r HEAD ; git ls-files -s ) >actual && ( - echo "100644 blob $o0 A" echo "100644 blob $o5 a" + echo "100644 blob $o0 c" echo "100644 blob $o0 d/e" - echo "100644 $o0 0 A" echo "100644 $o5 0 a" + echo "100644 $o0 0 c" echo "100644 $o0 0 d/e" ) >expected && git diff -u expected actual @@ -201,17 +201,17 @@ test_expect_success 'setup 5' ' test_expect_success 'setup 6' ' - rm -rf [Aabd] && + rm -rf [abcd] && git checkout df-3 && ( git ls-tree -r HEAD ; git ls-files -s ) >actual && ( - echo "100644 blob $o0 A" echo "100644 blob $o0 a" echo "100644 blob $o0 b" + echo "100644 blob $o0 c" echo "100644 blob $o0 d/e" - echo "100644 $o0 0 A" echo "100644 $o0 0 a" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o0 0 d/e" ) >expected && git diff -u expected actual && @@ -224,13 +224,13 @@ test_expect_success 'setup 6' ' c6=$(git rev-parse --verify HEAD) && ( git ls-tree -r HEAD ; git ls-files -s ) >actual && ( - echo "100644 blob $o0 A" echo "100644 blob $o0 a" echo "100644 blob $o0 b" + echo "100644 blob $o0 c" echo "100644 blob $o6 d" - echo "100644 $o0 0 A" echo "100644 $o0 0 a" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o6 0 d" ) >expected && git diff -u expected actual @@ -238,7 +238,7 @@ test_expect_success 'setup 6' ' test_expect_success 'merge-recursive simple' ' - rm -fr [Aabd] && + rm -fr [abcd] && git checkout -f "$c2" && git-merge-recursive "$c0" -- "$c2" "$c1" @@ -258,11 +258,11 @@ test_expect_success 'merge-recursive result' ' git ls-files -s >actual && ( - echo "100644 $o0 0 A" echo "100644 $o0 1 a" echo "100644 $o2 2 a" echo "100644 $o1 3 a" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o1 0 d/e" ) >expected && git diff -u expected actual @@ -271,7 +271,7 @@ test_expect_success 'merge-recursive result' ' test_expect_success 'merge-recursive remove conflict' ' - rm -fr [Aabd] && + rm -fr [abcd] && git checkout -f "$c1" && git-merge-recursive "$c0" -- "$c1" "$c5" @@ -291,10 +291,10 @@ test_expect_success 'merge-recursive remove conflict' ' git ls-files -s >actual && ( - echo "100644 $o0 0 A" echo "100644 $o0 1 a" echo "100644 $o1 2 a" echo "100644 $o5 3 a" + echo "100644 $o0 0 c" echo "100644 $o1 0 d/e" ) >expected && git diff -u expected actual @@ -302,7 +302,7 @@ test_expect_success 'merge-recursive remove conflict' ' ' test_expect_success 'merge-recursive d/f simple' ' - rm -fr [Aabd] && + rm -fr [abcd] && git reset --hard && git checkout -f "$c1" && @@ -313,9 +313,9 @@ test_expect_success 'merge-recursive result' ' git ls-files -s >actual && ( - echo "100644 $o0 0 A" echo "100644 $o1 0 a" echo "100644 $o3 0 b/c" + echo "100644 $o0 0 c" echo "100644 $o1 0 d/e" ) >expected && git diff -u expected actual @@ -324,7 +324,7 @@ test_expect_success 'merge-recursive result' ' test_expect_success 'merge-recursive d/f conflict' ' - rm -fr [Aabd] && + rm -fr [abcd] && git reset --hard && git checkout -f "$c1" && @@ -345,11 +345,11 @@ test_expect_success 'merge-recursive d/f conflict result' ' git ls-files -s >actual && ( - echo "100644 $o0 0 A" echo "100644 $o0 1 a" echo "100644 $o1 2 a" echo "100644 $o4 0 a/c" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o1 0 d/e" ) >expected && git diff -u expected actual @@ -358,7 +358,7 @@ test_expect_success 'merge-recursive d/f conflict result' ' test_expect_success 'merge-recursive d/f conflict the other way' ' - rm -fr [Aabd] && + rm -fr [abcd] && git reset --hard && git checkout -f "$c4" && @@ -379,11 +379,11 @@ test_expect_success 'merge-recursive d/f conflict result the other way' ' git ls-files -s >actual && ( - echo "100644 $o0 0 A" echo "100644 $o0 1 a" echo "100644 $o1 3 a" echo "100644 $o4 0 a/c" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o1 0 d/e" ) >expected && git diff -u expected actual @@ -392,7 +392,7 @@ test_expect_success 'merge-recursive d/f conflict result the other way' ' test_expect_success 'merge-recursive d/f conflict' ' - rm -fr [Aabd] && + rm -fr [abcd] && git reset --hard && git checkout -f "$c1" && @@ -413,9 +413,9 @@ test_expect_success 'merge-recursive d/f conflict result' ' git ls-files -s >actual && ( - echo "100644 $o0 0 A" echo "100644 $o1 0 a" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o6 3 d" echo "100644 $o0 1 d/e" echo "100644 $o1 2 d/e" @@ -426,7 +426,7 @@ test_expect_success 'merge-recursive d/f conflict result' ' test_expect_success 'merge-recursive d/f conflict' ' - rm -fr [Aabd] && + rm -fr [abcd] && git reset --hard && git checkout -f "$c6" && @@ -447,9 +447,9 @@ test_expect_success 'merge-recursive d/f conflict result' ' git ls-files -s >actual && ( - echo "100644 $o0 0 A" echo "100644 $o1 0 a" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o6 2 d" echo "100644 $o0 1 d/e" echo "100644 $o1 3 d/e" @@ -471,13 +471,13 @@ test_expect_success 'reset and bind merge' ' git read-tree --prefix=M/ master && git ls-files -s >actual && ( - echo "100644 $o0 0 A" - echo "100644 $o0 0 M/A" echo "100644 $o1 0 M/a" echo "100644 $o0 0 M/b" + echo "100644 $o0 0 M/c" echo "100644 $o1 0 M/d/e" echo "100644 $o1 0 a" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o1 0 d/e" ) >expected && git diff -u expected actual && @@ -485,17 +485,17 @@ test_expect_success 'reset and bind merge' ' git read-tree --prefix=a1/ master && git ls-files -s >actual && ( - echo "100644 $o0 0 A" - echo "100644 $o0 0 M/A" echo "100644 $o1 0 M/a" echo "100644 $o0 0 M/b" + echo "100644 $o0 0 M/c" echo "100644 $o1 0 M/d/e" echo "100644 $o1 0 a" - echo "100644 $o0 0 a1/A" echo "100644 $o1 0 a1/a" echo "100644 $o0 0 a1/b" + echo "100644 $o0 0 a1/c" echo "100644 $o1 0 a1/d/e" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o1 0 d/e" ) >expected && git diff -u expected actual @@ -503,21 +503,21 @@ test_expect_success 'reset and bind merge' ' git read-tree --prefix=z/ master && git ls-files -s >actual && ( - echo "100644 $o0 0 A" - echo "100644 $o0 0 M/A" echo "100644 $o1 0 M/a" echo "100644 $o0 0 M/b" + echo "100644 $o0 0 M/c" echo "100644 $o1 0 M/d/e" echo "100644 $o1 0 a" - echo "100644 $o0 0 a1/A" echo "100644 $o1 0 a1/a" echo "100644 $o0 0 a1/b" + echo "100644 $o0 0 a1/c" echo "100644 $o1 0 a1/d/e" echo "100644 $o0 0 b" + echo "100644 $o0 0 c" echo "100644 $o1 0 d/e" - echo "100644 $o0 0 z/A" echo "100644 $o1 0 z/a" echo "100644 $o0 0 z/b" + echo "100644 $o0 0 z/c" echo "100644 $o1 0 z/d/e" ) >expected && git diff -u expected actual -- cgit v1.2.3 From a5878961b14c1b4f6d1d08c0d3a2f5234659fb8a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 22 Apr 2007 18:59:34 -0700 Subject: Update tests not to assume that generated packfiles are writable. Signed-off-by: Junio C Hamano --- t/t5300-pack-object.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 't') diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index 083095f7f3..f336769836 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -152,7 +152,7 @@ test_expect_success \ 'use packed deltified (REF_DELTA) objects' \ 'GIT_OBJECT_DIRECTORY=.git2/objects && export GIT_OBJECT_DIRECTORY && - rm .git2/objects/pack/test-* && + rm -f .git2/objects/pack/test-* && cp test-2-${packname_2}.pack test-2-${packname_2}.idx .git2/objects/pack && { git-diff-tree --root -p $commit && while read object @@ -167,7 +167,7 @@ test_expect_success \ 'use packed deltified (OFS_DELTA) objects' \ 'GIT_OBJECT_DIRECTORY=.git2/objects && export GIT_OBJECT_DIRECTORY && - rm .git2/objects/pack/test-* && + rm -f .git2/objects/pack/test-* && cp test-3-${packname_3}.pack test-3-${packname_3}.idx .git2/objects/pack && { git-diff-tree --root -p $commit && while read object @@ -188,15 +188,15 @@ test_expect_success \ test_expect_success \ 'corrupt a pack and see if verify catches' \ - 'cp test-1-${packname_1}.idx test-3.idx && - cp test-2-${packname_2}.pack test-3.pack && + 'cat test-1-${packname_1}.idx >test-3.idx && + cat test-2-${packname_2}.pack >test-3.pack && if git-verify-pack test-3.idx then false else :; fi && : PACK_SIGNATURE && - cp test-1-${packname_1}.pack test-3.pack && + cat test-1-${packname_1}.pack >test-3.pack && dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=2 && if git-verify-pack test-3.idx then false @@ -204,7 +204,7 @@ test_expect_success \ fi && : PACK_VERSION && - cp test-1-${packname_1}.pack test-3.pack && + cat test-1-${packname_1}.pack >test-3.pack && dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=7 && if git-verify-pack test-3.idx then false @@ -212,7 +212,7 @@ test_expect_success \ fi && : TYPE/SIZE byte of the first packed object data && - cp test-1-${packname_1}.pack test-3.pack && + cat test-1-${packname_1}.pack >test-3.pack && dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=12 && if git-verify-pack test-3.idx then false @@ -222,7 +222,7 @@ test_expect_success \ : sum of the index file itself && l=`wc -c test-3.pack && dd if=/dev/zero of=test-3.idx count=20 bs=1 conv=notrunc seek=$l && if git-verify-pack test-3.pack then false @@ -233,21 +233,21 @@ test_expect_success \ test_expect_success \ 'build pack index for an existing pack' \ - 'cp test-1-${packname_1}.pack test-3.pack && + 'cat test-1-${packname_1}.pack >test-3.pack && git-index-pack -o tmp.idx test-3.pack && cmp tmp.idx test-1-${packname_1}.idx && git-index-pack test-3.pack && cmp test-3.idx test-1-${packname_1}.idx && - cp test-2-${packname_2}.pack test-3.pack && + cat test-2-${packname_2}.pack >test-3.pack && git-index-pack -o tmp.idx test-2-${packname_2}.pack && cmp tmp.idx test-2-${packname_2}.idx && git-index-pack test-3.pack && cmp test-3.idx test-2-${packname_2}.idx && - cp test-3-${packname_3}.pack test-3.pack && + cat test-3-${packname_3}.pack >test-3.pack && git-index-pack -o tmp.idx test-3-${packname_3}.pack && cmp tmp.idx test-3-${packname_3}.idx && -- cgit v1.2.3 From f1af60bdba465779df92090ed370988f202ff043 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 22 Apr 2007 17:52:55 -0700 Subject: Support 'diff=pgm' attribute This enhances the attributes mechanism so that external programs meant for existing GIT_EXTERNAL_DIFF interface can be specifed per path. To configure such a custom diff driver, first define a custom diff driver in the configuration: [diff "my-c-diff"] command = <> Then mark the paths that you want to use this custom driver using the attribute mechanism. *.c diff=my-c-diff The intent of this separation is that the attribute mechanism is used for specifying the type of the contents, while the configuration mechanism is used to define what needs to be done to that type of the contents, which would be specific to both platform and personal taste. Signed-off-by: Junio C Hamano --- t/t4020-diff-external.sh | 97 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100755 t/t4020-diff-external.sh (limited to 't') diff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh new file mode 100755 index 0000000000..f0045cd788 --- /dev/null +++ b/t/t4020-diff-external.sh @@ -0,0 +1,97 @@ +#!/bin/sh + +test_description='external diff interface test' + +. ./test-lib.sh + +_z40=0000000000000000000000000000000000000000 + +test_expect_success setup ' + + test_tick && + echo initial >file && + git add file && + git commit -m initial && + + test_tick && + echo second >file && + git add file && + git commit -m second && + + test_tick && + echo third >file +' + +test_expect_success 'GIT_EXTERNAL_DIFF environment' ' + + GIT_EXTERNAL_DIFF=echo git diff | { + read path oldfile oldhex oldmode newfile newhex newmode && + test "z$path" = zfile && + test "z$oldmode" = z100644 && + test "z$newhex" = "z$_z40" && + test "z$newmode" = z100644 && + oh=$(git rev-parse --verify HEAD:file) && + test "z$oh" = "z$oldhex" + } + +' + +test_expect_success 'GIT_EXTERNAL_DIFF environment should apply only to diff' ' + + GIT_EXTERNAL_DIFF=echo git log -p -1 HEAD | + grep "^diff --git a/file b/file" + +' + +test_expect_success 'diff attribute' ' + + git config diff.parrot.command echo && + + echo >.gitattributes "file diff=parrot" && + + git diff | { + read path oldfile oldhex oldmode newfile newhex newmode && + test "z$path" = zfile && + test "z$oldmode" = z100644 && + test "z$newhex" = "z$_z40" && + test "z$newmode" = z100644 && + oh=$(git rev-parse --verify HEAD:file) && + test "z$oh" = "z$oldhex" + } + +' + +test_expect_success 'diff attribute should apply only to diff' ' + + git log -p -1 HEAD | + grep "^diff --git a/file b/file" + +' + +test_expect_success 'diff attribute' ' + + git config --unset diff.parrot.command && + git config diff.color.command echo && + + echo >.gitattributes "file diff=color" && + + git diff | { + read path oldfile oldhex oldmode newfile newhex newmode && + test "z$path" = zfile && + test "z$oldmode" = z100644 && + test "z$newhex" = "z$_z40" && + test "z$newmode" = z100644 && + oh=$(git rev-parse --verify HEAD:file) && + test "z$oh" = "z$oldhex" + } + +' + +test_expect_success 'diff attribute should apply only to diff' ' + + git log -p -1 HEAD | + grep "^diff --git a/file b/file" + +' + +test_done -- cgit v1.2.3 From c7f34c180b7117cf60ad12a8b180eed33716e390 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 23 Apr 2007 10:21:25 +0200 Subject: dir.c(common_prefix): Fix two bugs The function common_prefix() is used to find the common subdirectory of a couple of pathnames. When checking if the next pathname matches up with the prefix, it incorrectly checked the whole path, not just the prefix (including the slash). Thus, the expensive part of the loop was executed always. The other bug is more serious: if the first and the last pathname in the list have a longer common prefix than the common prefix for _all_ pathnames in the list, the longer one would be chosen. This bug was probably hidden by the fact that bash's wildcard expansion sorts the results, and the code just so happens to work with sorted input. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3700-add.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 't') diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 08e035220c..ad8cc7d4ae 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -104,4 +104,10 @@ test_expect_success 'add ignored ones with -f' ' git-ls-files --error-unmatch d.ig/d.if d.ig/d.ig ' +mkdir 1 1/2 1/3 +touch 1/2/a 1/3/b 1/2/c +test_expect_success 'check correct prefix detection' ' + git add 1/2/a 1/3/b 1/2/c +' + test_done -- cgit v1.2.3 From 557b1e0da595cfb61f9500bd8dd74a32f97616ff Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 23 Apr 2007 20:46:21 +0200 Subject: t4201: Do not display weird characters on the terminal Now that git-commit got chatty, we have to shut it up again. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t4201-shortlog.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 't') diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh index c27e39cb6f..a48733cee0 100755 --- a/t/t4201-shortlog.sh +++ b/t/t4201-shortlog.sh @@ -15,19 +15,19 @@ commit=$( (echo "Test"; echo) | git commit-tree $tree ) git update-ref HEAD $commit echo 2 > a1 -git commit -m "This is a very, very long first line for the commit message to see if it is wrapped correctly" a1 +git commit --quiet -m "This is a very, very long first line for the commit message to see if it is wrapped correctly" a1 # test if the wrapping is still valid when replacing all i's by treble clefs. echo 3 > a1 -git commit -m "$(echo "This is a very, very long first line for the commit message to see if it is wrapped correctly" | sed "s/i/1234/g" | tr 1234 '\360\235\204\236')" a1 +git commit --quiet -m "$(echo "This is a very, very long first line for the commit message to see if it is wrapped correctly" | sed "s/i/1234/g" | tr 1234 '\360\235\204\236')" a1 # now fsck up the utf8 git repo-config i18n.commitencoding non-utf-8 echo 4 > a1 -git commit -m "$(echo "This is a very, very long first line for the commit message to see if it is wrapped correctly" | sed "s/i/1234/g" | tr 1234 '\370\235\204\236')" a1 +git commit --quiet -m "$(echo "This is a very, very long first line for the commit message to see if it is wrapped correctly" | sed "s/i/1234/g" | tr 1234 '\370\235\204\236')" a1 echo 5 > a1 -git commit -m "a 12 34 56 78" a1 +git commit --quiet -m "a 12 34 56 78" a1 git shortlog -w HEAD > out -- cgit v1.2.3 From bd4b0aeb1f4db2d7552623f77b62b9a24f8cac9e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 23 Apr 2007 22:05:22 -0700 Subject: t5302: avoid using tail -c A Large Angry SCM (gitzilla) noticed that on an unnamed platform, tail -c wants its byte count as part of the option, not as a separate argument. Signed-off-by: Junio C Hamano --- t/t5302-pack-index.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh index 232e5f1964..6902fc6d48 100755 --- a/t/t5302-pack-index.sh +++ b/t/t5302-pack-index.sh @@ -16,7 +16,7 @@ test_expect_success \ test-genrandom "$i" 8192 >>file_$i && git-update-index --add file_$i || return 1 done && - echo 101 >file_101 && tail -c 8192 file_100 >>file_101 && + { echo 101 && test-genrandom 100 8192; } >file_101 && git-update-index --add file_101 && tree=`git-write-tree` && commit=`git-commit-tree $tree Date: Mon, 23 Apr 2007 22:10:47 -0700 Subject: t6030: grab commit object name as we go Instead of running rev-list and picking earlier lines using head/tail pipeline, grab commit object name as we build commits. This also removes a non POSIX use of tail with -linenum (more posixly-correct way to say it is "-n linenum") Signed-off-by: Junio C Hamano --- t/t6030-bisect-porcelain.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 't') diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 13e9379236..30f6ade13f 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -22,22 +22,25 @@ add_line_into_file() MSG="Create file <$_file> with <$_line> inside." fi - git-commit -m "$MSG" $_file + test_tick + git-commit --quiet -m "$MSG" $_file } HASH1= +HASH2= HASH3= HASH4= -test_expect_success \ - 'set up basic repo with 1 file (hello) and 4 commits' \ - 'add_line_into_file "1: Hello World" hello && +test_expect_success 'set up basic repo with 1 file (hello) and 4 commits' ' + add_line_into_file "1: Hello World" hello && + HASH1=$(git rev-parse --verify HEAD) && add_line_into_file "2: A new day for git" hello && + HASH2=$(git rev-parse --verify HEAD) && add_line_into_file "3: Another new day for git" hello && + HASH3=$(git rev-parse --verify HEAD) && add_line_into_file "4: Ciao for now" hello && - HASH1=$(git rev-list HEAD | tail -1) && - HASH3=$(git rev-list HEAD | head -2 | tail -1) && - HASH4=$(git rev-list HEAD | head -1)' + HASH4=$(git rev-parse --verify HEAD) +' test_expect_success 'bisect starts with only one bad' ' git bisect reset && -- cgit v1.2.3 From 886a39074be34d21afc6c1b8af1f7f4b3ef54dc5 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 24 Apr 2007 11:21:47 -0700 Subject: t/test-lib.sh: Protect ourselves from common misconfiguration that exports CDPATH to the environment Signed-off-by: Junio C Hamano --- t/test-lib.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 't') diff --git a/t/test-lib.sh b/t/test-lib.sh index c0754747fb..f2c6bd3b01 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -36,6 +36,10 @@ export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME export EDITOR VISUAL +# Protect ourselves from common misconfiguration to export +# CDPATH into the environment +unset CDPATH + case $(echo $GIT_TRACE |tr "[A-Z]" "[a-z]") in 1|2|true) echo "* warning: Some tests will not work if GIT_TRACE" \ -- cgit v1.2.3 From 3fed15f568c24ec00ef78fddc6cbb881fbbb0277 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 21 Apr 2007 19:09:02 -0700 Subject: Add 'ident' conversion. The 'ident' attribute set to path squashes "$ident:$" to "$ident$" upon checkin, and expands it to "$ident: $" upon checkout. As we have two conversions that affect checkin/checkout paths, clarify how they interact with each other. Signed-off-by: Junio C Hamano --- t/t0021-conversion.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 t/t0021-conversion.sh (limited to 't') diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh new file mode 100755 index 0000000000..ad952c9ce2 --- /dev/null +++ b/t/t0021-conversion.sh @@ -0,0 +1,39 @@ +#!/bin/sh + +test_description='blob conversion via gitattributes' + +. ./test-lib.sh + +test_expect_success setup ' + { + echo "*.i ident" + } >.gitattributes && + + { + echo a b c d e f g h i j k l m + echo n o p q r s t u v w x y z + echo '\''$ident$'\'' + } >test && + cat test >test.t && + cat test >test.o && + cat test >test.i && + git add test test.t test.i && + rm -f test test.t test.i && + git checkout -- test test.t test.i +' + +script='s/^\$ident: \([0-9a-f]*\) \$/\1/p' + +test_expect_success check ' + + cmp test.o test && + cmp test.o test.t && + + # ident should be stripped in the repository + git diff --raw --exit-code :test :test.i && + id=$(git rev-parse --verify :test) && + embedded=$(sed -ne "$script" test.i) && + test "z$id" = "z$embedded" +' + +test_done -- cgit v1.2.3 From aa4ed402c9721170fde2e9e43c3825562070e65e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 21 Apr 2007 03:14:13 -0700 Subject: Add 'filter' attribute and external filter driver definition. The interface is similar to the custom low-level merge drivers. First you configure your filter driver by defining 'filter..*' variables in the configuration. filter..clean filter command to run upon checkin filter..smudge filter command to run upon checkout Then you assign filter attribute to each path, whose name matches the custom filter driver's name. Example: (in .gitattributes) *.c filter=indent (in config) [filter "indent"] clean = indent smudge = cat Signed-off-by: Junio C Hamano --- t/t0021-conversion.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 't') diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh index ad952c9ce2..bab9ecc34e 100755 --- a/t/t0021-conversion.sh +++ b/t/t0021-conversion.sh @@ -4,8 +4,17 @@ test_description='blob conversion via gitattributes' . ./test-lib.sh +cat <<\EOF >rot13.sh +tr '[a-zA-Z]' '[n-za-mN-ZA-M]' +EOF +chmod +x rot13.sh + test_expect_success setup ' + git config filter.rot13.smudge ./rot13.sh && + git config filter.rot13.clean ./rot13.sh && + { + echo "*.t filter=rot13" echo "*.i ident" } >.gitattributes && -- cgit v1.2.3 From 8a359819273a4460d5806d2d5e76cd7993a84843 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Wed, 25 Apr 2007 22:07:45 +0200 Subject: Add a test for merging changed and rename-changed branches Also leave a warning for future merge-recursive explorers. Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- t/t6022-merge-rename.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 't') diff --git a/t/t6022-merge-rename.sh b/t/t6022-merge-rename.sh index b608e202c1..e3f7ae8120 100755 --- a/t/t6022-merge-rename.sh +++ b/t/t6022-merge-rename.sh @@ -47,6 +47,8 @@ git branch white && git branch red && git branch blue && git branch yellow && +git branch change && +git branch change+rename && sed -e "/^g /s/.*/g : master changes a line/" A+ && mv A+ A && @@ -77,6 +79,17 @@ rm -f A M && git update-index --add --remove A C M N && git commit -m "blue renames A->C, M->N" && +git checkout change && +sed -e "/^g /s/.*/g : changed line/" A+ && +mv A+ A && +git commit -q -a -m "changed" && + +git checkout change+rename && +sed -e "/^g /s/.*/g : changed line/" B && +rm A && +git update-index --add B && +git commit -q -a -m "changed and renamed" && + git checkout master' test_expect_success 'pull renaming branch into unrenaming one' \ @@ -318,4 +331,14 @@ test_expect_success 'interference with untracked working tree file' ' git reset --hard anchor ' +test_expect_success 'merge of identical changes in a renamed file' ' + rm -f A M N + git reset --hard && + git checkout change+rename && + GIT_MERGE_VERBOSITY=3 git merge change | grep "^Skipped B" && + git reset --hard HEAD^ && + git checkout change && + GIT_MERGE_VERBOSITY=3 git merge change+rename | grep "^Skipped B" +' + test_done -- cgit v1.2.3 From 28a94f885a735e7474357698ec384de24d526620 Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Sat, 28 Apr 2007 18:40:28 -0700 Subject: Fall back to $EMAIL for missing GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL Some other programs get the user's email address from $EMAIL, so fall back to that if we don't have a Git-specific email address. Signed-off-by: Josh Triplett Signed-off-by: Junio C Hamano --- t/test-lib.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't') diff --git a/t/test-lib.sh b/t/test-lib.sh index f2c6bd3b01..dee3ad7621 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -16,6 +16,7 @@ unset AUTHOR_EMAIL unset AUTHOR_NAME unset COMMIT_AUTHOR_EMAIL unset COMMIT_AUTHOR_NAME +unset EMAIL unset GIT_ALTERNATE_OBJECT_DIRECTORIES unset GIT_AUTHOR_DATE GIT_AUTHOR_EMAIL=author@example.com -- cgit v1.2.3 From b3431bc603df74cfe2da56e9a5c3f60327dd56b9 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 2 May 2007 12:59:55 -0400 Subject: Don't use seq in tests, not everyone has it For example Mac OS X lacks the seq command. So we cannot use it there. A good old while loop works just as good. Signed-off-by: Shawn O. Pearce --- t/t5302-pack-index.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh index 6902fc6d48..4d06eca6a5 100755 --- a/t/t5302-pack-index.sh +++ b/t/t5302-pack-index.sh @@ -10,11 +10,14 @@ test_expect_success \ 'setup' \ 'rm -rf .git git-init && - for i in `seq -w 100` + i=1 && + while test $i -le 100 do + i=`printf '%03i' $i` echo $i >file_$i && test-genrandom "$i" 8192 >>file_$i && - git-update-index --add file_$i || return 1 + git-update-index --add file_$i && + i=`expr $i + 1` || return 1 done && { echo 101 && test-genrandom 100 8192; } >file_101 && git-update-index --add file_101 && -- cgit v1.2.3 From c256acb8fbd0ac1dddb6ec39aa9b3c816493122c Mon Sep 17 00:00:00 2001 From: Bryan Larsen Date: Wed, 2 May 2007 17:53:23 -0400 Subject: posix compatibility for t4200 Fix t4200 so that it also works on OS X by not relying on gnu extensions to sed. Signed-off-by: Bryan Larsen Signed-off-by: Junio C Hamano --- t/t4200-rerere.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh index 6ba63d7173..c64ebbb2e9 100755 --- a/t/t4200-rerere.sh +++ b/t/t4200-rerere.sh @@ -44,7 +44,7 @@ mkdir .git/rr-cache test_expect_failure 'conflicting merge' 'git pull . first' -sha1=$(sed -e 's/\t.*//' .git/rr-cache/MERGE_RR) +sha1=$(sed -e 's/ .*//' .git/rr-cache/MERGE_RR) rr=.git/rr-cache/$sha1 test_expect_success 'recorded preimage' "grep ======= $rr/preimage" -- cgit v1.2.3 From c2a063691e1dcec137ed1f0def406d3bf3567e71 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 5 May 2007 22:36:19 -0700 Subject: Add test for blame corner cases. Signed-off-by: Junio C Hamano --- t/t8003-blame.sh | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100755 t/t8003-blame.sh (limited to 't') diff --git a/t/t8003-blame.sh b/t/t8003-blame.sh new file mode 100755 index 0000000000..db51b3a6bb --- /dev/null +++ b/t/t8003-blame.sh @@ -0,0 +1,132 @@ +#!/bin/sh + +test_description='git blame corner cases' +. ./test-lib.sh + +pick_fc='s/^[0-9a-f^]* *\([^ ]*\) *(\([^ ]*\) .*/\1-\2/' + +test_expect_success setup ' + + echo A A A A A >one && + echo B B B B B >two && + echo C C C C C >tres && + echo ABC >mouse && + git add one two tres mouse && + test_tick && + GIT_AUTHOR_NAME=Initial git commit -m Initial && + + cat one >uno && + mv two dos && + cat one >>tres && + echo DEF >>mouse + git add uno dos tres mouse && + test_tick && + GIT_AUTHOR_NAME=Second git commit -a -m Second && + + echo GHIJK >>mouse && + git add mouse && + test_tick && + GIT_AUTHOR_NAME=Third git commit -m Third && + + cat mouse >cow && + git add cow && + test_tick && + GIT_AUTHOR_NAME=Fourth git commit -m Fourth && + + { + echo ABC + echo DEF + echo XXXX + echo GHIJK + } >cow && + git add cow && + test_tick && + GIT_AUTHOR_NAME=Fifth git commit -m Fifth +' + +test_expect_success 'straight copy without -C' ' + + git blame uno | grep Second + +' + +test_expect_success 'straight move without -C' ' + + git blame dos | grep Initial + +' + +test_expect_success 'straight copy with -C' ' + + git blame -C1 uno | grep Second + +' + +test_expect_success 'straight move with -C' ' + + git blame -C1 dos | grep Initial + +' + +test_expect_success 'straight copy with -C -C' ' + + git blame -C -C1 uno | grep Initial + +' + +test_expect_success 'straight move with -C -C' ' + + git blame -C -C1 dos | grep Initial + +' + +test_expect_success 'append without -C' ' + + git blame -L2 tres | grep Second + +' + +test_expect_success 'append with -C' ' + + git blame -L2 -C1 tres | grep Second + +' + +test_expect_success 'append with -C -C' ' + + git blame -L2 -C -C1 tres | grep Second + +' + +test_expect_success 'append with -C -C -C' ' + + git blame -L2 -C -C -C1 tres | grep Initial + +' + +test_expect_success 'blame wholesale copy' ' + + git blame -f -C -C1 HEAD^ -- cow | sed -e "$pick_fc" >current && + { + echo mouse-Initial + echo mouse-Second + echo mouse-Third + } >expected && + diff -u expected current + +' + +test_expect_success 'blame wholesale copy and more' ' + + git blame -f -C -C1 HEAD -- cow | sed -e "$pick_fc" >current && + { + echo mouse-Initial + echo mouse-Second + echo cow-Fifth + echo mouse-Third + } >expected && + diff -u expected current + +' + +test_done -- cgit v1.2.3 From ec0e0f25dce3686fa7ad8fb1783140076983822c Mon Sep 17 00:00:00 2001 From: Michael Spang Date: Sun, 6 May 2007 15:50:54 -0400 Subject: t7300: Basic tests for git-clean This tests the -d, -n, -f, -x, and -X options to git-clean. Signed-off-by: Michael Spang Signed-off-by: Junio C Hamano --- t/t7300-clean.sh | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100755 t/t7300-clean.sh (limited to 't') diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh new file mode 100755 index 0000000000..de70b38d1c --- /dev/null +++ b/t/t7300-clean.sh @@ -0,0 +1,180 @@ +#!/bin/sh +# +# Copyright (c) 2007 Michael Spang +# + +test_description='git-clean basic tests' + +. ./test-lib.sh + +test_expect_success 'setup' ' + + mkdir -p src && + touch src/part1.c Makefile && + echo build >.gitignore && + echo \*.o >>.gitignore && + git-add . && + git-commit -m setup && + touch src/part2.c README && + git-add . + +' + +test_expect_success 'git-clean' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + git-clean && + test -f Makefile && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test ! -f a.out && + test ! -f src/part3.c && + test -f docs/manual.txt && + test -f obj.o && + test -f build/lib.so + +' + +test_expect_success 'git-clean -n' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + git-clean -n && + test -f Makefile && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test -f a.out && + test -f src/part3.c && + test -f docs/manual.txt && + test -f obj.o && + test -f build/lib.so + +' + +test_expect_success 'git-clean -d' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + git-clean -d && + test -f Makefile && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test ! -f a.out && + test ! -f src/part3.c && + test ! -d docs && + test -f obj.o && + test -f build/lib.so + +' + +test_expect_success 'git-clean -x' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + git-clean -x && + test -f Makefile && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test ! -f a.out && + test ! -f src/part3.c && + test -f docs/manual.txt && + test ! -f obj.o && + test -f build/lib.so + +' + +test_expect_success 'git-clean -d -x' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + git-clean -d -x && + test -f Makefile && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test ! -f a.out && + test ! -f src/part3.c && + test ! -d docs && + test ! -f obj.o && + test ! -d build + +' + +test_expect_success 'git-clean -X' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + git-clean -X && + test -f Makefile && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test -f a.out && + test -f src/part3.c && + test -f docs/manual.txt && + test ! -f obj.o && + test -f build/lib.so + +' + +test_expect_success 'git-clean -d -X' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + git-clean -d -X && + test -f Makefile && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test -f a.out && + test -f src/part3.c && + test -f docs/manual.txt && + test ! -f obj.o && + test ! -d build + +' + +test_expect_success 'clean.requireForce' ' + + git-config clean.requireForce true && + ! git-clean + +' + +test_expect_success 'clean.requireForce and -n' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + git-clean -n && + test -f Makefile && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test -f a.out && + test -f src/part3.c && + test -f docs/manual.txt && + test -f obj.o && + test -f build/lib.so + +' + +test_expect_success 'clean.requireForce and -f' ' + + git-clean -f && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test ! -f a.out && + test ! -f src/part3.c && + test -f docs/manual.txt && + test -f obj.o && + test -f build/lib.so + +' + +test_done -- cgit v1.2.3 From b3b53439701189597c116aec10a6e503f80820d8 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Wed, 2 May 2007 02:45:22 +0200 Subject: cvsserver: Add test cases for git-cvsserver Use the :fork: access method to force cvs to call "$CVS_SERVER server" even when accessing a local repository. Add a basic test for checkout and some tests for update. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- t/t9400-git-cvsserver-server.sh | 120 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100755 t/t9400-git-cvsserver-server.sh (limited to 't') diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh new file mode 100755 index 0000000000..f17be6b97e --- /dev/null +++ b/t/t9400-git-cvsserver-server.sh @@ -0,0 +1,120 @@ +#!/bin/sh +# +# Copyright (c) 2007 Frank Lichtenheld +# + +test_description='git-cvsserver access + +tests read access to a git repository with the +cvs CLI client via git-cvsserver server' + +. ./test-lib.sh + +cvs >/dev/null 2>&1 +if test $? -ne 1 +then + test_expect_success 'skipping git-cvsserver tests, cvs not found' : + test_done + exit +fi + +unset GIT_DIR GIT_CONFIG +WORKDIR=$(pwd) +SERVERDIR=$(pwd)/gitcvs.git +CVSROOT=":fork:$SERVERDIR" +CVSWORK=$(pwd)/cvswork +CVS_SERVER=git-cvsserver +export CVSROOT CVS_SERVER + +rm -rf "$CVSWORK" "$SERVERDIR" +echo >empty && + git add empty && + git commit -q -m "First Commit" && + git clone -q --local --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 && + GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true && + GIT_DIR="$SERVERDIR" git config --bool gitcvs.logfile "$SERVERDIR/gitcvs.log" || + exit 1 + +# note that cvs doesn't accept absolute pathnames +# as argument to co -d +test_expect_success 'basic checkout' \ + 'cvs -Q co -d cvswork master && + test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5))" = "empty/1.1/"' + +test_expect_success 'cvs update (create new file)' \ + 'echo testfile1 >testfile1 && + git add testfile1 && + git commit -q -m "Add testfile1" && + git push gitcvs.git >/dev/null && + cd cvswork && + cvs -Q update && + test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.1/" && + diff -q testfile1 ../testfile1' + +cd "$WORKDIR" +test_expect_success 'cvs update (update existing file)' \ + 'echo line 2 >>testfile1 && + git add testfile1 && + git commit -q -m "Append to testfile1" && + git push gitcvs.git >/dev/null && + cd cvswork && + cvs -Q update && + test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.2/" && + diff -q testfile1 ../testfile1' + +cd "$WORKDIR" +#TODO: cvsserver doesn't support update w/o -d +test_expect_failure "cvs update w/o -d doesn't create subdir (TODO)" \ + 'mkdir test && + echo >test/empty && + git add test && + git commit -q -m "Single Subdirectory" && + git push gitcvs.git >/dev/null && + cd cvswork && + cvs -Q update && + test ! -d test' + +cd "$WORKDIR" +test_expect_success 'cvs update (subdirectories)' \ + '(for dir in A A/B A/B/C A/D E; do + mkdir $dir && + echo "test file in $dir" >"$dir/file_in_$(echo $dir|sed -e "s#/# #g")" && + git add $dir; + done) && + git commit -q -m "deep sub directory structure" && + git push gitcvs.git >/dev/null && + cd cvswork && + cvs -Q update -d && + (for dir in A A/B A/B/C A/D E; do + filename="file_in_$(echo $dir|sed -e "s#/# #g")" && + if test "$(echo $(grep -v ^D $dir/CVS/Entries|cut -d/ -f2,3,5))" = "$filename/1.1/" && + diff -q "$dir/$filename" "../$dir/$filename"; then + : + else + echo >failure + fi + done) && + test ! -f failure' + +cd "$WORKDIR" +test_expect_success 'cvs update (delete file)' \ + 'git rm testfile1 && + git commit -q -m "Remove testfile1" && + git push gitcvs.git >/dev/null && + cd cvswork && + cvs -Q update && + test -z "$(grep testfile1 CVS/Entries)" && + test ! -f testfile1' + +cd "$WORKDIR" +test_expect_success 'cvs update (re-add deleted file)' \ + 'echo readded testfile >testfile1 && + git add testfile1 && + git commit -q -m "Re-Add testfile1" && + git push gitcvs.git >/dev/null && + cd cvswork && + cvs -Q update && + test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.4/" && + diff -q testfile1 ../testfile1' + +test_done -- cgit v1.2.3 From 469be5b258d72cec68c8d4e0c2fe44030bfc8787 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 9 May 2007 09:19:42 -0700 Subject: t9400: skip cvsserver test if Perl SQLite interface is unavailable Signed-off-by: Junio C Hamano --- t/t9400-git-cvsserver-server.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 't') diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh index f17be6b97e..f137b308f3 100755 --- a/t/t9400-git-cvsserver-server.sh +++ b/t/t9400-git-cvsserver-server.sh @@ -17,6 +17,11 @@ then test_done exit fi +perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || { + test_expect_success 'skipping git-cvsserver tests, Perl SQLite interface unavailable' : + test_done + exit +} unset GIT_DIR GIT_CONFIG WORKDIR=$(pwd) -- cgit v1.2.3 From 64cab59159d1308365d56e218a10bfc0d3cd0fd0 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 11 May 2007 22:26:08 -0700 Subject: apply: do not get confused by symlinks in the middle HPA noticed that git-rebase fails when changes involve symlinks in the middle of the hierarchy. Consider: * The tree state before the patch is applied has arch/x86_64/boot as a symlink pointing at ../i386/boot/ * The patch tries to remove arch/x86_64/boot symlink, and create bunch of files there: .gitignore, Makefile, etc. git-apply tries to be careful while applying patches; it never touches the working tree until it is convinced that the patch would apply cleanly. One of the check it does is that when it knows a path is going to be created by the patch, it runs lstat() on the path to make sure it does not exist. This leads to a false alarm. Because we do not touch the working tree before all the check passes, when we try to make sure that arch/x86_64/boot/.gitignore does not exist yet, we haven't removed the arch/x86_64/boot symlink. The lstat() check ends up seeing arch/i386/boot/.gitignore through the yet-to-be-removed symlink, and says "Hey, you already have a file there, but what you fed me is a patch to create a new file. I am not going to clobber what you have in the working tree." We have similar checks to see a file we are going to modify does exist and match the preimage of the diff, which is done by directly opening and reading the file. For a file we are going to delete, we make sure that it does exist and matches what is going to be removed (a removal patch records the full preimage, so we check what you have in your working tree matches it in full -- otherwise we would risk losing your local changes), which again is done by directly opening and reading the file. These checks need to be adjusted so that they are not fooled by symlinks in the middle. - To make sure something does not exist, first lstat(). If it does not exist, it does not, so be happy. If it _does_, we might be getting fooled by a symlink in the middle, so break leading paths and see if there are symlinks involved. When we are checking for a path a/b/c/d, if any of a, a/b, a/b/c is a symlink, then a/b/c/d does _NOT_ exist, for the purpose of our test. This would fix this particular case you saw, and would not add extra overhead in the usual case. - To make sure something already exists, first lstat(). If it does not exist, barf (up to this, we already do). Even if it does seem to exist, we might be getting fooled by a symlink in the middle, so make sure leading paths are not symlinks. This would make the normal codepath much more expensive for deep trees, which is a bit worrisome. This patch implements the first side of the check "making sure it does not exist". The latter "making sure it exists" check is not done yet, so applying the patch in reverse would still fail, but we have to start from somewhere. Signed-off-by: Junio C Hamano --- t/t4122-apply-symlink-inside.sh | 57 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100755 t/t4122-apply-symlink-inside.sh (limited to 't') diff --git a/t/t4122-apply-symlink-inside.sh b/t/t4122-apply-symlink-inside.sh new file mode 100755 index 0000000000..37c9a9f254 --- /dev/null +++ b/t/t4122-apply-symlink-inside.sh @@ -0,0 +1,57 @@ +#!/bin/sh + +test_description='apply to deeper directory without getting fooled with symlink' +. ./test-lib.sh + +lecho () { + for l_ + do + echo "$l_" + done +} + +test_expect_success setup ' + + mkdir -p arch/i386/boot arch/x86_64 && + lecho 1 2 3 4 5 >arch/i386/boot/Makefile && + ln -s ../i386/boot arch/x86_64/boot && + git add . && + test_tick && + git commit -m initial && + git branch test && + + rm arch/x86_64/boot && + mkdir arch/x86_64/boot && + lecho 2 3 4 5 6 >arch/x86_64/boot/Makefile && + git add . && + test_tick && + git commit -a -m second && + + git format-patch --binary -1 --stdout >test.patch + +' + +test_expect_success apply ' + + git checkout test && + git reset --hard && #### checkout seems to be buggy + git diff --exit-code test && + git diff --exit-code --cached test && + git apply --index test.patch + +' + +test_expect_success 'check result' ' + + git diff --exit-code master && + git diff --exit-code --cached master && + test_tick && + git commit -m replay && + T1=$(git rev-parse "master^{tree}") && + T2=$(git rev-parse "HEAD^{tree}") && + test "z$T1" = "z$T2" + +' + +test_done + -- cgit v1.2.3 From 16a4c6176ad096881d0021f1a922fbcc2835f799 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 10 May 2007 23:44:53 -0700 Subject: read-tree -m -u: avoid getting confused by intermediate symlinks. When switching from a branch with both x86_64/boot/Makefile and i386/boot/Makefile to another branch that has x86_64/boot as a symlink pointing at ../i386/boot, the code incorrectly removed i386/boot/Makefile. This was because we first removed everything under x86_64/boot to make room to create a symbolic link x86_64/boot, then removed x86_64/boot/Makefile which no longer exists but now is pointing at i386/boot/Makefile, thanks to the symlink we just created. This fixes it by using the has_symlink_leading_path() function introduced previously for git-apply in the checkout codepath. Earlier, "git checkout" was broken in t4122 test due to this bug, and the test had an extra "git reset --hard" as a workaround, which is removed because it is not needed anymore. Signed-off-by: Junio C Hamano --- t/t4122-apply-symlink-inside.sh | 1 - 1 file changed, 1 deletion(-) (limited to 't') diff --git a/t/t4122-apply-symlink-inside.sh b/t/t4122-apply-symlink-inside.sh index 37c9a9f254..3ddfe64b02 100755 --- a/t/t4122-apply-symlink-inside.sh +++ b/t/t4122-apply-symlink-inside.sh @@ -34,7 +34,6 @@ test_expect_success setup ' test_expect_success apply ' git checkout test && - git reset --hard && #### checkout seems to be buggy git diff --exit-code test && git diff --exit-code --cached test && git apply --index test.patch -- cgit v1.2.3 From 93c44d493b8c98b9bb74e4f78aa90ee20a01f078 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sat, 12 May 2007 02:42:00 -0400 Subject: git-add: allow path limiting with -u Rather than updating all working tree paths, we limit ourselves to paths listed on the command line. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t2200-add-update.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 t/t2200-add-update.sh (limited to 't') diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh new file mode 100755 index 0000000000..83005e70d0 --- /dev/null +++ b/t/t2200-add-update.sh @@ -0,0 +1,38 @@ +#!/bin/sh + +test_description='git-add -u with path limiting + +This test creates a working tree state with three files: + + top (previously committed, modified) + dir/sub (previously committed, modified) + dir/other (untracked) + +and issues a git-add -u with path limiting on "dir" to add +only the updates to dir/sub.' + +. ./test-lib.sh + +test_expect_success 'setup' ' +echo initial >top && +mkdir dir && +echo initial >dir/sub && +git-add dir/sub top && +git-commit -m initial && +echo changed >top && +echo changed >dir/sub && +echo other >dir/other +' + +test_expect_success 'update' 'git-add -u dir' + +test_expect_success 'update touched correct path' \ + 'test "`git-diff-files --name-status dir/sub`" = ""' + +test_expect_success 'update did not touch other tracked files' \ + 'test "`git-diff-files --name-status top`" = "M top"' + +test_expect_success 'update did not touch untracked files' \ + 'test "`git-diff-files --name-status dir/other`" = ""' + +test_done -- cgit v1.2.3 From a25907dac4a3b79523290f19232157b9705dfe55 Mon Sep 17 00:00:00 2001 From: Junio Hamano Date: Fri, 11 May 2007 16:35:18 -0700 Subject: t9400: Use the repository config and nothing else. git-cvsserver has a bug in its configuration file output parser that makes it choke if the configuration has these: [diff] color = auto [diff.color] whitespace = blue reverse This needs to be fixed, but thanks to that bug, a separate bug in t9400 test script was discovered. The test discarded GIT_CONFIG instead of pointing at the proper one to be used in the exoprted repository. This allowed user's .gitconfig and (if exists) systemwide /etc/gitconfig to affect the outcome of the test, which is a big no-no. The patch fixes the problem in the test. Fixing the git-cvsserver's configuration parser is left as an exercise to motivated volunteers ;-) Signed-off-by: Junio C Hamano --- t/t9400-git-cvsserver-server.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 't') diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh index f137b308f3..d406a8824a 100755 --- a/t/t9400-git-cvsserver-server.sh +++ b/t/t9400-git-cvsserver-server.sh @@ -26,8 +26,9 @@ perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || { unset GIT_DIR GIT_CONFIG WORKDIR=$(pwd) SERVERDIR=$(pwd)/gitcvs.git +git_config="$SERVERDIR/config" CVSROOT=":fork:$SERVERDIR" -CVSWORK=$(pwd)/cvswork +CVSWORK="$(pwd)/cvswork" CVS_SERVER=git-cvsserver export CVSROOT CVS_SERVER @@ -43,7 +44,7 @@ echo >empty && # note that cvs doesn't accept absolute pathnames # as argument to co -d test_expect_success 'basic checkout' \ - 'cvs -Q co -d cvswork master && + 'GIT_CONFIG="$git_config" cvs -Q co -d cvswork master && test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5))" = "empty/1.1/"' test_expect_success 'cvs update (create new file)' \ @@ -52,7 +53,7 @@ test_expect_success 'cvs update (create new file)' \ git commit -q -m "Add testfile1" && git push gitcvs.git >/dev/null && cd cvswork && - cvs -Q update && + GIT_CONFIG="$git_config" cvs -Q update && test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.1/" && diff -q testfile1 ../testfile1' @@ -63,7 +64,7 @@ test_expect_success 'cvs update (update existing file)' \ git commit -q -m "Append to testfile1" && git push gitcvs.git >/dev/null && cd cvswork && - cvs -Q update && + GIT_CONFIG="$git_config" cvs -Q update && test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.2/" && diff -q testfile1 ../testfile1' @@ -76,7 +77,7 @@ test_expect_failure "cvs update w/o -d doesn't create subdir (TODO)" \ git commit -q -m "Single Subdirectory" && git push gitcvs.git >/dev/null && cd cvswork && - cvs -Q update && + GIT_CONFIG="$git_config" cvs -Q update && test ! -d test' cd "$WORKDIR" @@ -89,7 +90,7 @@ test_expect_success 'cvs update (subdirectories)' \ git commit -q -m "deep sub directory structure" && git push gitcvs.git >/dev/null && cd cvswork && - cvs -Q update -d && + GIT_CONFIG="$git_config" cvs -Q update -d && (for dir in A A/B A/B/C A/D E; do filename="file_in_$(echo $dir|sed -e "s#/# #g")" && if test "$(echo $(grep -v ^D $dir/CVS/Entries|cut -d/ -f2,3,5))" = "$filename/1.1/" && @@ -107,7 +108,7 @@ test_expect_success 'cvs update (delete file)' \ git commit -q -m "Remove testfile1" && git push gitcvs.git >/dev/null && cd cvswork && - cvs -Q update && + GIT_CONFIG="$git_config" cvs -Q update && test -z "$(grep testfile1 CVS/Entries)" && test ! -f testfile1' @@ -118,7 +119,7 @@ test_expect_success 'cvs update (re-add deleted file)' \ git commit -q -m "Re-Add testfile1" && git push gitcvs.git >/dev/null && cd cvswork && - cvs -Q update && + GIT_CONFIG="$git_config" cvs -Q update && test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.4/" && diff -q testfile1 ../testfile1' -- cgit v1.2.3 From fdc99cbbdcdcf4ee2c336f02b7b2dbcb11696392 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 29 Mar 2007 01:02:50 -0700 Subject: checkout: allow detaching to HEAD even when switching to the tip of a branch You cannot currently checkout the tip of an existing branch without moving to the branch. This allows you to detach your HEAD and place it at such a commit, with: $ git checkout master^0 Signed-off-by: Junio C Hamano --- t/t7201-co.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 867bbd26cb..5fa6a45577 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -3,7 +3,20 @@ # Copyright (c) 2006 Junio C Hamano # -test_description='git-checkout tests.' +test_description='git-checkout tests. + +Creates master, forks renamer and side branches from it. +Test switching across them. + + ! [master] Initial A one, A two + * [renamer] Renamer R one->uno, M two + ! [side] Side M one, D two, A three + --- + + [side] Side M one, D two, A three + * [renamer] Renamer R one->uno, M two + +*+ [master] Initial A one, A two + +' . ./test-lib.sh @@ -129,4 +142,52 @@ test_expect_success 'checkout -m with merge conflict' ' ! test -s current ' +test_expect_success 'checkout to detach HEAD' ' + + git checkout -f renamer && git clean && + git checkout renamer^ && + H=$(git rev-parse --verify HEAD) && + M=$(git show-ref -s --verify refs/heads/master) && + test "z$H" = "z$M" && + if git symbolic-ref HEAD >/dev/null 2>&1 + then + echo "OOPS, HEAD is still symbolic???" + false + else + : happy + fi +' + +test_expect_success 'checkout to detach HEAD with branchname^' ' + + git checkout -f master && git clean && + git checkout renamer^ && + H=$(git rev-parse --verify HEAD) && + M=$(git show-ref -s --verify refs/heads/master) && + test "z$H" = "z$M" && + if git symbolic-ref HEAD >/dev/null 2>&1 + then + echo "OOPS, HEAD is still symbolic???" + false + else + : happy + fi +' + +test_expect_success 'checkout to detach HEAD with HEAD^0' ' + + git checkout -f master && git clean && + git checkout HEAD^0 && + H=$(git rev-parse --verify HEAD) && + M=$(git show-ref -s --verify refs/heads/master) && + test "z$H" = "z$M" && + if git symbolic-ref HEAD >/dev/null 2>&1 + then + echo "OOPS, HEAD is still symbolic???" + false + else + : happy + fi +' + test_done -- cgit v1.2.3 From b18a2be37a0de27902ad6491960ed910083b0310 Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sun, 13 May 2007 09:12:52 +0200 Subject: git-config: test for 'do not forget "a.b.var" ends "a.var" section'. Added test for mentioned bugfix. Signed-off-by: Steffen Prohaska Signed-off-by: Junio C Hamano --- t/t1300-repo-config.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 't') diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 78c2e0864f..a1d777ca81 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -407,6 +407,25 @@ EOF test_expect_success "section was removed properly" \ "git diff -u expect .git/config" +rm .git/config + +cat > expect << EOF +[gitcvs] + enabled = true + dbname = %Ggitcvs2.%a.%m.sqlite +[gitcvs "ext"] + dbname = %Ggitcvs1.%a.%m.sqlite +EOF + +test_expect_success 'section ending' ' + + git-config gitcvs.enabled true && + git-config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite && + git-config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite && + cmp .git/config expect + +' + test_expect_success numbers ' git-config kilo.gram 1k && -- cgit v1.2.3 From 4a1bb4c3f87f355dd52fcd0babcbd005d59d7ed6 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 13 May 2007 09:58:14 -0700 Subject: git-svn: don't attempt to minimize URLs by default For tracking branches and tags, git-svn prefers to connect to the root of the repository or at least the level that houses branches and tags as well as trunk. However, users that are accustomed to tracking a single directory have no use for this feature. As pointed out by Junio, users may not have permissions to connect to connect to a higher-level path in the repository. While the current minimize_url() function detects lack of permissions to certain paths _after_ successful logins, it cannot effectively determine if it is trying to access a login-only portion of a repo when the user expects to connect to a part where anonymous access is allowed. For people used to the git-svnimport switches of --trunk, --tags, --branches, they'll already pass the repository root (or root+subdirectory), so minimize URL isn't of too much use to them, either. For people *not* used to git-svnimport, git-svn also supports: git svn init --minimize-url \ --trunk http://repository-root/foo/trunk \ --branches http://repository-root/foo/branches \ --tags http://repository-root/foo/tags And this is where the new --minimize-url command-line switch comes in to allow for this behavior to continue working. --- t/t9100-git-svn-basic.sh | 2 +- t/t9104-git-svn-follow-parent.sh | 13 +++++++------ t/t9105-git-svn-commit-diff.sh | 2 +- t/t9110-git-svn-use-svm-props.sh | 7 ++++--- t/t9111-git-svn-use-svnsync-props.sh | 6 +++--- 5 files changed, 16 insertions(+), 14 deletions(-) (limited to 't') diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh index eb628fe075..70c3669ee8 100755 --- a/t/t9100-git-svn-basic.sh +++ b/t/t9100-git-svn-basic.sh @@ -229,7 +229,7 @@ test_expect_failure 'exit if init-ing a would clobber a URL' " test_expect_success \ 'init allows us to connect to another directory in the same repo' " - git-svn init -i bar $svnrepo/bar && + git-svn init --minimize-url -i bar $svnrepo/bar && git config --get svn-remote.svn.fetch \ '^bar:refs/remotes/bar$' && git config --get svn-remote.svn.fetch \ diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh index bd4f366e86..35aa45cb9a 100755 --- a/t/t9104-git-svn-follow-parent.sh +++ b/t/t9104-git-svn-follow-parent.sh @@ -28,7 +28,7 @@ test_expect_success 'initialize repo' " " test_expect_success 'init and fetch a moved directory' " - git-svn init -i thunk $svnrepo/thunk && + git-svn init --minimize-url -i thunk $svnrepo/thunk && git-svn fetch -i thunk && test \"\`git-rev-parse --verify refs/remotes/thunk@2\`\" \ = \"\`git-rev-parse --verify refs/remotes/thunk~1\`\" && @@ -68,7 +68,8 @@ test_expect_success 'follow larger parent' " echo hi > import/trunk/thunk/bump/thud/file && svn import -m 'import a larger parent' import $svnrepo/larger-parent && svn cp -m 'hi' $svnrepo/larger-parent $svnrepo/another-larger && - git-svn init -i larger $svnrepo/another-larger/trunk/thunk/bump/thud && + git-svn init --minimize-url -i larger \ + $svnrepo/another-larger/trunk/thunk/bump/thud && git-svn fetch -i larger && git-rev-parse --verify refs/remotes/larger && git-rev-parse --verify \ @@ -90,14 +91,14 @@ test_expect_success 'follow higher-level parent' " cd .. svn mkdir -m 'new glob at top level' $svnrepo/glob && svn mv -m 'move blob down a level' $svnrepo/blob $svnrepo/glob/blob && - git-svn init -i blob $svnrepo/glob/blob && + git-svn init --minimize-url -i blob $svnrepo/glob/blob && git-svn fetch -i blob " test_expect_success 'follow deleted directory' " svn mv -m 'bye!' $svnrepo/glob/blob/hi $svnrepo/glob/blob/bye && svn rm -m 'remove glob' $svnrepo/glob && - git-svn init -i glob $svnrepo/glob && + git-svn init --minimize-url -i glob $svnrepo/glob && git-svn fetch -i glob && test \"\`git cat-file blob refs/remotes/glob:blob/bye\`\" = hi && test \"\`git ls-tree refs/remotes/glob | wc -l \`\" -eq 1 @@ -127,7 +128,7 @@ test_expect_success 'follow-parent avoids deleting relevant info' " poke native/t/c.t && svn commit -m 'reorg test' && cd .. && - git-svn init -i r9270-t \ + git-svn init --minimize-url -i r9270-t \ $svnrepo/r9270/trunk/subversion/bindings/swig/perl/native/t && git-svn fetch -i r9270-t && test \`git rev-list r9270-t | wc -l\` -eq 2 && @@ -137,7 +138,7 @@ test_expect_success 'follow-parent avoids deleting relevant info' " test_expect_success "track initial change if it was only made to parent" " svn cp -m 'wheee!' $svnrepo/r9270/trunk $svnrepo/r9270/drunk && - git-svn init -i r9270-d \ + git-svn init --minimize-url -i r9270-d \ $svnrepo/r9270/drunk/subversion/bindings/swig/perl/native/t && git-svn fetch -i r9270-d && test \`git rev-list r9270-d | wc -l\` -eq 3 && diff --git a/t/t9105-git-svn-commit-diff.sh b/t/t9105-git-svn-commit-diff.sh index c668dd1270..318e172ef5 100755 --- a/t/t9105-git-svn-commit-diff.sh +++ b/t/t9105-git-svn-commit-diff.sh @@ -33,7 +33,7 @@ test_expect_success 'test the commit-diff command' " test_expect_success 'commit-diff to a sub-directory (with git-svn config)' " svn import -m 'sub-directory' import $svnrepo/subdir && - git-svn init $svnrepo/subdir && + git-svn init --minimize-url $svnrepo/subdir && git-svn fetch && git-svn commit-diff -r3 '$prev' '$head' && svn cat $svnrepo/subdir/readme > readme.2 && diff --git a/t/t9110-git-svn-use-svm-props.sh b/t/t9110-git-svn-use-svm-props.sh index 9db0d8fd8d..59e17f2663 100755 --- a/t/t9110-git-svn-use-svm-props.sh +++ b/t/t9110-git-svn-use-svm-props.sh @@ -9,9 +9,10 @@ test_description='git-svn useSvmProps test' test_expect_success 'load svm repo' " svnadmin load -q $rawsvnrepo < ../t9110/svm.dump && - git-svn init -R arr -i bar $svnrepo/mirror/arr && - git-svn init -R argh -i dir $svnrepo/mirror/argh && - git-svn init -R argh -i e $svnrepo/mirror/argh/a/b/c/d/e && + git-svn init --minimize-url -R arr -i bar $svnrepo/mirror/arr && + git-svn init --minimize-url -R argh -i dir $svnrepo/mirror/argh && + git-svn init --minimize-url -R argh -i e \ + $svnrepo/mirror/argh/a/b/c/d/e && git-config svn.useSvmProps true && git-svn fetch --all " diff --git a/t/t9111-git-svn-use-svnsync-props.sh b/t/t9111-git-svn-use-svnsync-props.sh index 483d7f8159..e52321471a 100755 --- a/t/t9111-git-svn-use-svnsync-props.sh +++ b/t/t9111-git-svn-use-svnsync-props.sh @@ -9,9 +9,9 @@ test_description='git-svn useSvnsyncProps test' test_expect_success 'load svnsync repo' " svnadmin load -q $rawsvnrepo < ../t9111/svnsync.dump && - git-svn init -R arr -i bar $svnrepo/bar && - git-svn init -R argh -i dir $svnrepo/dir && - git-svn init -R argh -i e $svnrepo/dir/a/b/c/d/e && + git-svn init --minimize-url -R arr -i bar $svnrepo/bar && + git-svn init --minimize-url -R argh -i dir $svnrepo/dir && + git-svn init --minimize-url -R argh -i e $svnrepo/dir/a/b/c/d/e && git-config svn.useSvnsyncProps true && git-svn fetch --all " -- cgit v1.2.3 From af9b54bb2cb0e15780bf3e820b5f1ce399deb2c4 Mon Sep 17 00:00:00 2001 From: Andy Parkins Date: Mon, 14 May 2007 14:37:25 +0100 Subject: Use $Id$ as the ident attribute keyword rather than $ident$ to be consistent with other VCSs $Id$ is present already in SVN and CVS; it would mean that people converting their existing repositories won't have to make any changes to the source files should they want to make use of the ident attribute. Given that it's a feature that's meant to calm those very people, it seems obtuse to make them edit every file just to make use of it. I think that bzr uses $Id$; Mercurial has examples hooks for $Id$; monotone has $Id$ on its wishlist. I can't think of a good reason not to stick with the de-facto standard and call ours $Id$ instead of $ident$. Signed-off-by: Andy Parkins Signed-off-by: Junio C Hamano --- t/t0021-conversion.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh index bab9ecc34e..6c26fd829d 100755 --- a/t/t0021-conversion.sh +++ b/t/t0021-conversion.sh @@ -21,7 +21,7 @@ test_expect_success setup ' { echo a b c d e f g h i j k l m echo n o p q r s t u v w x y z - echo '\''$ident$'\'' + echo '\''$Id$'\'' } >test && cat test >test.t && cat test >test.o && @@ -31,7 +31,7 @@ test_expect_success setup ' git checkout -- test test.t test.i ' -script='s/^\$ident: \([0-9a-f]*\) \$/\1/p' +script='s/^\$Id: \([0-9a-f]*\) \$/\1/p' test_expect_success check ' -- cgit v1.2.3 From cab333cb6ac0ac857dcfb112989ea32aea5d0ec1 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Mon, 21 May 2007 00:12:57 +0200 Subject: t1300: Add tests for git-config --bool --get Noticed that there were only tests for --int, but not for --bool. Add some. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- t/t1300-repo-config.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 't') diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index a1d777ca81..3f3fd2d7f7 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -436,6 +436,40 @@ test_expect_success numbers ' test z1048576 = "z$m" ' +cat > expect << EOF +true +false +true +false +true +false +true +false +EOF + +test_expect_success bool ' + + git-config bool.true1 01 && + git-config bool.true2 -1 && + git-config bool.true3 YeS && + git-config bool.true4 true && + git-config bool.false1 000 && + git-config bool.false2 "" && + git-config bool.false3 nO && + git-config bool.false4 FALSE && + rm -f result && + for i in 1 2 3 4 + do + git-config --bool --get bool.true$i >>result + git-config --bool --get bool.false$i >>result + done && + cmp expect result' + +test_expect_failure 'invalid bool' ' + + git-config bool.nobool foobar && + git-config --bool --get bool.nobool' + rm .git/config git-config quote.leading " test" -- cgit v1.2.3 From 77e4e8bd9b862d7285ca408d5e6dfc2134dba911 Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Sat, 19 May 2007 02:19:20 +0200 Subject: gitweb: Add test t9500 for gitweb (as standalone script) This test runs gitweb (git web interface) as CGI script from commandline, and checks that it would not write any errors or warnings to log. Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- t/t9500-gitweb-standalone-no-errors.sh | 490 +++++++++++++++++++++++++++++++++ 1 file changed, 490 insertions(+) create mode 100755 t/t9500-gitweb-standalone-no-errors.sh (limited to 't') diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh new file mode 100755 index 0000000000..b92ab63312 --- /dev/null +++ b/t/t9500-gitweb-standalone-no-errors.sh @@ -0,0 +1,490 @@ +#!/bin/sh +# +# Copyright (c) 2007 Jakub Narebski +# + +test_description='gitweb as standalone script (basic tests). + +This test runs gitweb (git web interface) as CGI script from +commandline, and checks that it would not write any errors +or warnings to log.' + +gitweb_init () { + cat >gitweb_config.perl <.git/description </dev/null 2>gitweb.log && + if grep -q -s "^[[]" gitweb.log >/dev/null; then false; else true; fi + + # gitweb.log is left for debugging +} + +. ./test-lib.sh + +gitweb_init + +# ---------------------------------------------------------------------- +# no commits (empty, just initialized repository) + +test_expect_success \ + 'no commits: projects_list (implicit)' \ + 'gitweb_run' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'no commits: projects_index' \ + 'gitweb_run "a=project_index"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'no commits: .git summary (implicit)' \ + 'gitweb_run "p=.git"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'no commits: .git commit (implicit HEAD)' \ + 'gitweb_run "p=.git;a=commit"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'no commits: .git commitdiff (implicit HEAD)' \ + 'gitweb_run "p=.git;a=commitdiff"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'no commits: .git tree (implicit HEAD)' \ + 'gitweb_run "p=.git;a=tree"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'no commits: .git heads' \ + 'gitweb_run "p=.git;a=heads"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'no commits: .git tags' \ + 'gitweb_run "p=.git;a=tags"' +test_debug 'cat gitweb.log' + + +# ---------------------------------------------------------------------- +# initial commit + +test_expect_success \ + 'Make initial commit' \ + 'echo "Not an empty file." > file && + git add file && + git commit -a -m "Initial commit." && + git branch b' + +test_expect_success \ + 'projects_list (implicit)' \ + 'gitweb_run' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'projects_index' \ + 'gitweb_run "a=project_index"' +test_debug 'cat gitweb.log' + +test_expect_success \ + '.git summary (implicit)' \ + 'gitweb_run "p=.git"' +test_debug 'cat gitweb.log' + +test_expect_success \ + '.git commit (implicit HEAD)' \ + 'gitweb_run "p=.git;a=commit"' +test_debug 'cat gitweb.log' + +test_expect_success \ + '.git commitdiff (implicit HEAD, root commit)' \ + 'gitweb_run "p=.git;a=commitdiff"' +test_debug 'cat gitweb.log' + +test_expect_success \ + '.git commitdiff_plain (implicit HEAD, root commit)' \ + 'gitweb_run "p=.git;a=commitdiff_plain"' +test_debug 'cat gitweb.log' + +test_expect_success \ + '.git commit (HEAD)' \ + 'gitweb_run "p=.git;a=commit;h=HEAD"' +test_debug 'cat gitweb.log' + +test_expect_success \ + '.git tree (implicit HEAD)' \ + 'gitweb_run "p=.git;a=tree"' +test_debug 'cat gitweb.log' + +test_expect_success \ + '.git blob (file)' \ + 'gitweb_run "p=.git;a=blob;f=file"' +test_debug 'cat gitweb.log' + +test_expect_success \ + '.git blob_plain (file)' \ + 'gitweb_run "p=.git;a=blob_plain;f=file"' +test_debug 'cat gitweb.log' + +# ---------------------------------------------------------------------- +# nonexistent objects + +test_expect_success \ + '.git commit (non-existent)' \ + 'gitweb_run "p=.git;a=commit;h=non-existent"' +test_debug 'cat gitweb.log' + +test_expect_success \ + '.git commitdiff (non-existent)' \ + 'gitweb_run "p=.git;a=commitdiff;h=non-existent"' +test_debug 'cat gitweb.log' + +test_expect_success \ + '.git commitdiff (non-existent vs HEAD)' \ + 'gitweb_run "p=.git;a=commitdiff;hp=non-existent;h=HEAD"' +test_debug 'cat gitweb.log' + +test_expect_success \ + '.git tree (0000000000000000000000000000000000000000)' \ + 'gitweb_run "p=.git;a=tree;h=0000000000000000000000000000000000000000"' +test_debug 'cat gitweb.log' + +test_expect_success \ + '.git tag (0000000000000000000000000000000000000000)' \ + 'gitweb_run "p=.git;a=tag;h=0000000000000000000000000000000000000000"' +test_debug 'cat gitweb.log' + +test_expect_success \ + '.git blob (non-existent)' \ + 'gitweb_run "p=.git;a=blob;f=non-existent"' +test_debug 'cat gitweb.log' + +test_expect_success \ + '.git blob_plain (non-existent)' \ + 'gitweb_run "p=.git;a=blob_plain;f=non-existent"' +test_debug 'cat gitweb.log' + + +# ---------------------------------------------------------------------- +# commitdiff testing (implicit, one implicit tree-ish) + +test_expect_success \ + 'commitdiff(0): root' \ + 'gitweb_run "p=.git;a=commitdiff"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(0): file added' \ + 'echo "New file" > new_file && + git add new_file && + git commit -a -m "File added." && + gitweb_run "p=.git;a=commitdiff"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(0): mode change' \ + 'chmod a+x new_file && + git commit -a -m "Mode changed." && + gitweb_run "p=.git;a=commitdiff"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(0): file renamed' \ + 'git mv new_file renamed_file && + git commit -a -m "File renamed." && + gitweb_run "p=.git;a=commitdiff"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(0): file to symlink' \ + 'rm renamed_file && + ln -s file renamed_file && + git commit -a -m "File to symlink." && + gitweb_run "p=.git;a=commitdiff"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(0): file deleted' \ + 'git rm renamed_file && + rm -f renamed_file && + git commit -a -m "File removed." && + gitweb_run "p=.git;a=commitdiff"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(0): file copied / new file' \ + 'cp file file2 && + git add file2 && + git commit -a -m "File copied." && + gitweb_run "p=.git;a=commitdiff"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(0): mode change and modified' \ + 'echo "New line" >> file2 && + chmod a+x file2 && + git commit -a -m "Mode change and modification." && + gitweb_run "p=.git;a=commitdiff"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(0): renamed and modified' \ + 'cat >file2<> file3 && + git commit -a -m "File rename and modification." && + gitweb_run "p=.git;a=commitdiff"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(0): renamed, mode change and modified' \ + 'git mv file3 file2 && + echo "Propter nomen suum." >> file2 && + chmod a+x file2 && + git commit -a -m "File rename, mode change and modification." && + gitweb_run "p=.git;a=commitdiff"' +test_debug 'cat gitweb.log' + +# ---------------------------------------------------------------------- +# commitdiff testing (taken from t4114-apply-typechange.sh) + +test_expect_success 'setup typechange commits' ' + echo "hello world" > foo && + echo "hi planet" > bar && + git update-index --add foo bar && + git commit -m initial && + git branch initial && + rm -f foo && + ln -s bar foo && + git update-index foo && + git commit -m "foo symlinked to bar" && + git branch foo-symlinked-to-bar && + rm -f foo && + echo "how far is the sun?" > foo && + git update-index foo && + git commit -m "foo back to file" && + git branch foo-back-to-file && + rm -f foo && + git update-index --remove foo && + mkdir foo && + echo "if only I knew" > foo/baz && + git update-index --add foo/baz && + git commit -m "foo becomes a directory" && + git branch "foo-becomes-a-directory" && + echo "hello world" > foo/baz && + git update-index foo/baz && + git commit -m "foo/baz is the original foo" && + git branch foo-baz-renamed-from-foo + ' + +test_expect_success \ + 'commitdiff(2): file renamed from foo to foo/baz' \ + 'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-baz-renamed-from-foo"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(2): file renamed from foo/baz to foo' \ + 'gitweb_run "p=.git;a=commitdiff;hp=foo-baz-renamed-from-foo;h=initial"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(2): directory becomes file' \ + 'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=initial"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(2): file becomes directory' \ + 'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-becomes-a-directory"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(2): file becomes symlink' \ + 'gitweb_run "p=.git;a=commitdiff;hp=initial;h=foo-symlinked-to-bar"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(2): symlink becomes file' \ + 'gitweb_run "p=.git;a=commitdiff;hp=foo-symlinked-to-bar;h=foo-back-to-file"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(2): symlink becomes directory' \ + 'gitweb_run "p=.git;a=commitdiff;hp=foo-symlinked-to-bar;h=foo-becomes-a-directory"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(2): directory becomes symlink' \ + 'gitweb_run "p=.git;a=commitdiff;hp=foo-becomes-a-directory;h=foo-symlinked-to-bar"' +test_debug 'cat gitweb.log' + +# ---------------------------------------------------------------------- +# commit, commitdiff: merge, large +test_expect_success \ + 'Create a merge' \ + 'git checkout b && + echo "Branch" >> b && + git add b && + git commit -a -m "On branch" && + git checkout master && + git pull . b' + +test_expect_success \ + 'commit(0): merge commit' \ + 'gitweb_run "p=.git;a=commit"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(0): merge commit' \ + 'gitweb_run "p=.git;a=commitdiff"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'Prepare large commit' \ + 'git checkout b && + echo "To be changed" > 01-change && + echo "To be renamed" > 02-pure-rename-from && + echo "To be deleted" > 03-delete && + echo "To be renamed and changed" > 04-rename-from && + echo "To have mode changed" > 05-mode-change && + echo "File to symlink" > 06-file-or-symlink && + echo "To be changed and have mode changed" > 07-change-mode-change && + git add 0* && + git commit -a -m "Prepare large commit" && + echo "Changed" > 01-change && + git mv 02-pure-rename-from 02-pure-rename-to && + git rm 03-delete && rm -f 03-delete && + echo "A new file" > 03-new && + git add 03-new && + git mv 04-rename-from 04-rename-to && + echo "Changed" >> 04-rename-to && + chmod a+x 05-mode-change && + rm -f 06-file-or-symlink && ln -s 01-change 06-file-or-symlink && + echo "Changed and have mode changed" > 07-change-mode-change && + chmod a+x 07-change-mode-change && + git commit -a -m "Large commit" && + git checkout master' + +test_expect_success \ + 'commit(1): large commit' \ + 'gitweb_run "p=.git;a=commit;h=b"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'commitdiff(1): large commit' \ + 'gitweb_run "p=.git;a=commitdiff;h=b"' +test_debug 'cat gitweb.log' + +# ---------------------------------------------------------------------- +# tags testing + +test_expect_success \ + 'tags: list of different types of tags' \ + 'git checkout master && + git tag -a -m "Tag commit object" tag-commit HEAD && + git tag -a -m "" tag-commit-nomessage HEAD && + git tag -a -m "Tag tag object" tag-tag tag-commit && + git tag -a -m "Tag tree object" tag-tree HEAD^{tree} && + git tag -a -m "Tag blob object" tag-blob HEAD:file && + git tag lightweight/tag-commit HEAD && + git tag lightweight/tag-tag tag-commit && + git tag lightweight/tag-tree HEAD^{tree} && + git tag lightweight/tag-blob HEAD:file && + gitweb_run "p=.git;a=tags"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'tag: Tag to commit object' \ + 'gitweb_run "p=.git;a=tag;h=tag-commit"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'tag: on lightweight tag (invalid)' \ + 'gitweb_run "p=.git;a=tag;h=lightweight/tag-commit"' +test_debug 'cat gitweb.log' + +# ---------------------------------------------------------------------- +# logs + +test_expect_success \ + 'logs: log (implicit HEAD)' \ + 'gitweb_run "p=.git;a=log"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'logs: shortlog (implicit HEAD)' \ + 'gitweb_run "p=.git;a=shortlog"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'logs: history (implicit HEAD, file)' \ + 'gitweb_run "p=.git;a=history;f=file"' +test_debug 'cat gitweb.log' + +# ---------------------------------------------------------------------- +# feed generation + +test_expect_success \ + 'feeds: OPML' \ + 'gitweb_run "a=opml"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'feed: RSS' \ + 'gitweb_run "p=.git;a=rss"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'feed: Atom' \ + 'gitweb_run "p=.git;a=atom"' +test_debug 'cat gitweb.log' + +test_done -- cgit v1.2.3 From 0ba956d331e4c14fb1600a62044492c6c27af71a Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 22 May 2007 01:12:17 +0100 Subject: git-status: respect core.excludesFile git-add reads this variable, and honours the contents of that file if that exists. Match this behaviour in git-status, too. Noticed by Evan Carroll on IRC. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3001-ls-files-others-exclude.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 't') diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh index db7a847a5d..fcfcfbba7d 100755 --- a/t/t3001-ls-files-others-exclude.sh +++ b/t/t3001-ls-files-others-exclude.sh @@ -79,4 +79,24 @@ test_expect_success \ >output && git diff expect output' +cat > excludes-file << EOF +*.[1-8] +e* +EOF + +git-config core.excludesFile excludes-file + +git-runstatus | grep "^# " > output + +cat > expect << EOF +# .gitignore +# a.6 +# one/ +# output +# three/ +EOF + +test_expect_success 'git-status honours core.excludesfile' \ + 'diff -u expect output' + test_done -- cgit v1.2.3 From 1d431b22357389d0833830daf814ff0c4dc9189d Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Mon, 21 May 2007 00:31:56 +0200 Subject: t9400: Add test cases for config file handling Add a few test cases for the config file parsing done by git-cvsserver. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- t/t9400-git-cvsserver-server.sh | 69 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 't') diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh index d406a8824a..1b6343557a 100755 --- a/t/t9400-git-cvsserver-server.sh +++ b/t/t9400-git-cvsserver-server.sh @@ -47,6 +47,75 @@ test_expect_success 'basic checkout' \ 'GIT_CONFIG="$git_config" cvs -Q co -d cvswork master && test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5))" = "empty/1.1/"' +#-------------- +# CONFIG TESTS +#-------------- + +test_expect_success 'gitcvs.enabled = false' \ + 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false && + if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 + then + echo unexpected cvs success + false + else + true + fi && + cat cvs.log | grep -q "GITCVS emulation disabled" && + test ! -d cvswork2' + +rm -fr cvswork2 +test_expect_success 'gitcvs.ext.enabled = true' \ + 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true && + GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false && + GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 && + diff -q cvswork cvswork2' + +rm -fr cvswork2 +test_expect_success 'gitcvs.ext.enabled = false' \ + 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled false && + GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true && + if GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 + then + echo unexpected cvs success + false + else + true + fi && + cat cvs.log | grep -q "GITCVS emulation disabled" && + test ! -d cvswork2' + +rm -fr cvswork2 +test_expect_success 'gitcvs.dbname' \ + 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true && + GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite && + GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 && + diff -q cvswork cvswork2 && + test -f "$SERVERDIR/gitcvs.ext.master.sqlite" && + cmp "$SERVERDIR/gitcvs.master.sqlite" "$SERVERDIR/gitcvs.ext.master.sqlite"' + +rm -fr cvswork2 +test_expect_success 'gitcvs.ext.dbname' \ + 'GIT_DIR="$SERVERDIR" git config --bool gitcvs.ext.enabled true && + GIT_DIR="$SERVERDIR" git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite && + GIT_DIR="$SERVERDIR" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite && + GIT_CONFIG="$git_config" cvs -Q co -d cvswork2 master >cvs.log 2>&1 && + diff -q cvswork cvswork2 && + test -f "$SERVERDIR/gitcvs1.ext.master.sqlite" && + test ! -f "$SERVERDIR/gitcvs2.ext.master.sqlite" && + cmp "$SERVERDIR/gitcvs.master.sqlite" "$SERVERDIR/gitcvs1.ext.master.sqlite"' + + +#------------ +# CVS UPDATE +#------------ + +rm -fr "$SERVERDIR" +cd "$WORKDIR" && +git clone -q --local --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 && +GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true && +GIT_DIR="$SERVERDIR" git config --bool gitcvs.logfile "$SERVERDIR/gitcvs.log" || +exit 1 + test_expect_success 'cvs update (create new file)' \ 'echo testfile1 >testfile1 && git add testfile1 && -- cgit v1.2.3 From 1978659a7421098095fd6a8613302771cae81dd1 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Mon, 21 May 2007 00:31:57 +0200 Subject: t9400: Add some more cvs update tests Add some cvs update tests that include various merge situations. Also add a basic test for update -C since it fits so well in there. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- t/t9400-git-cvsserver-server.sh | 69 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 't') diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh index 1b6343557a..e42943e5b1 100755 --- a/t/t9400-git-cvsserver-server.sh +++ b/t/t9400-git-cvsserver-server.sh @@ -192,4 +192,73 @@ test_expect_success 'cvs update (re-add deleted file)' \ test "$(echo $(grep testfile1 CVS/Entries|cut -d/ -f2,3,5))" = "testfile1/1.4/" && diff -q testfile1 ../testfile1' +cd "$WORKDIR" +test_expect_success 'cvs update (merge)' \ + 'echo Line 0 >expected && + for i in 1 2 3 4 5 6 7 + do + echo Line $i >>merge + echo Line $i >>expected + done && + echo Line 8 >>expected && + git add merge && + git commit -q -m "Merge test (pre-merge)" && + git push gitcvs.git >/dev/null && + cd cvswork && + GIT_CONFIG="$git_config" cvs -Q update && + test "$(echo $(grep merge CVS/Entries|cut -d/ -f2,3,5))" = "merge/1.1/" && + diff -q merge ../merge && + ( echo Line 0; cat merge ) >merge.tmp && + mv merge.tmp merge && + cd "$WORKDIR" && + echo Line 8 >>merge && + git add merge && + git commit -q -m "Merge test (merge)" && + git push gitcvs.git >/dev/null && + cd cvswork && + GIT_CONFIG="$git_config" cvs -Q update && + diff -q merge ../expected' + +cd "$WORKDIR" + +cat >expected.C <>>>>>> merge.3 +EOF + +for i in 1 2 3 4 5 6 7 8 +do + echo Line $i >>expected.C +done + +test_expect_success 'cvs update (conflict merge)' \ + '( echo LINE 0; cat merge ) >merge.tmp && + mv merge.tmp merge && + git add merge && + git commit -q -m "Merge test (conflict)" && + git push gitcvs.git >/dev/null && + cd cvswork && + GIT_CONFIG="$git_config" cvs -Q update && + diff -q merge ../expected.C' + +cd "$WORKDIR" +test_expect_success 'cvs update (-C)' \ + 'cd cvswork && + GIT_CONFIG="$git_config" cvs -Q update -C && + diff -q merge ../merge' + +cd "$WORKDIR" +test_expect_success 'cvs update (merge no-op)' \ + 'echo Line 9 >>merge && + cp merge cvswork/merge && + git add merge && + git commit -q -m "Merge test (no-op)" && + git push gitcvs.git >/dev/null && + cd cvswork && + GIT_CONFIG="$git_config" cvs -Q update && + diff -q merge ../merge' + test_done -- cgit v1.2.3 From 240ba7f235c9b946678bd6d34826fb73ea8fd90e Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Mon, 21 May 2007 00:31:58 +0200 Subject: t9400: Add some basic pserver tests While we can easily test the cvs <-> git-cvsserver communication with :fork: and git-cvsserver server there are some pserver specifics we should test, too. Currently this are two tests of the pserver authentication. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- t/t9400-git-cvsserver-server.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 't') diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh index e42943e5b1..7f9c6e29b2 100755 --- a/t/t9400-git-cvsserver-server.sh +++ b/t/t9400-git-cvsserver-server.sh @@ -47,6 +47,40 @@ test_expect_success 'basic checkout' \ 'GIT_CONFIG="$git_config" cvs -Q co -d cvswork master && test "$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5))" = "empty/1.1/"' +#------------------------ +# PSERVER AUTHENTICATION +#------------------------ + +cat >request-anonymous <request-git <log 2>&1 && + tail -n1 log | grep -q "^I LOVE YOU$"' + +test_expect_success 'pserver authentication failure (non-anonymous user)' \ + 'if cat request-git | git-cvsserver pserver >log 2>&1 + then + false + else + true + fi && + tail -n1 log | grep -q "^I HATE YOU$"' + + #-------------- # CONFIG TESTS #-------------- -- cgit v1.2.3 From aac65ed1bc63619d32516079995f5cbe4bb46492 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 24 May 2007 00:32:31 -0400 Subject: Fix possible coredump with fast-import --import-marks When e8438420bb7d368bec3647b90c557b9931582267 allowed us to reload the marks table on subsequent runs of fast-import we really broke things, as we set pack_id to MAX_PACK_ID for any objects we imported into the marks table. Creating a branch from that mark should fail as we attempt to read the object through a non-existant packed_git pointer. Instead we have to use the normal Git object system to locate the older commit, as we ourselves do not have a reference to the packed_git it resides in. This bug only occurred because t9300 was not complete enough. When we added the --import-marks feature we didn't actually test its implementation enough to verify the function worked as intended. I have corrected that, and included the changes as part of this fix. Prior versions of fast-import fail the new test(s); this commit allows them to pass. Credit for this bug find goes to Simon Hausmann as he recently identified a similiar bug in the tree lazy-loading path. Signed-off-by: Shawn O. Pearce --- t/t9300-fast-import.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 't') diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 8e958da536..72e49f5d3b 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -119,6 +119,35 @@ test_expect_success \ input < $GIT_COMMITTER_DATE +data <expect <actual +test_expect_success \ + 'A: verify diff' \ + 'compare_diff_raw expect actual && + test `git-rev-parse --verify master:file2` \ + = `git-rev-parse --verify verify--import-marks:copy-of-file2`' + ### ### series B ### -- cgit v1.2.3 From 816366e23dfe366b938b427eac8ea1c8345ea339 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 26 May 2007 00:26:20 -0700 Subject: Add tests for the last two fixes. This updates t4014 to check the two fixes for git-am and git-commit we observed with "echo" that does backslash interpolation by default without being asked with -e option. Signed-off-by: Junio C Hamano --- t/t4014-format-patch.sh | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 't') diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index 4795872a77..df969bb69c 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -16,16 +16,16 @@ test_expect_success setup ' 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" && + git commit -m "Side changes #1" && for i in D E F; do echo "$i"; done >>file && git update-index file && - git commit -m "Side change #2" && + 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 && - git commit -m "Side change #3" && + git commit -m "Side changes #3 with \\n backslash-n in it." && git checkout master && git diff-tree -p C2 | git apply --index && @@ -66,4 +66,23 @@ test_expect_success "format-patch --ignore-if-in-upstream result applies" ' test $cnt = 2 ' +test_expect_success 'commit did not screw up the log message' ' + + git cat-file commit side | grep "^Side .* with .* backslash-n" + +' + +test_expect_success 'format-patch did not screw up the log message' ' + + grep "^Subject: .*Side changes #3 with .* backslash-n" patch0 && + grep "^Subject: .*Side changes #3 with .* backslash-n" patch1 + +' + +test_expect_success 'replay did not screw up the log message' ' + + git cat-file commit rebuild-1 | grep "^Side .* with .* backslash-n" + +' + test_done -- cgit v1.2.3 From 20b3d206acbbb042c7ad5f42d36ff8d036a538c5 Mon Sep 17 00:00:00 2001 From: James Y Knight Date: Thu, 24 May 2007 00:37:06 -0400 Subject: Fix git-svn to handle svn not reporting the md5sum of a file, and test. Acked-by: Eric Wong Signed-off-by: Junio C Hamano --- t/t9112-git-svn-md5less-file.sh | 45 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 t/t9112-git-svn-md5less-file.sh (limited to 't') diff --git a/t/t9112-git-svn-md5less-file.sh b/t/t9112-git-svn-md5less-file.sh new file mode 100755 index 0000000000..08313bb545 --- /dev/null +++ b/t/t9112-git-svn-md5less-file.sh @@ -0,0 +1,45 @@ +test_description='test that git handles an svn repository with missing md5sums' + +. ./lib-git-svn.sh + +# Loading a node from a svn dumpfile without a Text-Content-Length +# field causes svn to neglect to store or report an md5sum. (it will +# calculate one if you had put Text-Content-Length: 0). This showed +# up in a repository creted with cvs2svn. + +cat > dumpfile.svn < Date: Sun, 27 May 2007 11:52:11 +0100 Subject: Add test case for $Id$ expanded in the repository This test case would have caught the bug fixed by revision c23290d5. It puts various forms of $Id$ into a file in the repository, without allowing git to collapse them to uniformity. Then enables the $Id$ expansion on checkout, and checks that what is checked out has coped with the various forms. Signed-off-by: Andy Parkins Signed-off-by: Junio C Hamano --- t/t0021-conversion.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 't') diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh index 6c26fd829d..a839f4e074 100755 --- a/t/t0021-conversion.sh +++ b/t/t0021-conversion.sh @@ -45,4 +45,40 @@ test_expect_success check ' test "z$id" = "z$embedded" ' +# If an expanded ident ever gets into the repository, we want to make sure that +# it is collapsed before being expanded again on checkout +test_expect_success expanded_in_repo ' + { + echo "File with expanded keywords" + echo "\$Id\$" + echo "\$Id:\$" + echo "\$Id: 0000000000000000000000000000000000000000 \$" + echo "\$Id: NoSpaceAtEnd\$" + echo "\$Id:NoSpaceAtFront \$" + echo "\$Id:NoSpaceAtEitherEnd\$" + echo "\$Id: NoTerminatingSymbol" + } > expanded-keywords && + + { + echo "File with expanded keywords" + echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$" + echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$" + echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$" + echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$" + echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$" + echo "\$Id: 4f21723e7b15065df7de95bd46c8ba6fb1818f4c \$" + echo "\$Id: NoTerminatingSymbol" + } > expected-output && + + git add expanded-keywords && + git commit -m "File with keywords expanded" && + + echo "expanded-keywords ident" >> .gitattributes && + + rm -f expanded-keywords && + git checkout -- expanded-keywords && + cat expanded-keywords && + cmp expanded-keywords expected-output +' + test_done -- cgit v1.2.3 From b3c81cff02e56a62bd657148da757fdfd8dc6255 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Sun, 27 May 2007 14:33:09 +0200 Subject: t9400: Work around CVS' deficiencies If we are too fast with our changes, the file in the working copy might still have the same mtime as noted in the CVS/Entries. This will cause CVS to happily report to the server that the file is unmodified which can lead to data loss (and in our case test failure). CVS sucks! Work around that by sleeping for a second. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- t/t9400-git-cvsserver-server.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 't') diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh index 7f9c6e29b2..76a9b1a5d2 100755 --- a/t/t9400-git-cvsserver-server.sh +++ b/t/t9400-git-cvsserver-server.sh @@ -250,6 +250,7 @@ test_expect_success 'cvs update (merge)' \ git commit -q -m "Merge test (merge)" && git push gitcvs.git >/dev/null && cd cvswork && + sleep 1 && touch merge && GIT_CONFIG="$git_config" cvs -Q update && diff -q merge ../expected' @@ -292,6 +293,7 @@ test_expect_success 'cvs update (merge no-op)' \ git commit -q -m "Merge test (no-op)" && git push gitcvs.git >/dev/null && cd cvswork && + sleep 1 && touch merge && GIT_CONFIG="$git_config" cvs -Q update && diff -q merge ../merge' -- cgit v1.2.3 From 24a97d84adb649ca5d90c9b1e6d894f4acee1a6b Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Sun, 27 May 2007 14:33:10 +0200 Subject: cvsserver: Handle 'cvs login' Since this is a trivial variation of the general pserver authentication, there is really no reason not to support it. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- t/t9400-git-cvsserver-server.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 't') diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh index 76a9b1a5d2..e9ef315173 100755 --- a/t/t9400-git-cvsserver-server.sh +++ b/t/t9400-git-cvsserver-server.sh @@ -67,6 +67,22 @@ git END AUTH REQUEST EOF +cat >login-anonymous <login-git <log 2>&1 && tail -n1 log | grep -q "^I LOVE YOU$"' @@ -80,6 +96,19 @@ test_expect_success 'pserver authentication failure (non-anonymous user)' \ fi && tail -n1 log | grep -q "^I HATE YOU$"' +test_expect_success 'pserver authentication (login)' \ + 'cat login-anonymous | git-cvsserver pserver >log 2>&1 && + tail -n1 log | grep -q "^I LOVE YOU$"' + +test_expect_success 'pserver authentication failure (login/non-anonymous user)' \ + 'if cat login-git | git-cvsserver pserver >log 2>&1 + then + false + else + true + fi && + tail -n1 log | grep -q "^I HATE YOU$"' + #-------------- # CONFIG TESTS -- cgit v1.2.3 From 7ff895c0d229c2c60b73e91b0c389a4e3ce69e46 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 30 May 2007 00:50:26 -0400 Subject: Test for recent rev-parse $abbrev_sha1 regression My recent patch "Lazily open pack index files on demand" caused a regression in the case of parsing abbreviated SHA-1 object names. Git was unable to translate the abbreviated name into the full name if the object was packed, as the pack .idx files were not opened before being accessed. This is a simple test to repack a repository then test for an abbreviated SHA-1 within the packfile. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- t/t6101-rev-parse-parents.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 't') diff --git a/t/t6101-rev-parse-parents.sh b/t/t6101-rev-parse-parents.sh index 7d354a1fae..b0252b9413 100755 --- a/t/t6101-rev-parse-parents.sh +++ b/t/t6101-rev-parse-parents.sh @@ -29,5 +29,15 @@ test_expect_success 'final^1^3 not valid' "if git-rev-parse --verify final^1^3; test_expect_failure '--verify start2^1' 'git-rev-parse --verify start2^1' test_expect_success '--verify start2^0' 'git-rev-parse --verify start2^0' +test_expect_success 'repack for next test' 'git repack -a -d' +test_expect_success 'short SHA-1 works' ' + start=`git rev-parse --verify start` && + echo $start && + abbrv=`echo $start | sed s/.\$//` && + echo $abbrv && + abbrv=`git rev-parse --verify $abbrv` && + echo $abbrv && + test $start = $abbrv' + test_done -- cgit v1.2.3 From 996e2d6ea2626f55a59e70ac7305a02ce0171814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 1 Jun 2007 17:08:12 -0400 Subject: Use =20 when rfc2047 encoding spaces. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Encode ' ' using '=20' even though rfc2047 allows using '_' for readability. Unfortunately, many programs do not understand this and just leave the underscore in place. Using '=20' seems to work better. [jc: with adjustment to t3901] Signed-off-by: Kristian Høgsberg Signed-off-by: Junio C Hamano --- t/t3901-i18n-patch.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 't') diff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh index a881797bc7..24bf0ee018 100755 --- a/t/t3901-i18n-patch.sh +++ b/t/t3901-i18n-patch.sh @@ -13,7 +13,7 @@ check_encoding () { while test "$i" -le $cnt do git format-patch --encoding=UTF-8 --stdout HEAD~$i..HEAD~$j | - grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD_=C3=B3=C3=BA?=" && + grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" && git-cat-file commit HEAD~$j | case "$header" in 8859) @@ -73,9 +73,9 @@ test_expect_success 'format-patch output (ISO-8859-1)' ' git format-patch --stdout master..HEAD^ >out-l1 && git format-patch --stdout HEAD^ >out-l2 && grep "^Content-Type: text/plain; charset=ISO-8859-1" out-l1 && - grep "^From: =?ISO-8859-1?q?=C1=E9=ED_=F3=FA?=" out-l1 && + grep "^From: =?ISO-8859-1?q?=C1=E9=ED=20=F3=FA?=" out-l1 && grep "^Content-Type: text/plain; charset=ISO-8859-1" out-l2 && - grep "^From: =?ISO-8859-1?q?=C1=E9=ED_=F3=FA?=" out-l2 + grep "^From: =?ISO-8859-1?q?=C1=E9=ED=20=F3=FA?=" out-l2 ' test_expect_success 'format-patch output (UTF-8)' ' @@ -84,9 +84,9 @@ test_expect_success 'format-patch output (UTF-8)' ' git format-patch --stdout master..HEAD^ >out-u1 && git format-patch --stdout HEAD^ >out-u2 && grep "^Content-Type: text/plain; charset=UTF-8" out-u1 && - grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD_=C3=B3=C3=BA?=" out-u1 && + grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" out-u1 && grep "^Content-Type: text/plain; charset=UTF-8" out-u2 && - grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD_=C3=B3=C3=BA?=" out-u2 + grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" out-u2 ' test_expect_success 'rebase (U/U)' ' -- cgit v1.2.3 From 88961ef2589433044365213fab98de081a1ce70f Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 2 Jun 2007 03:27:42 +0200 Subject: Add basic test-script for git-submodule This test tries to verify basic sanity of git-submodule, i.e. that it is able to clone and update a submodule repository, that its status output is sane, and that it barfs when the submodule path is occupied during init. Signed-off-by: Lars Hjemli Signed-off-by: Junio C Hamano --- t/t7400-submodule-basic.sh | 143 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100755 t/t7400-submodule-basic.sh (limited to 't') diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh new file mode 100755 index 0000000000..6274729729 --- /dev/null +++ b/t/t7400-submodule-basic.sh @@ -0,0 +1,143 @@ +#!/bin/sh +# +# Copyright (c) 2007 Lars Hjemli +# + +test_description='Basic porcelain support for submodules + +This test tries to verify basic sanity of the init, update and status +subcommands of git-submodule. +' + +. ./test-lib.sh + +# +# Test setup: +# -create a repository in directory lib +# -add a couple of files +# -add directory lib to 'superproject', this creates a DIRLINK entry +# -add a couple of regular files to enable testing of submodule filtering +# -mv lib subrepo +# -add an entry to .gitmodules for path 'lib' +# +test_expect_success 'Prepare submodule testing' ' + mkdir lib && + cd lib && + git-init && + echo a >a && + git-add a && + git-commit -m "submodule commit 1" && + git-tag -a -m "rev-1" rev-1 && + rev1=$(git-rev-parse HEAD) && + if test -z "$rev1" + then + echo "[OOPS] submodule git-rev-parse returned nothing" + false + fi && + cd .. && + echo a >a && + echo z >z && + git-add a lib z && + git-commit -m "super commit 1" && + mv lib .subrepo && + GIT_CONFIG=.gitmodules git-config module.lib.url ./.subrepo +' + +test_expect_success 'status should only print one line' ' + lines=$(git-submodule status | wc -l) && + test $lines = 1 +' + +test_expect_success 'status should initially be "missing"' ' + git-submodule status | grep "^-$rev1" +' + +test_expect_success 'init should fail when path is used by a file' ' + echo "hello" >lib && + if git-submodule init + then + echo "[OOPS] init should have failed" + false + elif test -f lib && test "$(cat lib)" != "hello" + then + echo "[OOPS] init failed but lib file was molested" + false + else + rm lib + fi +' + +test_expect_success 'init should fail when path is used by a nonempty directory' ' + mkdir lib && + echo "hello" >lib/a && + if git-submodule init + then + echo "[OOPS] init should have failed" + false + elif test "$(cat lib/a)" != "hello" + then + echo "[OOPS] init failed but lib/a was molested" + false + else + rm lib/a + fi +' + +test_expect_success 'init should work when path is an empty dir' ' + rm -rf lib && + mkdir lib && + git-submodule init && + head=$(cd lib && git-rev-parse HEAD) && + if test -z "$head" + then + echo "[OOPS] Failed to obtain submodule head" + false + elif test "$head" != "$rev1" + then + echo "[OOPS] Submodule head is $head but should have been $rev1" + false + fi +' + +test_expect_success 'status should be "up-to-date" after init' ' + git-submodule status | grep "^ $rev1" +' + +test_expect_success 'status should be "modified" after submodule commit' ' + cd lib && + echo b >b && + git-add b && + git-commit -m "submodule commit 2" && + rev2=$(git-rev-parse HEAD) && + cd .. && + if test -z "$rev2" + then + echo "[OOPS] submodule git-rev-parse returned nothing" + false + fi && + git-submodule status | grep "^+$rev2" +' + +test_expect_success 'the --cached sha1 should be rev1' ' + git-submodule --cached status | grep "^+$rev1" +' + +test_expect_success 'update should checkout rev1' ' + git-submodule update && + head=$(cd lib && git-rev-parse HEAD) && + if test -z "$head" + then + echo "[OOPS] submodule git-rev-parse returned nothing" + false + elif test "$head" != "$rev1" + then + echo "[OOPS] init did not checkout correct head" + false + fi +' + +test_expect_success 'status should be "up-to-date" after update' ' + git-submodule status | grep "^ $rev1" +' + +test_done -- cgit v1.2.3 From 6f6826c52bb751450e2bfa28f07c817dfa5802d6 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sun, 3 Jun 2007 01:31:28 +0100 Subject: Add git-filter-branch This script is derived from Pasky's cg-admin-rewritehist. In fact, it _is_ the same script, minimally adapted to work without cogito. It _should_ be able to perform the same tasks, even if only relying on core-git programs. All the work is Pasky's, just the adaption is mine. Signed-off-by: Johannes Schindelin Hopefully-signed-off-by: Petr "cogito master" Baudis Signed-off-by: Junio C Hamano --- t/t7003-filter-branch.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 t/t7003-filter-branch.sh (limited to 't') diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh new file mode 100755 index 0000000000..9a4dae44f2 --- /dev/null +++ b/t/t7003-filter-branch.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +test_description='git-filter-branch' +. ./test-lib.sh + +make_commit () { + lower=$(echo $1 | tr A-Z a-z) + echo $lower > $lower + git add $lower + git commit -m $1 + git tag $1 +} + +test_expect_success 'setup' ' + make_commit A + make_commit B + git checkout -b branch B + make_commit D + make_commit E + git checkout master + make_commit C + git checkout branch + git merge C + git tag F + make_commit G + make_commit H +' + +H=$(git-rev-parse H) + +test_expect_success 'rewrite identically' ' + git-filter-branch H2 +' + +test_expect_success 'result is really identical' ' + test $H = $(git-rev-parse H2) +' + +test_expect_success 'rewrite, renaming a specific file' ' + git-filter-branch --tree-filter "mv d doh || :" H3 +' + +test_expect_success 'test that the file was renamed' ' + test d = $(git show H3:doh) +' + +test_done -- cgit v1.2.3 From 00f429af7bfaa6a9141bc0ac30995d4fae24836a Mon Sep 17 00:00:00 2001 From: Martin Koegler Date: Sun, 3 Jun 2007 17:42:44 +0200 Subject: gitweb: Handle non UTF-8 text better MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gitweb assumes that everything is in UTF-8. If a text contains invalid UTF-8 character sequences, the text must be in a different encoding. This commit introduces $fallback_encoding which would be used as input encoding if gitweb encounters text with is not valid UTF-8. Add basic test for this in t/t9500-gitweb-standalone-no-errors.sh Signed-off-by: Martin Koegler Signed-off-by: Jakub Narebski Tested-by: Alexandre Julliard Tested-by: Ismail Dönmez Signed-off-by: Junio C Hamano --- t/t9500-gitweb-standalone-no-errors.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 't') diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh index b92ab63312..44ae503b99 100755 --- a/t/t9500-gitweb-standalone-no-errors.sh +++ b/t/t9500-gitweb-standalone-no-errors.sh @@ -487,4 +487,32 @@ test_expect_success \ 'gitweb_run "p=.git;a=atom"' test_debug 'cat gitweb.log' +# ---------------------------------------------------------------------- +# encoding/decoding + +test_expect_success \ + 'encode(commit): utf8' \ + '. ../t3901-utf8.txt && + echo "UTF-8" >> file && + git add file && + git commit -F ../t3900/1-UTF-8.txt && + gitweb_run "p=.git;a=commit"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'encode(commit): iso-8859-1' \ + '. ../t3901-8859-1.txt && + echo "ISO-8859-1" >> file && + git add file && + git config i18n.commitencoding ISO-8859-1 && + git commit -F ../t3900/ISO-8859-1.txt && + git config --unset i18n.commitencoding && + gitweb_run "p=.git;a=commit"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'encode(log): utf-8 and iso-8859-1' \ + 'gitweb_run "p=.git;a=log"' +test_debug 'cat gitweb.log' + test_done -- cgit v1.2.3 From 9f30855d0ff5206e85e45f0307be9d18ffda41d3 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 5 Jun 2007 03:36:49 +0100 Subject: merge-recursive: refuse to merge binary files Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t6024-recursive-merge.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 't') diff --git a/t/t6024-recursive-merge.sh b/t/t6024-recursive-merge.sh index a398556137..058db9cc52 100755 --- a/t/t6024-recursive-merge.sh +++ b/t/t6024-recursive-merge.sh @@ -81,4 +81,18 @@ EOF test_expect_success "virtual trees were processed" "git diff expect out" +git reset --hard +test_expect_success 'refuse to merge binary files' ' + printf "\0" > binary-file && + git add binary-file && + git commit -m binary && + git checkout G && + printf "\0\0" > binary-file && + git add binary-file && + git commit -m binary2 && + ! git merge F > merge.out 2> merge.err && + grep "Cannot merge binary files: HEAD:binary-file vs. F:binary-file" \ + merge.err +' + test_done -- cgit v1.2.3 From 5771907a5745799c559ff21ccfcabfd21cc23b36 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 5 Jun 2007 03:37:13 +0100 Subject: git-merge-file: refuse to merge binary files Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t6023-merge-file.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 't') diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh index c76fccfb5a..1decbfba63 100755 --- a/t/t6023-merge-file.sh +++ b/t/t6023-merge-file.sh @@ -134,5 +134,10 @@ EOF test_expect_success "expected conflict markers" "git diff expect out" +test_expect_success 'binary files cannot be merged' ' + ! git merge-file -p orig.txt ../test4012.png new1.txt 2> merge.err && + grep "Cannot merge binary files" merge.err +' + test_done -- cgit v1.2.3 From aee078bf81d5810cb461e86950f6807d2d45befa Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 5 Jun 2007 00:07:31 -0700 Subject: t7003: make test repeatable Signed-off-by: Junio C Hamano --- t/t7003-filter-branch.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't') diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index 9a4dae44f2..c82ff1d6e9 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -7,6 +7,7 @@ make_commit () { lower=$(echo $1 | tr A-Z a-z) echo $lower > $lower git add $lower + test_tick git commit -m $1 git tag $1 } -- cgit v1.2.3 From 11f68d908229d1e954009805cd139a89872b9208 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 6 Jun 2007 01:10:14 -0700 Subject: git-branch --track: fix tracking branch computation. The original code did not take hierarchical branch names into account at all. Tested-by: Gerrit Pape Signed-off-by: Junio C Hamano --- t/t3200-branch.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 't') diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 828d553a4b..6f6d8844e8 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -136,8 +136,8 @@ test_expect_success 'test tracking setup (non-wildcard, not matching)' \ git-config remote.local.fetch refs/heads/s:refs/remotes/local/s && (git-show-ref -q refs/remotes/local/master || git-fetch local) && git-branch --track my5 local/master && - ! test $(git-config branch.my5.remote) = local && - ! test $(git-config branch.my5.merge) = refs/heads/master' + ! test "$(git-config branch.my5.remote)" = local && + ! test "$(git-config branch.my5.merge)" = refs/heads/master' test_expect_success 'test tracking setup via config' \ 'git-config branch.autosetupmerge true && @@ -155,14 +155,22 @@ test_expect_success 'test overriding tracking setup via --no-track' \ (git-show-ref -q refs/remotes/local/master || git-fetch local) && git-branch --no-track my2 local/master && git-config branch.autosetupmerge false && - ! test $(git-config branch.my2.remote) = local && - ! test $(git-config branch.my2.merge) = refs/heads/master' + ! test "$(git-config branch.my2.remote)" = local && + ! test "$(git-config branch.my2.merge)" = refs/heads/master' test_expect_success 'test local tracking setup' \ 'git branch --track my6 s && test $(git-config branch.my6.remote) = . && test $(git-config branch.my6.merge) = refs/heads/s' +test_expect_success 'test tracking setup via --track but deeper' \ + 'git-config remote.local.url . && + git-config remote.local.fetch refs/heads/*:refs/remotes/local/* && + (git-show-ref -q refs/remotes/local/o/o || git-fetch local) && + git-branch --track my7 local/o/o && + test "$(git-config branch.my7.remote)" = local && + test "$(git-config branch.my7.merge)" = refs/heads/o/o' + # Keep this test last, as it changes the current branch cat >expect < 1117150200 +0000 branch: Created from master -- cgit v1.2.3 From 211b7f19c7b046a6cadd36d54c549e4f335f0519 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Wed, 6 Jun 2007 11:13:02 +0200 Subject: git-submodule: clone during update, not during init This teaches 'git-submodule init' to register submodule paths and urls in .git/config instead of actually cloning them. The cloning is now handled as part of 'git-submodule update'. With this change it is possible to specify preferred/alternate urls for the submodules in .git/config before the submodules are cloned. Signed-off-by: Lars Hjemli Signed-off-by: Junio C Hamano --- t/t7400-submodule-basic.sh | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 't') diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 6274729729..3940433b8f 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -40,7 +40,7 @@ test_expect_success 'Prepare submodule testing' ' git-add a lib z && git-commit -m "super commit 1" && mv lib .subrepo && - GIT_CONFIG=.gitmodules git-config module.lib.url ./.subrepo + GIT_CONFIG=.gitmodules git-config module.lib.url git://example.com/lib.git ' test_expect_success 'status should only print one line' ' @@ -52,41 +52,55 @@ test_expect_success 'status should initially be "missing"' ' git-submodule status | grep "^-$rev1" ' -test_expect_success 'init should fail when path is used by a file' ' +test_expect_success 'init should register submodule url in .git/config' ' + git-submodule init && + url=$(git-config submodule.lib.url) && + if test "$url" != "git://example.com/lib.git" + then + echo "[OOPS] init succeeded but submodule url is wrong" + false + elif ! git-config submodule.lib.url ./.subrepo + then + echo "[OOPS] init succeeded but update of url failed" + false + fi +' + +test_expect_success 'update should fail when path is used by a file' ' echo "hello" >lib && - if git-submodule init + if git-submodule update then - echo "[OOPS] init should have failed" + echo "[OOPS] update should have failed" false elif test -f lib && test "$(cat lib)" != "hello" then - echo "[OOPS] init failed but lib file was molested" + echo "[OOPS] update failed but lib file was molested" false else rm lib fi ' -test_expect_success 'init should fail when path is used by a nonempty directory' ' +test_expect_success 'update should fail when path is used by a nonempty directory' ' mkdir lib && echo "hello" >lib/a && - if git-submodule init + if git-submodule update then - echo "[OOPS] init should have failed" + echo "[OOPS] update should have failed" false elif test "$(cat lib/a)" != "hello" then - echo "[OOPS] init failed but lib/a was molested" + echo "[OOPS] update failed but lib/a was molested" false else rm lib/a fi ' -test_expect_success 'init should work when path is an empty dir' ' +test_expect_success 'update should work when path is an empty dir' ' rm -rf lib && mkdir lib && - git-submodule init && + git-submodule update && head=$(cd lib && git-rev-parse HEAD) && if test -z "$head" then @@ -99,7 +113,7 @@ test_expect_success 'init should work when path is an empty dir' ' fi ' -test_expect_success 'status should be "up-to-date" after init' ' +test_expect_success 'status should be "up-to-date" after update' ' git-submodule status | grep "^ $rev1" ' -- cgit v1.2.3 From 9840906026be807d0882f96396de3a3cdb9fb43e Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 5 Jun 2007 16:58:13 +0100 Subject: filter-branch: fix behaviour of '-k' The option '-k' says that the given commit and _all_ of its ancestors are kept as-is. However, if a to-be-rewritten commit branched from an ancestor of an ancestor of a commit given with '-k', filter-branch would fail. Example: A - B \ C If filter-branch was called with '-k B -s C', it would actually keep B (and A as its parent), but would rewrite C, and its parent. Noticed by Johannes Sixt. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7003-filter-branch.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 't') diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index c82ff1d6e9..6e2be5be0e 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -45,4 +45,13 @@ test_expect_success 'test that the file was renamed' ' test d = $(git show H3:doh) ' +git tag oldD H3~4 +test_expect_success 'rewrite one branch, keeping a side branch' ' + git-filter-branch --tree-filter "mv b boh || :" -k D -s oldD modD +' + +test_expect_success 'common ancestor is still common (unchanged)' ' + test "$(git-merge-base modD D)" = "$(git-rev-parse B)" +' + test_done -- cgit v1.2.3 From 2766ce28150597677bb91c424e6033a298c71510 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Wed, 6 Jun 2007 09:43:41 +0200 Subject: filter-branch: Use rev-list arguments to specify revision ranges. A subset of commits in a branch used to be specified by options (-k, -r) as well as the branch tip itself (-s). It is more natural (for git users) to specify revision ranges like 'master..next' instead. This makes it so. If no range is specified it defaults to 'HEAD'. As a consequence, the new name of the filtered branch must be the first non-option argument. All remaining arguments are passed to 'git rev-list' unmodified. The tip of the branch that gets filtered is implied: It is the first commit that git rev-list would print for the specified range. Signed-off-by: Johannes Sixt Acked-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7003-filter-branch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index 6e2be5be0e..3739cb191d 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -47,7 +47,7 @@ test_expect_success 'test that the file was renamed' ' git tag oldD H3~4 test_expect_success 'rewrite one branch, keeping a side branch' ' - git-filter-branch --tree-filter "mv b boh || :" -k D -s oldD modD + git-filter-branch --tree-filter "mv b boh || :" modD D..oldD ' test_expect_success 'common ancestor is still common (unchanged)' ' -- cgit v1.2.3 From 3a86f36bedab00446a5b9117981bce25120adfb1 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 6 Jun 2007 19:57:40 +0100 Subject: t5000: skip ZIP tests if unzip was not found Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t5000-tar-tree.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 't') diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index e223c074f0..5500505d8b 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -108,6 +108,13 @@ test_expect_success \ 'git-archive --format=zip' \ 'git-archive --format=zip HEAD >d.zip' +$UNZIP -v 2>/dev/null +if [ $? -eq 127 ]; then + echo "Skipping ZIP tests, because unzip was not found" + test_done + exit +fi + test_expect_success \ 'extract ZIP archive' \ '(mkdir d && cd d && $UNZIP ../d.zip)' -- cgit v1.2.3 From dace6e44f6599495eb4317efa90885b6eba5c62e Mon Sep 17 00:00:00 2001 From: Matthias Lederhofer Date: Wed, 6 Jun 2007 09:01:21 +0200 Subject: test git rev-parse Signed-off-by: Matthias Lederhofer Signed-off-by: Junio C Hamano --- t/t1500-rev-parse.sh | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 t/t1500-rev-parse.sh (limited to 't') diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh new file mode 100755 index 0000000000..66b0e581c8 --- /dev/null +++ b/t/t1500-rev-parse.sh @@ -0,0 +1,72 @@ +#!/bin/sh + +test_description='test git rev-parse' +. ./test-lib.sh + +test_rev_parse() { + name=$1 + shift + + test_expect_success "$name: is-bare-repository" \ + "test '$1' = \"\$(git rev-parse --is-bare-repository)\"" + shift + [ $# -eq 0 ] && return + + test_expect_success "$name: is-inside-git-dir" \ + "test '$1' = \"\$(git rev-parse --is-inside-git-dir)\"" + shift + [ $# -eq 0 ] && return + + test_expect_success "$name: prefix" \ + "test '$1' = \"\$(git rev-parse --show-prefix)\"" + shift + [ $# -eq 0 ] && return +} + +test_rev_parse toplevel false false '' + +cd .git || exit 1 +test_rev_parse .git/ false true .git/ +cd objects || exit 1 +test_rev_parse .git/objects/ false true .git/objects/ +cd ../.. || exit 1 + +mkdir -p sub/dir || exit 1 +cd sub/dir || exit 1 +test_rev_parse subdirectory false false sub/dir/ +cd ../.. || exit 1 + +git config core.bare true +test_rev_parse 'core.bare = true' true + +git config --unset core.bare +test_rev_parse 'core.bare undefined' false + +mkdir work || exit 1 +cd work || exit 1 +export GIT_DIR=../.git +export GIT_CONFIG="$GIT_DIR"/config + +git config core.bare false +test_rev_parse 'GIT_DIR=../.git, core.bare = false' false false '' + +git config core.bare true +test_rev_parse 'GIT_DIR=../.git, core.bare = true' true + +git config --unset core.bare +test_rev_parse 'GIT_DIR=../.git, core.bare undefined' false false '' + +mv ../.git ../repo.git || exit 1 +export GIT_DIR=../repo.git +export GIT_CONFIG="$GIT_DIR"/config + +git config core.bare false +test_rev_parse 'GIT_DIR=../repo.git, core.bare = false' false false '' + +git config core.bare true +test_rev_parse 'GIT_DIR=../repo.git, core.bare = true' true + +git config --unset core.bare +test_rev_parse 'GIT_DIR=../repo.git, core.bare undefined' true + +test_done -- cgit v1.2.3 From 892c41b98ae2e6baf3aa13901cb10db9ac67d2f3 Mon Sep 17 00:00:00 2001 From: Matthias Lederhofer Date: Wed, 6 Jun 2007 09:10:42 +0200 Subject: introduce GIT_WORK_TREE to specify the work tree setup_gdg is used as abbreviation for setup_git_directory_gently. The work tree can be specified using the environment variable GIT_WORK_TREE and the config option core.worktree (the environment variable has precendence over the config option). Additionally there is a command line option --work-tree which sets the environment variable. setup_gdg does the following now: GIT_DIR unspecified repository in .git directory parent directory of the .git directory is used as work tree, GIT_WORK_TREE is ignored GIT_DIR unspecified repository in cwd GIT_DIR is set to cwd see the cases with GIT_DIR specified what happens next and also see the note below GIT_DIR specified GIT_WORK_TREE/core.worktree unspecified cwd is used as work tree GIT_DIR specified GIT_WORK_TREE/core.worktree specified the specified work tree is used Note on the case where GIT_DIR is unspecified and repository is in cwd: GIT_WORK_TREE is used but is_inside_git_dir is always true. I did it this way because setup_gdg might be called multiple times (e.g. when doing alias expansion) and in successive calls setup_gdg should do the same thing every time. Meaning of is_bare/is_inside_work_tree/is_inside_git_dir: (1) is_bare_repository A repository is bare if core.bare is true or core.bare is unspecified and the name suggests it is bare (directory not named .git). The bare option disables a few protective checks which are useful with a working tree. Currently this changes if a repository is bare: updates of HEAD are allowed git gc packs the refs the reflog is disabled by default (2) is_inside_work_tree True if the cwd is inside the associated working tree (if there is one), false otherwise. (3) is_inside_git_dir True if the cwd is inside the git directory, false otherwise. Before this patch is_inside_git_dir was always true for bare repositories. When setup_gdg finds a repository git_config(git_default_config) is always called. This ensure that is_bare_repository makes use of core.bare and does not guess even though core.bare is specified. inside_work_tree and inside_git_dir are set if setup_gdg finds a repository. The is_inside_work_tree and is_inside_git_dir functions will die if they are called before a successful call to setup_gdg. Signed-off-by: Matthias Lederhofer Signed-off-by: Junio C Hamano --- t/test-lib.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't') diff --git a/t/test-lib.sh b/t/test-lib.sh index dee3ad7621..b61e1d598d 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -26,6 +26,7 @@ GIT_COMMITTER_EMAIL=committer@example.com GIT_COMMITTER_NAME='C O Mitter' unset GIT_DIFF_OPTS unset GIT_DIR +unset GIT_WORK_TREE unset GIT_EXTERNAL_DIFF unset GIT_INDEX_FILE unset GIT_OBJECT_DIRECTORY -- cgit v1.2.3 From 6c56049ff6b0f59df8a2e23bc83e10c50d9d0218 Mon Sep 17 00:00:00 2001 From: Matthias Lederhofer Date: Wed, 6 Jun 2007 09:13:26 +0200 Subject: extend rev-parse test for --is-inside-work-tree Signed-off-by: Matthias Lederhofer Signed-off-by: Junio C Hamano --- t/t1500-rev-parse.sh | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 't') diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh index 66b0e581c8..ec4996637d 100755 --- a/t/t1500-rev-parse.sh +++ b/t/t1500-rev-parse.sh @@ -17,30 +17,35 @@ test_rev_parse() { shift [ $# -eq 0 ] && return + test_expect_success "$name: is-inside-work-tree" \ + "test '$1' = \"\$(git rev-parse --is-inside-work-tree)\"" + shift + [ $# -eq 0 ] && return + test_expect_success "$name: prefix" \ "test '$1' = \"\$(git rev-parse --show-prefix)\"" shift [ $# -eq 0 ] && return } -test_rev_parse toplevel false false '' +test_rev_parse toplevel false false true '' cd .git || exit 1 -test_rev_parse .git/ false true .git/ +test_rev_parse .git/ false true true .git/ cd objects || exit 1 -test_rev_parse .git/objects/ false true .git/objects/ +test_rev_parse .git/objects/ false true true .git/objects/ cd ../.. || exit 1 mkdir -p sub/dir || exit 1 cd sub/dir || exit 1 -test_rev_parse subdirectory false false sub/dir/ +test_rev_parse subdirectory false false true sub/dir/ cd ../.. || exit 1 git config core.bare true -test_rev_parse 'core.bare = true' true +test_rev_parse 'core.bare = true' true false true git config --unset core.bare -test_rev_parse 'core.bare undefined' false +test_rev_parse 'core.bare undefined' false false true mkdir work || exit 1 cd work || exit 1 @@ -48,25 +53,25 @@ export GIT_DIR=../.git export GIT_CONFIG="$GIT_DIR"/config git config core.bare false -test_rev_parse 'GIT_DIR=../.git, core.bare = false' false false '' +test_rev_parse 'GIT_DIR=../.git, core.bare = false' false false true '' git config core.bare true -test_rev_parse 'GIT_DIR=../.git, core.bare = true' true +test_rev_parse 'GIT_DIR=../.git, core.bare = true' true false true '' git config --unset core.bare -test_rev_parse 'GIT_DIR=../.git, core.bare undefined' false false '' +test_rev_parse 'GIT_DIR=../.git, core.bare undefined' false false true '' mv ../.git ../repo.git || exit 1 export GIT_DIR=../repo.git export GIT_CONFIG="$GIT_DIR"/config git config core.bare false -test_rev_parse 'GIT_DIR=../repo.git, core.bare = false' false false '' +test_rev_parse 'GIT_DIR=../repo.git, core.bare = false' false false true '' git config core.bare true -test_rev_parse 'GIT_DIR=../repo.git, core.bare = true' true +test_rev_parse 'GIT_DIR=../repo.git, core.bare = true' true false true '' git config --unset core.bare -test_rev_parse 'GIT_DIR=../repo.git, core.bare undefined' true +test_rev_parse 'GIT_DIR=../repo.git, core.bare undefined' true false true '' test_done -- cgit v1.2.3 From 3ae4a867d37237e8f8156be1409a4a992bd37fb0 Mon Sep 17 00:00:00 2001 From: Matthias Lederhofer Date: Wed, 6 Jun 2007 09:14:25 +0200 Subject: test GIT_WORK_TREE Signed-off-by: Matthias Lederhofer Signed-off-by: Junio C Hamano --- t/t1501-worktree.sh | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100755 t/t1501-worktree.sh (limited to 't') diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh new file mode 100755 index 0000000000..aadeeab9ab --- /dev/null +++ b/t/t1501-worktree.sh @@ -0,0 +1,92 @@ +#!/bin/sh + +test_description='test separate work tree' +. ./test-lib.sh + +test_rev_parse() { + name=$1 + shift + + test_expect_success "$name: is-bare-repository" \ + "test '$1' = \"\$(git rev-parse --is-bare-repository)\"" + shift + [ $# -eq 0 ] && return + + test_expect_success "$name: is-inside-git-dir" \ + "test '$1' = \"\$(git rev-parse --is-inside-git-dir)\"" + shift + [ $# -eq 0 ] && return + + test_expect_success "$name: is-inside-work-tree" \ + "test '$1' = \"\$(git rev-parse --is-inside-work-tree)\"" + shift + [ $# -eq 0 ] && return + + test_expect_success "$name: prefix" \ + "test '$1' = \"\$(git rev-parse --show-prefix)\"" + shift + [ $# -eq 0 ] && return +} + +mkdir -p work/sub/dir || exit 1 +mv .git repo.git || exit 1 + +say "core.worktree = relative path" +export GIT_DIR=repo.git +export GIT_CONFIG=$GIT_DIR/config +unset GIT_WORK_TREE +git config core.worktree ../work +test_rev_parse 'outside' false false false +cd work || exit 1 +export GIT_DIR=../repo.git +export GIT_CONFIG=$GIT_DIR/config +test_rev_parse 'inside' false false true '' +cd sub/dir || exit 1 +export GIT_DIR=../../../repo.git +export GIT_CONFIG=$GIT_DIR/config +test_rev_parse 'subdirectory' false false true sub/dir/ +cd ../../.. || exit 1 + +say "core.worktree = absolute path" +export GIT_DIR=$(pwd)/repo.git +export GIT_CONFIG=$GIT_DIR/config +git config core.worktree "$(pwd)/work" +test_rev_parse 'outside' false false false +cd work || exit 1 +test_rev_parse 'inside' false false true '' +cd sub/dir || exit 1 +test_rev_parse 'subdirectory' false false true sub/dir/ +cd ../../.. || exit 1 + +say "GIT_WORK_TREE=relative path (override core.worktree)" +export GIT_DIR=$(pwd)/repo.git +export GIT_CONFIG=$GIT_DIR/config +git config core.worktree non-existent +export GIT_WORK_TREE=work +test_rev_parse 'outside' false false false +cd work || exit 1 +export GIT_WORK_TREE=. +test_rev_parse 'inside' false false true '' +cd sub/dir || exit 1 +export GIT_WORK_TREE=../.. +test_rev_parse 'subdirectory' false false true sub/dir/ +cd ../../.. || exit 1 + +mv work repo.git/work + +say "GIT_WORK_TREE=absolute path, work tree below git dir" +export GIT_DIR=$(pwd)/repo.git +export GIT_CONFIG=$GIT_DIR/config +export GIT_WORK_TREE=$(pwd)/repo.git/work +test_rev_parse 'outside' false false false +cd repo.git || exit 1 +test_rev_parse 'in repo.git' false true false +cd objects || exit 1 +test_rev_parse 'in repo.git/objects' false true false +cd ../work || exit 1 +test_rev_parse 'in repo.git/work' false false true '' +cd sub/dir || exit 1 +test_rev_parse 'in repo.git/sub/dir' false false true sub/dir/ +cd ../../../.. || exit 1 + +test_done -- cgit v1.2.3 From defe13a24a254f19596b8008095829068e742f9c Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Wed, 6 Jun 2007 16:39:05 -0700 Subject: Fix clone to setup the origin if its name ends with .git The problem is visible when cloning a local repo. The cloned repository will have the origin url setup incorrectly: the origin name will be copied verbatim in origin url of the cloned repository. Normally, the name is to be expanded into absolute path. Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- t/t5701-clone-local.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 t/t5701-clone-local.sh (limited to 't') diff --git a/t/t5701-clone-local.sh b/t/t5701-clone-local.sh new file mode 100755 index 0000000000..b0933274db --- /dev/null +++ b/t/t5701-clone-local.sh @@ -0,0 +1,46 @@ +#!/bin/sh + +test_description='test local clone' +. ./test-lib.sh + +D=`pwd` + +test_expect_success 'preparing origin repository' ' + : >file && git add . && git commit -m1 && + git clone --bare . a.git && + git clone --bare . x +' + +test_expect_success 'local clone without .git suffix' ' + cd "$D" && + git clone -l -s a b && + cd b && + git fetch +' + +test_expect_success 'local clone with .git suffix' ' + cd "$D" && + git clone -l -s a.git c && + cd c && + git fetch +' + +test_expect_success 'local clone from x' ' + cd "$D" && + git clone -l -s x y && + cd y && + git fetch +' + +test_expect_success 'local clone from x.git that does not exist' ' + cd "$D" && + if git clone -l -s x.git z + then + echo "Oops, should have failed" + false + else + echo happy + fi +' + +test_done -- cgit v1.2.3 From a6080a0a44d5ead84db3dabbbc80e82df838533d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 7 Jun 2007 00:04:01 -0700 Subject: War on whitespace This uses "git-apply --whitespace=strip" to fix whitespace errors that have crept in to our source files over time. There are a few files that need to have trailing whitespaces (most notably, test vectors). The results still passes the test, and build result in Documentation/ area is unchanged. Signed-off-by: Junio C Hamano --- t/Makefile | 1 - t/lib-read-tree-m-3way.sh | 2 +- t/t0000-basic.sh | 2 +- t/t1200-tutorial.sh | 1 - t/t1300-repo-config.sh | 1 - t/t2000-checkout-cache-clash.sh | 2 -- t/t2001-checkout-cache-clash.sh | 1 - t/t3030-merge-recursive.sh | 1 - t/t3403-rebase-skip.sh | 1 - t/t4006-diff-mode.sh | 1 - t/t4100-apply-stat.sh | 1 - t/t4110-apply-scan.sh | 1 - t/t4112-apply-renames.sh | 16 ++++++++-------- t/t4118-apply-empty-context.sh | 1 - t/t4119-apply-config.sh | 2 +- t/t4121-apply-diffs.sh | 1 - t/t4122-apply-symlink-inside.sh | 1 - t/t4200-rerere.sh | 2 -- t/t5400-send-pack.sh | 2 +- t/t5520-pull.sh | 1 - t/t5710-info-alternate.sh | 1 - t/t6000lib.sh | 16 ++++++++-------- t/t6002-rev-list-bisect.sh | 8 ++++---- t/t6021-merge-criss-cross.sh | 2 +- t/t6023-merge-file.sh | 1 - t/t6030-bisect-porcelain.sh | 1 - t/t6101-rev-parse-parents.sh | 1 - t/t9107-git-svn-migrate.sh | 1 - t/t9111/svnsync.dump | 2 -- t/test-lib.sh | 2 +- 30 files changed, 26 insertions(+), 50 deletions(-) (limited to 't') diff --git a/t/Makefile b/t/Makefile index 19e38508a7..b25caca887 100644 --- a/t/Makefile +++ b/t/Makefile @@ -28,4 +28,3 @@ full-svn-test: .PHONY: $(T) clean .NOTPARALLEL: - diff --git a/t/lib-read-tree-m-3way.sh b/t/lib-read-tree-m-3way.sh index d195603dfa..586df2113f 100644 --- a/t/lib-read-tree-m-3way.sh +++ b/t/lib-read-tree-m-3way.sh @@ -87,7 +87,7 @@ test_expect_success \ test_expect_success \ 'recording branch A tree' \ 'tree_A=$(git-write-tree)' - + ################################################################ # Branch B # Start from O diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index 186de70243..8bfe8320ea 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -37,7 +37,7 @@ fi find .git/objects -type f -print >should-be-empty test_expect_success \ '.git/objects should be empty after git-init in an empty repo.' \ - 'cmp -s /dev/null should-be-empty' + 'cmp -s /dev/null should-be-empty' # also it should have 2 subdirectories; no fan-out anymore, pack, and info. # 3 is counting "objects" itself diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh index ca2c30f7af..d3f8358485 100755 --- a/t/t1200-tutorial.sh +++ b/t/t1200-tutorial.sh @@ -159,4 +159,3 @@ test_expect_success 'git prune-packed' 'git prune-packed' test_expect_failure '-> only packed objects' 'find -type f .git/objects/[0-9a-f][0-9a-f]' test_done - diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 3f3fd2d7f7..7731fa72ce 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -514,4 +514,3 @@ git config --list > result test_expect_success 'value continued on next line' 'cmp result expect' test_done - diff --git a/t/t2000-checkout-cache-clash.sh b/t/t2000-checkout-cache-clash.sh index 03ea4dece4..d556b41f13 100755 --- a/t/t2000-checkout-cache-clash.sh +++ b/t/t2000-checkout-cache-clash.sh @@ -49,5 +49,3 @@ test_expect_success \ 'test -f path0 && test -d path1 && test -f path1/file1' test_done - - diff --git a/t/t2001-checkout-cache-clash.sh b/t/t2001-checkout-cache-clash.sh index 0dcab8f1de..b895a0fe36 100755 --- a/t/t2001-checkout-cache-clash.sh +++ b/t/t2001-checkout-cache-clash.sh @@ -84,4 +84,3 @@ test_expect_success \ test ! -h path1/file1 && test -f path1/file1' test_done - diff --git a/t/t3030-merge-recursive.sh b/t/t3030-merge-recursive.sh index 86ee2b0bd3..607f57ff94 100755 --- a/t/t3030-merge-recursive.sh +++ b/t/t3030-merge-recursive.sh @@ -525,4 +525,3 @@ test_expect_success 'reset and bind merge' ' ' test_done - diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh index 977c498f00..9e11ed295d 100755 --- a/t/t3403-rebase-skip.sh +++ b/t/t3403-rebase-skip.sh @@ -54,4 +54,3 @@ test_expect_success 'merge and reference trees equal' \ test_debug 'gitk --all & sleep 1' test_done - diff --git a/t/t4006-diff-mode.sh b/t/t4006-diff-mode.sh index e72c6fd1b4..b8acca1813 100755 --- a/t/t4006-diff-mode.sh +++ b/t/t4006-diff-mode.sh @@ -41,4 +41,3 @@ test_expect_success \ 'git diff expected check' test_done - diff --git a/t/t4100-apply-stat.sh b/t/t4100-apply-stat.sh index 7b81c32e57..c23341feb5 100755 --- a/t/t4100-apply-stat.sh +++ b/t/t4100-apply-stat.sh @@ -44,4 +44,3 @@ test_expect_success \ git diff ../t4100/t-apply-7.expect current' test_done - diff --git a/t/t4110-apply-scan.sh b/t/t4110-apply-scan.sh index 005f744816..9faef0d66e 100755 --- a/t/t4110-apply-scan.sh +++ b/t/t4110-apply-scan.sh @@ -98,4 +98,3 @@ test_expect_success "S = cmp" \ 'cmp apply.txt patch.txt' test_done - diff --git a/t/t4112-apply-renames.sh b/t/t4112-apply-renames.sh index 69e9603c78..9baf810bee 100755 --- a/t/t4112-apply-renames.sh +++ b/t/t4112-apply-renames.sh @@ -49,10 +49,10 @@ copy to include/arch/cris/klibc/archsetjmp.h - * arch/x86_64/include/klibc/archsetjmp.h + * arch/cris/include/klibc/archsetjmp.h */ - + #ifndef _KLIBC_ARCHSETJMP_H #define _KLIBC_ARCHSETJMP_H - + struct __jmp_buf { - unsigned long __rbx; - unsigned long __rsp; @@ -74,9 +74,9 @@ copy to include/arch/cris/klibc/archsetjmp.h + unsigned long __sp; + unsigned long __srp; }; - + typedef struct __jmp_buf jmp_buf[1]; - + -#endif /* _SETJMP_H */ +#endif /* _KLIBC_ARCHSETJMP_H */ diff --git a/klibc/arch/x86_64/include/klibc/archsetjmp.h b/include/arch/m32r/klibc/archsetjmp.h @@ -90,10 +90,10 @@ rename to include/arch/m32r/klibc/archsetjmp.h - * arch/x86_64/include/klibc/archsetjmp.h + * arch/m32r/include/klibc/archsetjmp.h */ - + #ifndef _KLIBC_ARCHSETJMP_H #define _KLIBC_ARCHSETJMP_H - + struct __jmp_buf { - unsigned long __rbx; - unsigned long __rsp; @@ -108,9 +108,9 @@ rename to include/arch/m32r/klibc/archsetjmp.h unsigned long __r15; - unsigned long __rip; }; - + typedef struct __jmp_buf jmp_buf[1]; - + -#endif /* _SETJMP_H */ +#endif /* _KLIBC_ARCHSETJMP_H */ EOF diff --git a/t/t4118-apply-empty-context.sh b/t/t4118-apply-empty-context.sh index 27cc6f2b88..dd88e81e04 100755 --- a/t/t4118-apply-empty-context.sh +++ b/t/t4118-apply-empty-context.sh @@ -53,4 +53,3 @@ test_expect_success 'apply --apply' ' ' test_done - diff --git a/t/t4119-apply-config.sh b/t/t4119-apply-config.sh index 620a9207bf..edae7056e4 100755 --- a/t/t4119-apply-config.sh +++ b/t/t4119-apply-config.sh @@ -24,7 +24,7 @@ cat >gpatch.file <<\EOF && +++ file1+ 2007-02-21 01:07:44.000000000 -0800 @@ -1 +1 @@ -A -+B ++B EOF sed -e 's|file1|sub/&|' gpatch.file >gpatch-sub.file && diff --git a/t/t4121-apply-diffs.sh b/t/t4121-apply-diffs.sh index 2b2f1eda21..b95b89c341 100755 --- a/t/t4121-apply-diffs.sh +++ b/t/t4121-apply-diffs.sh @@ -30,4 +30,3 @@ test_expect_success \ '( git diff test~2 test~1; git diff test~1 test~0 )| git apply' test_done - diff --git a/t/t4122-apply-symlink-inside.sh b/t/t4122-apply-symlink-inside.sh index 3ddfe64b02..841773f75f 100755 --- a/t/t4122-apply-symlink-inside.sh +++ b/t/t4122-apply-symlink-inside.sh @@ -53,4 +53,3 @@ test_expect_success 'check result' ' ' test_done - diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh index c64ebbb2e9..a46d7f74be 100755 --- a/t/t4200-rerere.sh +++ b/t/t4200-rerere.sh @@ -148,5 +148,3 @@ test_expect_success 'old records rest in peace' \ "test ! -f $rr/preimage && test ! -f $rr2/preimage" test_done - - diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh index 477b267599..4eaea8f336 100755 --- a/t/t5400-send-pack.sh +++ b/t/t5400-send-pack.sh @@ -66,7 +66,7 @@ test_expect_success 'pack the destination repository' ' ' test_expect_success \ - 'pushing rewound head should not barf but require --force' ' + 'pushing rewound head should not barf but require --force' ' # should not fail but refuse to update. if git-send-pack ./victim/.git/ master then diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 243212d3da..93eaf2c154 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -54,4 +54,3 @@ test_expect_success 'the default remote . should not break explicit pull' ' ' test_done - diff --git a/t/t5710-info-alternate.sh b/t/t5710-info-alternate.sh index 2f8e97cb7e..699df6ebd8 100755 --- a/t/t5710-info-alternate.sh +++ b/t/t5710-info-alternate.sh @@ -104,4 +104,3 @@ test_valid_repo' cd "$base_dir" test_done - diff --git a/t/t6000lib.sh b/t/t6000lib.sh index d40262159b..d548bf8026 100755 --- a/t/t6000lib.sh +++ b/t/t6000lib.sh @@ -17,17 +17,17 @@ unique_commit() _text=$1 _tree=$2 shift 2 - echo $_text | git-commit-tree $(tag $_tree) "$@" + echo $_text | git-commit-tree $(tag $_tree) "$@" } # Save the output of a command into the tag specified. Prepend # a substitution script for the tag onto the front of sed.script save_tag() { - _tag=$1 + _tag=$1 [ -n "$_tag" ] || error "usage: save_tag tag commit-args ..." shift 1 - "$@" >.git/refs/tags/$_tag + "$@" >.git/refs/tags/$_tag echo "s/$(tag $_tag)/$_tag/g" > sed.script.tmp cat sed.script >> sed.script.tmp @@ -35,7 +35,7 @@ save_tag() mv sed.script.tmp sed.script } -# Replace unhelpful sha1 hashses with their symbolic equivalents +# Replace unhelpful sha1 hashses with their symbolic equivalents entag() { sed -f sed.script @@ -62,7 +62,7 @@ as_author() commit_date() { _commit=$1 - git-cat-file commit $_commit | sed -n "s/^committer .*> \([0-9]*\) .*/\1/p" + git-cat-file commit $_commit | sed -n "s/^committer .*> \([0-9]*\) .*/\1/p" } on_committer_date() @@ -103,14 +103,14 @@ name_from_description() # Execute the test described by the first argument, by eval'ing # command line specified in the 2nd argument. Check the status code -# is zero and that the output matches the stream read from +# is zero and that the output matches the stream read from # stdin. test_output_expect_success() -{ +{ _description=$1 _test=$2 [ $# -eq 2 ] || error "usage: test_output_expect_success description test < $_name.expected - test_expect_success "$_description" "check_output $_name \"$_test\"" + test_expect_success "$_description" "check_output $_name \"$_test\"" } diff --git a/t/t6002-rev-list-bisect.sh b/t/t6002-rev-list-bisect.sh index fcb3302764..71cbb72e1b 100755 --- a/t/t6002-rev-list-bisect.sh +++ b/t/t6002-rev-list-bisect.sh @@ -26,7 +26,7 @@ test_bisection_diff() # Test if bisection size is close to half of list size within # tolerance. - # + # _bisect_err=`expr $_list_size - $_bisection_size \* 2` test "$_bisect_err" -lt 0 && _bisect_err=`expr 0 - $_bisect_err` _bisect_err=`expr $_bisect_err / 2` ; # floor @@ -116,8 +116,8 @@ on_committer_date "1971-08-16 00:00:06" save_tag V unique_commit V tree -p u1 -p test_sequence() { - _bisect_option=$1 - + _bisect_option=$1 + test_bisection_diff 0 $_bisect_option l0 ^root test_bisection_diff 0 $_bisect_option l1 ^root test_bisection_diff 0 $_bisect_option l2 ^root @@ -152,7 +152,7 @@ test_sequence() test_bisection_diff 0 $_bisect_option u3 ^U test_bisection_diff 0 $_bisect_option u4 ^U test_bisection_diff 0 $_bisect_option u5 ^U - + # # the following illustrates Linus' binary bug blatt idea. # diff --git a/t/t6021-merge-criss-cross.sh b/t/t6021-merge-criss-cross.sh index 499cafb882..0ab14a6e81 100755 --- a/t/t6021-merge-criss-cross.sh +++ b/t/t6021-merge-criss-cross.sh @@ -20,7 +20,7 @@ test_expect_success 'prepare repository' \ 7 8 9" > file && -git add file && +git add file && git commit -m "Initial commit" file && git branch A && git branch B && diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh index c76fccfb5a..43aa5d033d 100755 --- a/t/t6023-merge-file.sh +++ b/t/t6023-merge-file.sh @@ -135,4 +135,3 @@ EOF test_expect_success "expected conflict markers" "git diff expect out" test_done - diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 30f6ade13f..03cdba5808 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -102,4 +102,3 @@ test_expect_success \ # # test_done - diff --git a/t/t6101-rev-parse-parents.sh b/t/t6101-rev-parse-parents.sh index b0252b9413..dd6cc3a55c 100755 --- a/t/t6101-rev-parse-parents.sh +++ b/t/t6101-rev-parse-parents.sh @@ -40,4 +40,3 @@ test_expect_success 'short SHA-1 works' ' test $start = $abbrv' test_done - diff --git a/t/t9107-git-svn-migrate.sh b/t/t9107-git-svn-migrate.sh index dc2afdaa45..d549665400 100755 --- a/t/t9107-git-svn-migrate.sh +++ b/t/t9107-git-svn-migrate.sh @@ -109,4 +109,3 @@ test_expect_success ".rev_db auto-converted to .rev_db.UUID" " " test_done - diff --git a/t/t9111/svnsync.dump b/t/t9111/svnsync.dump index a9a46eeb29..499fa9594f 100644 --- a/t/t9111/svnsync.dump +++ b/t/t9111/svnsync.dump @@ -558,5 +558,3 @@ Text-content-md5: 7abb78de7f2756ca8b511cbc879fd5e7 Content-length: 4 cba - - diff --git a/t/test-lib.sh b/t/test-lib.sh index dee3ad7621..8bf4cf49a2 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -232,7 +232,7 @@ test_create_repo () { mv .git/hooks .git/hooks-disabled cd "$owd" } - + test_done () { trap - exit case "$test_failure" in -- cgit v1.2.3 From bcdb34f70d59d4e090ef9a34e4b77fe7e5369f3e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 8 Jun 2007 00:43:22 -0700 Subject: Test wildcard push/fetch Signed-off-by: Junio C Hamano --- t/t5516-fetch-push.sh | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100755 t/t5516-fetch-push.sh (limited to 't') diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh new file mode 100755 index 0000000000..dba018f667 --- /dev/null +++ b/t/t5516-fetch-push.sh @@ -0,0 +1,82 @@ +#!/bin/sh + +test_description='fetching and pushing, with or without wildcard' + +. ./test-lib.sh + +D=`pwd` + +mk_empty () { + rm -fr testrepo && + mkdir testrepo && + ( + cd testrepo && + git init + ) +} + +test_expect_success setup ' + + : >path1 && + git add path1 && + test_tick && + git commit -a -m repo && + the_commit=$(git show-ref -s --verify refs/heads/master) + +' + +test_expect_success 'fetch without wildcard' ' + mk_empty && + ( + cd testrepo && + git fetch .. refs/heads/master:refs/remotes/origin/master && + + r=$(git show-ref -s --verify refs/remotes/origin/master) && + test "z$r" = "z$the_commit" && + + test 1 = $(git for-each-ref refs/remotes/origin | wc -l) + ) +' + +test_expect_success 'fetch with wildcard' ' + mk_empty && + ( + cd testrepo && + git config remote.up.url .. && + git config remote.up.fetch "refs/heads/*:refs/remotes/origin/*" && + git fetch up && + + r=$(git show-ref -s --verify refs/remotes/origin/master) && + test "z$r" = "z$the_commit" && + + test 1 = $(git for-each-ref refs/remotes/origin | wc -l) + ) +' + +test_expect_success 'push without wildcard' ' + mk_empty && + + git push testrepo refs/heads/master:refs/remotes/origin/master && + ( + cd testrepo && + r=$(git show-ref -s --verify refs/remotes/origin/master) && + test "z$r" = "z$the_commit" && + + test 1 = $(git for-each-ref refs/remotes/origin | wc -l) + ) +' + +test_expect_success 'push with wildcard' ' + mk_empty && + + git push testrepo "refs/heads/*:refs/remotes/origin/*" && + ( + cd testrepo && + r=$(git show-ref -s --verify refs/remotes/origin/master) && + test "z$r" = "z$the_commit" && + + test 1 = $(git for-each-ref refs/remotes/origin | wc -l) + ) +' + +test_done -- cgit v1.2.3 From 5035242c4785bd23c53827a1656b5f97394f724e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 8 Jun 2007 01:19:13 -0700 Subject: checkout: do not get confused with ambiguous tag/branch names Although it is not advisable, we have always allowed a branch and a tag to have the same basename (i.e. it is not illegal to have refs/heads/frotz and refs/tags/frotz at the same time). When talking about a specific commit, the interpretation of 'frotz' has always been "use tag and then check branch", although we warn when ambiguities exist. However "git checkout $name" is defined to (1) first see if it matches the branch name, and if so switch to that branch; (2) otherwise it is an instruction to detach HEAD to point at the commit named by $name. We did not follow this definition when $name appeared under both refs/heads/ and refs/tags/ -- we switched to the branch but read the tree from the tagged commit, which was utterly bogus. Signed-off-by: Junio C Hamano --- t/t7201-co.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 't') diff --git a/t/t7201-co.sh b/t/t7201-co.sh index 5fa6a45577..ed2e9ee3c6 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -190,4 +190,44 @@ test_expect_success 'checkout to detach HEAD with HEAD^0' ' fi ' +test_expect_success 'checkout with ambiguous tag/branch names' ' + + git tag both side && + git branch both master && + git reset --hard && + git checkout master && + + git checkout both && + H=$(git rev-parse --verify HEAD) && + M=$(git show-ref -s --verify refs/heads/master) && + test "z$H" = "z$M" && + name=$(git symbolic-ref HEAD 2>/dev/null) && + test "z$name" = zrefs/heads/both + +' + +test_expect_success 'checkout with ambiguous tag/branch names' ' + + git reset --hard && + git checkout master && + + git tag frotz side && + git branch frotz master && + git reset --hard && + git checkout master && + + git checkout tags/frotz && + H=$(git rev-parse --verify HEAD) && + S=$(git show-ref -s --verify refs/heads/side) && + test "z$H" = "z$S" && + if name=$(git symbolic-ref HEAD 2>/dev/null) + then + echo "Bad -- should have detached" + false + else + : happy + fi + +' + test_done -- cgit v1.2.3 From 4890888d742e12044b1f4b89a5d10437a6371253 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Thu, 7 Jun 2007 16:57:00 +0200 Subject: cvsserver: Make req_Root more critical of its input data The path submitted with the Root request has to be absolute (cvs does it this way and it may save us some sanity checks later) If multiple roots are specified (e.g. because we use pserver authentication which will already include the root), ensure that they say all the same. Probably neither is a security risk, and neither should ever be triggered by a sane client, but when validating input data, it's better to be save than sorry. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- t/t9400-git-cvsserver-server.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 't') diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh index e9ef315173..41dcf646d1 100755 --- a/t/t9400-git-cvsserver-server.sh +++ b/t/t9400-git-cvsserver-server.sh @@ -110,6 +110,40 @@ test_expect_success 'pserver authentication failure (login/non-anonymous user)' tail -n1 log | grep -q "^I HATE YOU$"' +# misuse pserver authentication for testing of req_Root + +cat >request-relative <request-conflict <log 2>&1 + then + echo unexpected success + false + else + true + fi && + tail log | grep -q "^error 1 Root must be an absolute pathname$"' + +test_expect_success 'req_Root failure (conflicting roots)' \ + 'cat request-conflict | git-cvsserver pserver >log 2>&1 && + tail log | grep -q "^error 1 Conflicting roots specified$"' + + #-------------- # CONFIG TESTS #-------------- -- cgit v1.2.3 From 693b63273e05b5db4612178989271de14439b08f Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Thu, 7 Jun 2007 16:57:01 +0200 Subject: cvsserver: Add some useful commandline options Make git-cvsserver understand some options inspired by git-daemon, namely --base-path, --export-all, --strict-paths. Also allow the caller to specify a whitelist of allowed directories, again similar to git-daemon. While already adding option parsing also support the common --help and --version options. Rationale: While the gitcvs.enabled configuration option already offers means to limit git-cvsserver access to a repository, there are some use cases where other methods of access control prove to be more useful. E.g. if setting up a pserver for a collection of public repositories one might want limit the exported repositories to exactly the directory this collection is located whithout having to worry about other repositories that might lie around with the configuration variable set (never trust your users ;) Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- t/t9400-git-cvsserver-server.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 't') diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh index 41dcf646d1..392f890ce6 100755 --- a/t/t9400-git-cvsserver-server.sh +++ b/t/t9400-git-cvsserver-server.sh @@ -143,6 +143,34 @@ test_expect_success 'req_Root failure (conflicting roots)' \ 'cat request-conflict | git-cvsserver pserver >log 2>&1 && tail log | grep -q "^error 1 Conflicting roots specified$"' +test_expect_success 'req_Root (strict paths)' \ + 'cat request-anonymous | git-cvsserver --strict-paths pserver $SERVERDIR >log 2>&1 && + tail -n1 log | grep -q "^I LOVE YOU$"' + +test_expect_failure 'req_Root failure (strict-paths)' \ + 'cat request-anonymous | git-cvsserver --strict-paths pserver $WORKDIR >log 2>&1' + +test_expect_success 'req_Root (w/o strict-paths)' \ + 'cat request-anonymous | git-cvsserver pserver $WORKDIR/ >log 2>&1 && + tail -n1 log | grep -q "^I LOVE YOU$"' + +test_expect_failure 'req_Root failure (w/o strict-paths)' \ + 'cat request-anonymous | git-cvsserver pserver $WORKDIR/gitcvs >log 2>&1' + +cat >request-base <log 2>&1 && + tail -n1 log | grep -q "^I LOVE YOU$"' + +test_expect_failure 'req_Root failure (base-path)' \ + 'cat request-anonymous | git-cvsserver --strict-paths --base-path $WORKDIR pserver $SERVERDIR >log 2>&1' #-------------- # CONFIG TESTS -- cgit v1.2.3 From 27c96c4fd38ffbde98df22699c755a043bb383d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 9 Jun 2007 08:31:12 +0200 Subject: t5000: silence unzip availability check unzip -v on (at least) Ubuntu prints a screenful of version info to stdout. Get rid of it since we only want to know if unzip is installed or not. Signed-off-by: Rene Scharfe --- t/t5000-tar-tree.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index 5500505d8b..a6c5bf6ab4 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -108,7 +108,7 @@ test_expect_success \ 'git-archive --format=zip' \ 'git-archive --format=zip HEAD >d.zip' -$UNZIP -v 2>/dev/null +$UNZIP -v >/dev/null 2>&1 if [ $? -eq 127 ]; then echo "Skipping ZIP tests, because unzip was not found" test_done -- cgit v1.2.3 From 6125796f7d6e8b84431f92c13d7e79bd30f94f53 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 9 Jun 2007 01:23:53 -0700 Subject: remote.c: fix "git push" weak match disambiguation When "git push A:B" is given, and A (or B) is not a full refname that begins with refs/, we require an unambiguous match with an existing ref. For this purpose, a match with a local branch or a tag (i.e. refs/heads/A and refs/tags/A) is called a "strong match", and any other match is called a "weak match". A partial refname is unambiguous when there is only one strong match with any number of weak matches, or when there is only one weak match and no other match. However, as reported by Sparse with Ramsay Jones recently, count_refspec_match() function had a bug where a variable in an inner block masked a different variable of the same name, which caused the weak matches to be ignored. This fixes it, and adds tests for the fix. Signed-off-by: Junio C Hamano --- t/t5516-fetch-push.sh | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) (limited to 't') diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index dba018f667..b3b57faf9c 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -15,12 +15,58 @@ mk_empty () { ) } +mk_test () { + mk_empty && + ( + for ref in "$@" + do + git push testrepo $the_first_commit:refs/$ref || { + echo "Oops, push refs/$ref failure" + exit 1 + } + done && + cd testrepo && + for ref in "$@" + do + r=$(git show-ref -s --verify refs/$ref) && + test "z$r" = "z$the_first_commit" || { + echo "Oops, refs/$ref is wrong" + exit 1 + } + done && + git fsck --full + ) +} + +check_push_result () { + ( + cd testrepo && + it="$1" && + shift + for ref in "$@" + do + r=$(git show-ref -s --verify refs/$ref) && + test "z$r" = "z$it" || { + echo "Oops, refs/$ref is wrong" + exit 1 + } + done && + git fsck --full + ) +} + test_expect_success setup ' : >path1 && git add path1 && test_tick && git commit -a -m repo && + the_first_commit=$(git show-ref -s --verify refs/heads/master) && + + : >path2 && + git add path2 && + test_tick && + git commit -a -m second && the_commit=$(git show-ref -s --verify refs/heads/master) ' @@ -79,4 +125,70 @@ test_expect_success 'push with wildcard' ' ) ' +test_expect_success 'push with matching heads' ' + + mk_test heads/master && + git push testrepo && + check_push_result $the_commit heads/master + +' + +test_expect_success 'push with no ambiguity (1)' ' + + mk_test heads/master && + git push testrepo master:master && + check_push_result $the_commit heads/master + +' + +test_expect_success 'push with no ambiguity (2)' ' + + mk_test remotes/origin/master && + git push testrepo master:master && + check_push_result $the_commit remotes/origin/master + +' + +test_expect_success 'push with weak ambiguity (1)' ' + + mk_test heads/master remotes/origin/master && + git push testrepo master:master && + check_push_result $the_commit heads/master && + check_push_result $the_first_commit remotes/origin/master + +' + +test_expect_success 'push with weak ambiguity (2)' ' + + mk_test heads/master remotes/origin/master remotes/another/master && + git push testrepo master:master && + check_push_result $the_commit heads/master && + check_push_result $the_first_commit remotes/origin/master remotes/another/master + +' + +test_expect_success 'push with ambiguity (1)' ' + + mk_test remotes/origin/master remotes/frotz/master && + if git push testrepo master:master + then + echo "Oops, should have failed" + false + else + check_push_result $the_first_commit remotes/origin/master remotes/frotz/master + fi +' + +test_expect_success 'push with ambiguity (2)' ' + + mk_test heads/frotz tags/frotz && + if git push testrepo master:frotz + then + echo "Oops, should have failed" + false + else + check_push_result $the_first_commit heads/frotz tags/frotz + fi +' + test_done -- cgit v1.2.3 From 1ed10b886bc69c129c06772ee4310c00e001657f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 9 Jun 2007 01:37:14 -0700 Subject: remote.c: "git-push frotz" should update what matches at the source. Earlier, when the local repository has a branch "frotz" and the remote repository has a tag "frotz" (but not branch "frotz"), "git-push frotz" mistakenly updated the tag at the remote side. This was because the partial refname matching code was applied independently on both source and destination side. With this fix, when a colon-less refspec is given to git-push, we first match it with the refs in the source repository, and update the matching ref in the destination repository. Signed-off-by: Junio C Hamano --- t/t5516-fetch-push.sh | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 't') diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index b3b57faf9c..08d58e1c8c 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -189,6 +189,58 @@ test_expect_success 'push with ambiguity (2)' ' else check_push_result $the_first_commit heads/frotz tags/frotz fi + +' + +test_expect_success 'push with colon-less refspec (1)' ' + + mk_test heads/frotz tags/frotz && + git branch -f frotz master && + git push testrepo frotz && + check_push_result $the_commit heads/frotz && + check_push_result $the_first_commit tags/frotz + +' + +test_expect_success 'push with colon-less refspec (2)' ' + + mk_test heads/frotz tags/frotz && + if git show-ref --verify -q refs/heads/frotz + then + git branch -D frotz + fi && + git tag -f frotz && + git push testrepo frotz && + check_push_result $the_commit tags/frotz && + check_push_result $the_first_commit heads/frotz + +' + +test_expect_success 'push with colon-less refspec (3)' ' + + mk_test && + if git show-ref --verify -q refs/tags/frotz + then + git tag -d frotz + fi && + git branch -f frotz master && + git push testrepo frotz && + check_push_result $the_commit heads/frotz && + test "$( cd testrepo && git show-ref | wc -l )" = 1 +' + +test_expect_success 'push with colon-less refspec (4)' ' + + mk_test && + if git show-ref --verify -q refs/heads/frotz + then + git branch -D frotz + fi && + git tag -f frotz && + git push testrepo frotz && + check_push_result $the_commit tags/frotz && + test "$( cd testrepo && git show-ref | wc -l )" = 1 + ' test_done -- cgit v1.2.3 From f1eccbab638df66a7d8ec881f6f695514b26f44f Mon Sep 17 00:00:00 2001 From: Gerrit Pape Date: Sat, 9 Jun 2007 12:40:35 +0000 Subject: git-branch: cleanup config file when deleting branches When deleting branches, remove the sections referring to these branches from the config file. Signed-off-by: Gerrit Pape --- t/t3200-branch.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 't') diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 6f6d8844e8..f1793d0b9a 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -171,6 +171,15 @@ test_expect_success 'test tracking setup via --track but deeper' \ test "$(git-config branch.my7.remote)" = local && test "$(git-config branch.my7.merge)" = refs/heads/o/o' +test_expect_success 'test deleting branch deletes branch config' \ + 'git-branch -d my7 && + test "$(git-config branch.my7.remote)" = "" && + test "$(git-config branch.my7.merge)" = ""' + +test_expect_success 'test deleting branch without config' \ + 'git-branch my7 s && + test "$(git-branch -d my7 2>&1)" = "Deleted branch my7."' + # Keep this test last, as it changes the current branch cat >expect < 1117150200 +0000 branch: Created from master -- cgit v1.2.3 From 685ef546b62d063c72b401cd38b83a879301aac4 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 8 Jun 2007 01:30:35 +0100 Subject: Teach filter-branch about subdirectory filtering With git-filter-branch --subdirectory-filter you can get at the history, as seen by a certain subdirectory. The history of the rewritten branch will only contain commits that touched that subdirectory, and the subdirectory will be rewritten to be the new project root. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7003-filter-branch.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 't') diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index 3739cb191d..292b83766d 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -54,4 +54,28 @@ test_expect_success 'common ancestor is still common (unchanged)' ' test "$(git-merge-base modD D)" = "$(git-rev-parse B)" ' +test_expect_success 'filter subdirectory only' ' + mkdir subdir && + touch subdir/new && + git add subdir/new && + test_tick && + git commit -m "subdir" && + echo H > a && + test_tick && + git commit -m "not subdir" a && + echo A > subdir/new && + test_tick && + git commit -m "again subdir" subdir/new && + git rm a && + test_tick && + git commit -m "again not subdir" && + git-filter-branch --subdirectory-filter subdir sub +' + +test_expect_success 'subdirectory filter result looks okay' ' + test 2 = $(git-rev-list sub | wc -l) && + git show sub:new && + ! git show sub:subdir +' + test_done -- cgit v1.2.3 From cfabd6eee1745cfec58cfcb794ce8847e43b888a Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Fri, 8 Jun 2007 23:28:50 +0200 Subject: filter-branch: subdirectory filter needs --full-history When two branches are merged that modify a subdirectory (possibly in different intermediate steps) such that both end up identical, then rev-list chooses only one branch. But when we filter history, we want to keep both branches. Therefore, we must use --full-history. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t7003-filter-branch.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 't') diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index 292b83766d..0fabe4904f 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -78,4 +78,25 @@ test_expect_success 'subdirectory filter result looks okay' ' ! git show sub:subdir ' +test_expect_success 'setup and filter history that requires --full-history' ' + git checkout master && + mkdir subdir && + echo A > subdir/new && + git add subdir/new && + test_tick && + git commit -m "subdir on master" subdir/new && + git rm a && + test_tick && + git commit -m "again subdir on master" && + git merge branch && + git-filter-branch --subdirectory-filter subdir sub-master +' + +test_expect_success 'subdirectory filter result looks okay' ' + test 3 = $(git-rev-list -1 --parents sub-master | wc -w) && + git show sub-master^:new && + git show sub-master^2:new && + ! git show sub:subdir +' + test_done -- cgit v1.2.3 From b10ee7606e14265c6116639aafccb863b77043f5 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 11 Jun 2007 21:12:21 +0200 Subject: t7400: barf if git-submodule removes or replaces a file The test for an unmolested file wouldn't fail properly if the file had been removed or replaced by something other than a regular file. This fixes it. Signed-off-by: Lars Hjemli Signed-off-by: Junio C Hamano --- t/t7400-submodule-basic.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 3940433b8f..74fafceb71 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -72,7 +72,7 @@ test_expect_success 'update should fail when path is used by a file' ' then echo "[OOPS] update should have failed" false - elif test -f lib && test "$(cat lib)" != "hello" + elif test "$(cat lib)" != "hello" then echo "[OOPS] update failed but lib file was molested" false -- cgit v1.2.3 From d57dd255a696cb68c880110a990085c08343f618 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 11 Jun 2007 21:12:23 +0200 Subject: Rename sections from "module" to "submodule" in .gitmodules Rename [module] to [submodule], so that it would be more forward compatible with the proposed extension by harmonizing the section names used in .gitmodules and .git/config. Signed-off-by: Lars Hjemli Signed-off-by: Junio C Hamano --- t/t7400-submodule-basic.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 74fafceb71..9f2d4f9b38 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -40,7 +40,7 @@ test_expect_success 'Prepare submodule testing' ' git-add a lib z && git-commit -m "super commit 1" && mv lib .subrepo && - GIT_CONFIG=.gitmodules git-config module.lib.url git://example.com/lib.git + GIT_CONFIG=.gitmodules git-config submodule.lib.url git://example.com/lib.git ' test_expect_success 'status should only print one line' ' -- cgit v1.2.3 From 941987a554812b982094e09c5c817f18be953365 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 11 Jun 2007 21:12:24 +0200 Subject: git-submodule: give submodules proper names This changes the way git-submodule uses .gitmodules: Subsections no longer specify the submodule path, they now specify the submodule name. The submodule path is found under the new key "submodule..path", which is a required key. With this change a submodule can be moved between different 'checkout paths' without upsetting git-submodule. Signed-off-by: Lars Hjemli Signed-off-by: Junio C Hamano --- t/t7400-submodule-basic.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 't') diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 9f2d4f9b38..7a9b505b13 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -18,7 +18,7 @@ subcommands of git-submodule. # -add directory lib to 'superproject', this creates a DIRLINK entry # -add a couple of regular files to enable testing of submodule filtering # -mv lib subrepo -# -add an entry to .gitmodules for path 'lib' +# -add an entry to .gitmodules for submodule 'example' # test_expect_success 'Prepare submodule testing' ' mkdir lib && @@ -40,7 +40,19 @@ test_expect_success 'Prepare submodule testing' ' git-add a lib z && git-commit -m "super commit 1" && mv lib .subrepo && - GIT_CONFIG=.gitmodules git-config submodule.lib.url git://example.com/lib.git + GIT_CONFIG=.gitmodules git-config submodule.example.url git://example.com/lib.git +' + +test_expect_success 'status should fail for unmapped paths' ' + if git-submodule status + then + echo "[OOPS] submodule status succeeded" + false + elif ! GIT_CONFIG=.gitmodules git-config submodule.example.path lib + then + echo "[OOPS] git-config failed to update .gitmodules" + false + fi ' test_expect_success 'status should only print one line' ' @@ -54,12 +66,12 @@ test_expect_success 'status should initially be "missing"' ' test_expect_success 'init should register submodule url in .git/config' ' git-submodule init && - url=$(git-config submodule.lib.url) && + url=$(git-config submodule.example.url) && if test "$url" != "git://example.com/lib.git" then echo "[OOPS] init succeeded but submodule url is wrong" false - elif ! git-config submodule.lib.url ./.subrepo + elif ! git-config submodule.example.url ./.subrepo then echo "[OOPS] init succeeded but update of url failed" false -- cgit v1.2.3 From b3bf96d483ac2ff4a7523445a4e3f53f266501a4 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 13 Jun 2007 02:37:04 -0700 Subject: git-svn: test for creating new directories over svn:// As reported by Matthieu Moy, this is causing svnserve to terminate connections, because it segfaults. This test is disabled by default and can be enabled by setting SVNSERVE_PORT to an unbound (for 127.0.0.1) TCP port in the environment (in addition to SVN_TESTS=1). I'm not comfortable with having a test start a daemon by default and take up a port that could potentially stay running if the test failed. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/t9113-git-svn-dcommit-new-file.sh | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 t/t9113-git-svn-dcommit-new-file.sh (limited to 't') diff --git a/t/t9113-git-svn-dcommit-new-file.sh b/t/t9113-git-svn-dcommit-new-file.sh new file mode 100755 index 0000000000..9ef0db9044 --- /dev/null +++ b/t/t9113-git-svn-dcommit-new-file.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# +# Copyright (c) 2007 Eric Wong +# + +# Don't run this test by default unless the user really wants it +# I don't like the idea of taking a port and possibly leaving a +# daemon running on a users system if the test fails. +# Not all git users will need to interact with SVN. +test -z "$SVNSERVE_PORT" && exit 0 + +test_description='git-svn dcommit new files over svn:// test' + +. ./lib-git-svn.sh + +start_svnserve () { + svnserve --listen-port $SVNSERVE_PORT \ + --root $rawsvnrepo \ + --listen-once \ + --listen-host 127.0.0.1 & +} + +test_expect_success 'start tracking an empty repo' " + svn mkdir -m 'empty dir' $svnrepo/empty-dir && + echo anon-access = write >> $rawsvnrepo/conf/svnserve.conf && + start_svnserve && + git svn init svn://127.0.0.1:$SVNSERVE_PORT && + git svn fetch + " + +test_expect_success 'create files in new directory with dcommit' " + mkdir git-new-dir && + echo hello > git-new-dir/world && + git update-index --add git-new-dir/world && + git commit -m hello && + start_svnserve && + git svn dcommit + " + +test_done -- cgit v1.2.3 From 733a65aa5d33196fac708ebd12a98a1060cbf3c2 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 13 Jun 2007 02:23:28 -0700 Subject: git-svn: allow dcommit to retain local merge information dcommit will still rewrite the HEAD commit and the history of the first parents of each HEAD~1, HEAD~2, HEAD~3 as it always has. However, any merge parents (HEAD^2, HEAD^^2, HEAD~2^2) will now be preserved when the new HEAD and HEAD~[0-9]+ commits are rewritten to SVN with dcommit. Commits written to SVN will still not have any merge information besides anything in the commit message. Thanks to Joakim Tjernlund, Junio C Hamano and Steven Grimm for explanations, feedback, examples and test case. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/t9114-git-svn-dcommit-merge.sh | 89 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100755 t/t9114-git-svn-dcommit-merge.sh (limited to 't') diff --git a/t/t9114-git-svn-dcommit-merge.sh b/t/t9114-git-svn-dcommit-merge.sh new file mode 100755 index 0000000000..d6ca955081 --- /dev/null +++ b/t/t9114-git-svn-dcommit-merge.sh @@ -0,0 +1,89 @@ +#!/bin/sh +# +# Copyright (c) 2007 Eric Wong +# Based on a script by Joakim Tjernlund + +test_description='git-svn dcommit handles merges' + +. ./lib-git-svn.sh + +big_text_block () { +cat << EOF +# +# (C) Copyright 2000 - 2005 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# +EOF +} + +test_expect_success 'setup svn repository' " + svn co $svnrepo mysvnwork && + mkdir -p mysvnwork/trunk && + cd mysvnwork && + big_text_block >> trunk/README && + svn add trunk && + svn ci -m 'first commit' trunk && + cd .. + " + +test_expect_success 'setup git mirror and merge' " + git svn init $svnrepo -t tags -T trunk -b branches && + git svn fetch && + git checkout --track -b svn remotes/trunk && + git checkout -b merge && + echo new file > new_file && + git add new_file && + git commit -a -m 'New file' && + echo hello >> README && + git commit -a -m 'hello' && + echo add some stuff >> new_file && + git commit -a -m 'add some stuff' && + git checkout svn && + mv -f README tmp && + echo friend > README && + cat tmp >> README && + git commit -a -m 'friend' && + git pull . merge + " + +test_debug 'gitk --all & sleep 1' + +test_expect_success 'verify pre-merge ancestry' " + test x\`git rev-parse --verify refs/heads/svn^2\` = \ + x\`git rev-parse --verify refs/heads/merge\` && + git cat-file commit refs/heads/svn^ | grep '^friend$' + " + +test_expect_success 'git svn dcommit merges' " + git svn dcommit + " + +test_debug 'gitk --all & sleep 1' + +test_expect_success 'verify post-merge ancestry' " + test x\`git rev-parse --verify refs/heads/svn\` = \ + x\`git rev-parse --verify refs/remotes/trunk \` && + test x\`git rev-parse --verify refs/heads/svn^2\` = \ + x\`git rev-parse --verify refs/heads/merge\` && + git cat-file commit refs/heads/svn^ | grep '^friend$' + " + +test_done -- cgit v1.2.3 From fd1cd91e9407bccba3380dad6dcb60c4154d94a2 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Fri, 15 Jun 2007 03:01:52 +0200 Subject: cvsserver: Let --base-path and pserver get along just fine Embarassing bug number one in my options patch. Since the code for --base-path support rewrote the cvsroot value after comparing it with a possible existing value (i.e. from pserver authentication) the check always failed. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- t/t9400-git-cvsserver-server.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't') diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh index 392f890ce6..9b69452d6f 100755 --- a/t/t9400-git-cvsserver-server.sh +++ b/t/t9400-git-cvsserver-server.sh @@ -163,6 +163,7 @@ BEGIN AUTH REQUEST anonymous END AUTH REQUEST +Root /gitcvs.git EOF test_expect_success 'req_Root (base-path)' \ -- cgit v1.2.3 From 226bccb9ad42441269507a2101b47424d7c9c477 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Fri, 15 Jun 2007 03:01:53 +0200 Subject: cvsserver: Actually implement --export-all Embarrassing bug number two in my options patch. Also enforce that --export-all is only ever used together with an explicit whitelist. Otherwise people might export every git repository on the whole system without realising. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- t/t9400-git-cvsserver-server.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 't') diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh index 9b69452d6f..b442b5d145 100755 --- a/t/t9400-git-cvsserver-server.sh +++ b/t/t9400-git-cvsserver-server.sh @@ -173,6 +173,22 @@ test_expect_success 'req_Root (base-path)' \ test_expect_failure 'req_Root failure (base-path)' \ 'cat request-anonymous | git-cvsserver --strict-paths --base-path $WORKDIR pserver $SERVERDIR >log 2>&1' +GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled false || exit 1 + +test_expect_success 'req_Root (export-all)' \ + 'cat request-anonymous | git-cvsserver --export-all pserver $WORKDIR >log 2>&1 && + tail -n1 log | grep -q "^I LOVE YOU$"' + +test_expect_failure 'req_Root failure (export-all w/o whitelist)' \ + 'cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 + || false' + +test_expect_success 'req_Root (everything together)' \ + 'cat request-base | git-cvsserver --export-all --strict-paths --base-path $WORKDIR/ pserver $SERVERDIR >log 2>&1 && + tail -n1 log | grep -q "^I LOVE YOU$"' + +GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true || exit 1 + #-------------- # CONFIG TESTS #-------------- -- cgit v1.2.3 From fadf488f9b8c4fc709f0b083d2769ecc1e0e1119 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 5 Jun 2007 03:36:49 +0100 Subject: merge-recursive: refuse to merge binary files [jc: cherry-picked 9f30855 from 'master'] Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t6024-recursive-merge.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 't') diff --git a/t/t6024-recursive-merge.sh b/t/t6024-recursive-merge.sh index a398556137..058db9cc52 100755 --- a/t/t6024-recursive-merge.sh +++ b/t/t6024-recursive-merge.sh @@ -81,4 +81,18 @@ EOF test_expect_success "virtual trees were processed" "git diff expect out" +git reset --hard +test_expect_success 'refuse to merge binary files' ' + printf "\0" > binary-file && + git add binary-file && + git commit -m binary && + git checkout G && + printf "\0\0" > binary-file && + git add binary-file && + git commit -m binary2 && + ! git merge F > merge.out 2> merge.err && + grep "Cannot merge binary files: HEAD:binary-file vs. F:binary-file" \ + merge.err +' + test_done -- cgit v1.2.3 From 7b99befef7d0ae173980f531e80916126011ca41 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 15 Jun 2007 23:35:32 -0700 Subject: git-branch --track: fix tracking branch computation. The original code did not take hierarchical branch names into account at all. [jc: cherry-picked 11f68d9 from 'master'] Tested-by: Gerrit Pape Signed-off-by: Junio C Hamano --- t/t3200-branch.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 't') diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 828d553a4b..6f6d8844e8 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -136,8 +136,8 @@ test_expect_success 'test tracking setup (non-wildcard, not matching)' \ git-config remote.local.fetch refs/heads/s:refs/remotes/local/s && (git-show-ref -q refs/remotes/local/master || git-fetch local) && git-branch --track my5 local/master && - ! test $(git-config branch.my5.remote) = local && - ! test $(git-config branch.my5.merge) = refs/heads/master' + ! test "$(git-config branch.my5.remote)" = local && + ! test "$(git-config branch.my5.merge)" = refs/heads/master' test_expect_success 'test tracking setup via config' \ 'git-config branch.autosetupmerge true && @@ -155,14 +155,22 @@ test_expect_success 'test overriding tracking setup via --no-track' \ (git-show-ref -q refs/remotes/local/master || git-fetch local) && git-branch --no-track my2 local/master && git-config branch.autosetupmerge false && - ! test $(git-config branch.my2.remote) = local && - ! test $(git-config branch.my2.merge) = refs/heads/master' + ! test "$(git-config branch.my2.remote)" = local && + ! test "$(git-config branch.my2.merge)" = refs/heads/master' test_expect_success 'test local tracking setup' \ 'git branch --track my6 s && test $(git-config branch.my6.remote) = . && test $(git-config branch.my6.merge) = refs/heads/s' +test_expect_success 'test tracking setup via --track but deeper' \ + 'git-config remote.local.url . && + git-config remote.local.fetch refs/heads/*:refs/remotes/local/* && + (git-show-ref -q refs/remotes/local/o/o || git-fetch local) && + git-branch --track my7 local/o/o && + test "$(git-config branch.my7.remote)" = local && + test "$(git-config branch.my7.merge)" = refs/heads/o/o' + # Keep this test last, as it changes the current branch cat >expect < 1117150200 +0000 branch: Created from master -- cgit v1.2.3 From 3c740268c40f10010dd5dec7df85a1f0d2062c59 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Sun, 17 Jun 2007 01:52:50 +0200 Subject: cvsserver: Actually implement --export-all Frank Lichtenheld, Fri, Jun 15, 2007 03:01:53 +0200: > +test_expect_failure 'req_Root failure (export-all w/o whitelist)' \ > + 'cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 > + || false' This does not work, at least for bash in current Ubuntu: GNU bash, version 3.2.13(1)-release You have to put "||" on the previous line: Signed-off-by: Junio C Hamano --- t/t9400-git-cvsserver-server.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh index b442b5d145..0331770686 100755 --- a/t/t9400-git-cvsserver-server.sh +++ b/t/t9400-git-cvsserver-server.sh @@ -180,8 +180,8 @@ test_expect_success 'req_Root (export-all)' \ tail -n1 log | grep -q "^I LOVE YOU$"' test_expect_failure 'req_Root failure (export-all w/o whitelist)' \ - 'cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 - || false' + 'cat request-anonymous | git-cvsserver --export-all pserver >log 2>&1 || + false' test_expect_success 'req_Root (everything together)' \ 'cat request-base | git-cvsserver --export-all --strict-paths --base-path $WORKDIR/ pserver $SERVERDIR >log 2>&1 && -- cgit v1.2.3 From 0ce396431ee710aa406f7e41ad9578dcac54085f Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 21 Jun 2007 12:52:11 +0100 Subject: diffcore-rename: favour identical basenames When there are several candidates for a rename source, and one of them has an identical basename to the rename target, take that one. Noticed by Govind Salinas, posted by Shawn O. Pearce, partial patch by Linus Torvalds. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t4001-diff-rename.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 't') diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh index 2e3c20d6b9..90c085f828 100755 --- a/t/t4001-diff-rename.sh +++ b/t/t4001-diff-rename.sh @@ -64,4 +64,17 @@ test_expect_success \ 'validate the output.' \ 'compare_diff_patch current expected' +test_expect_success 'favour same basenames over different ones' ' + cp path1 another-path && + git add another-path && + git commit -m 1 && + git rm path1 && + mkdir subdir && + git mv another-path subdir/path1 && + git runstatus | grep "renamed: .*path1 -> subdir/path1"' + +test_expect_success 'favour same basenames even with minor differences' ' + git show HEAD:path1 | sed "s/15/16/" > subdir/path1 && + git runstatus | grep "renamed: .*path1 -> subdir/path1"' + test_done -- cgit v1.2.3 From 55f22ff22e5ff6c21b50cf379ee946f9642fc3cb Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 21 Jun 2007 18:05:30 +0100 Subject: filter-branch: add example to move everything into a subdirectory This is based on Jeff King's example in 20070621130137.GB4487@coredump.intra.peff.net Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7003-filter-branch.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't') diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index 0fabe4904f..f00c262e45 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -99,4 +99,12 @@ test_expect_success 'subdirectory filter result looks okay' ' ! git show sub:subdir ' +test_expect_success 'use index-filter to move into a subdirectory' ' + git-filter-branch --index-filter \ + "git-ls-files -s | sed \"s-\\t-&newsubdir/-\" | + GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \ + git-update-index --index-info && + mv \$GIT_INDEX_FILE.new \$GIT_INDEX_FILE" directorymoved && + test -z "$(git diff HEAD directorymoved:newsubdir)"' + test_done -- cgit v1.2.3 From fc746df6476078fa04f821aea00f84bbe13dbf9f Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 22 Jun 2007 17:49:08 +0200 Subject: t9500: skip gitweb tests if perl version is too old gitweb calls Encode::decode_utf8 with two arguments, but old versions of perl only allow this function to be called with one argument. Even older versions of perl do not even have an Encode module. Signed-off-by: Sven Verdoolaege Signed-off-by: Junio C Hamano --- t/t9500-gitweb-standalone-no-errors.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 't') diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh index 44ae503b99..d948724566 100755 --- a/t/t9500-gitweb-standalone-no-errors.sh +++ b/t/t9500-gitweb-standalone-no-errors.sh @@ -60,6 +60,12 @@ gitweb_run () { . ./test-lib.sh +perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || { + test_expect_success 'skipping gitweb tests, perl version is too old' : + test_done + exit +} + gitweb_init # ---------------------------------------------------------------------- -- cgit v1.2.3 From 9378c16135100fb65ad575cd35074af166de1cab Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 24 Jun 2007 15:11:24 -0700 Subject: Add core.quotepath configuration variable. We always quote "unusual" byte values in a pathname using C-string style, to make it safer for parsing scripts that do not handle NUL separated records well (or just too lazy to bother). The absolute minimum bytes that need to be quoted for this purpose are TAB, LF (and other control characters), double quote and backslash. However, we have also always quoted the bytes in high 8-bit range; this was partly because we were lazy and partly because we were being cautious. This introduces an internal "quote_path_fully" variable, and core.quotepath configuration variable to control it. When set to false, it does not quote bytes in high 8-bit range anymore but passes them intact. The variable defaults to "true" to retain the traditional behaviour for now. Signed-off-by: Junio C Hamano --- t/t3902-quoted.sh | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100755 t/t3902-quoted.sh (limited to 't') diff --git a/t/t3902-quoted.sh b/t/t3902-quoted.sh new file mode 100755 index 0000000000..63f950b179 --- /dev/null +++ b/t/t3902-quoted.sh @@ -0,0 +1,126 @@ +#!/bin/sh +# +# Copyright (c) 2006 Junio C Hamano +# + +test_description='quoted output' + +. ./test-lib.sh + +FN='濱野' +GN='純' +HT=' ' +LF=' +' +DQ='"' + +for_each_name () { + for name in \ + Name "Name and a${LF}LF" "Name and an${HT}HT" "Name${DQ}" \ + "$FN$HT$GN" "$FN$LF$GN" "$FN $GN" "$FN$GN" "$FN$DQ$GN" \ + "With SP in it" + do + eval "$1" + done +} + +test_expect_success setup ' + + for_each_name "echo initial >\"\$name\"" + git add . && + git commit -q -m Initial && + + for_each_name "echo second >\"\$name\"" && + git commit -a -m Second + + for_each_name "echo modified >\"\$name\"" + +' + +cat >expect.quoted <<\EOF +Name +"Name and a\nLF" +"Name and an\tHT" +"Name\"" +With SP in it +"\346\277\261\351\207\216\t\347\264\224" +"\346\277\261\351\207\216\n\347\264\224" +"\346\277\261\351\207\216 \347\264\224" +"\346\277\261\351\207\216\"\347\264\224" +"\346\277\261\351\207\216\347\264\224" +EOF + +cat >expect.raw <<\EOF +Name +"Name and a\nLF" +"Name and an\tHT" +"Name\"" +With SP in it +"濱野\t純" +"濱野\n純" +濱野 純 +"濱野\"純" +濱野純 +EOF + +test_expect_success 'check fully quoted output from ls-files' ' + + git ls-files >current && diff -u expect.quoted current + +' + +test_expect_success 'check fully quoted output from diff-files' ' + + git diff --name-only >current && + diff -u expect.quoted current + +' + +test_expect_success 'check fully quoted output from diff-index' ' + + git diff --name-only HEAD >current && + diff -u expect.quoted current + +' + +test_expect_success 'check fully quoted output from diff-tree' ' + + git diff --name-only HEAD^ HEAD >current && + diff -u expect.quoted current + +' + +test_expect_success 'setting core.quotepath' ' + + git config --bool core.quotepath false + +' + +test_expect_success 'check fully quoted output from ls-files' ' + + git ls-files >current && diff -u expect.raw current + +' + +test_expect_success 'check fully quoted output from diff-files' ' + + git diff --name-only >current && + diff -u expect.raw current + +' + +test_expect_success 'check fully quoted output from diff-index' ' + + git diff --name-only HEAD >current && + diff -u expect.raw current + +' + +test_expect_success 'check fully quoted output from diff-tree' ' + + git diff --name-only HEAD^ HEAD >current && + diff -u expect.raw current + +' + +test_done -- cgit v1.2.3 From 1b1dce4bae760248a1fc3e29548a72c446e77270 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 25 Jun 2007 01:11:14 +0100 Subject: Teach rebase an interactive mode Don't you just hate the fact sometimes, that git-rebase just applies the patches, without any possibility to edit them, or rearrange them? With "--interactive", git-rebase now lets you edit the list of patches, so that you can reorder, edit and delete patches. Such a list will typically look like this: pick deadbee The oneline of this commit pick fa1afe1 The oneline of the next commit ... By replacing the command "pick" with the command "edit", you can amend that patch and/or its commit message, and by replacing it with "squash" you can tell rebase to fold that patch into the patch before that. It is derived from the script sent to the list in Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 163 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100755 t/t3404-rebase-interactive.sh (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh new file mode 100755 index 0000000000..48aa8ea814 --- /dev/null +++ b/t/t3404-rebase-interactive.sh @@ -0,0 +1,163 @@ +#!/bin/sh +# +# Copyright (c) 2007 Johannes E. Schindelin +# + +test_description='git rebase interactive + +This test runs git rebase "interactively", by faking an edit, and verifies +that the result still makes sense. +' +. ./test-lib.sh + +# set up two branches like this: +# +# A - B - C - D - E +# \ +# F - G - H +# \ +# I +# +# where B, D and G touch the same file. + +test_expect_success 'setup' ' + : > file1 && + git add file1 && + test_tick && + git commit -m A && + git tag A && + echo 1 > file1 && + test_tick && + git commit -m B file1 && + : > file2 && + git add file2 && + test_tick && + git commit -m C && + echo 2 > file1 && + test_tick && + git commit -m D file1 && + : > file3 && + git add file3 && + test_tick && + git commit -m E && + git checkout -b branch1 A && + : > file4 && + git add file4 && + test_tick && + git commit -m F && + git tag F && + echo 3 > file1 && + test_tick && + git commit -m G file1 && + : > file5 && + git add file5 && + test_tick && + git commit -m H && + git checkout -b branch2 F && + : > file6 && + git add file6 && + test_tick && + git commit -m I && + git tag I +' + +cat > fake-editor.sh << EOF +#!/bin/sh +test "\$1" = .git/COMMIT_EDITMSG && exit +test -z "\$FAKE_LINES" && exit +grep -v "^#" < "\$1" > "\$1".tmp +rm "\$1" +cat "\$1".tmp +action=pick +for line in \$FAKE_LINES; do + case \$line in + squash) + action="\$line";; + *) + echo sed -n "\${line}s/^pick/\$action/p" + sed -n "\${line}p" < "\$1".tmp + sed -n "\${line}s/^pick/\$action/p" < "\$1".tmp >> "\$1" + action=pick;; + esac +done +EOF + +chmod a+x fake-editor.sh +VISUAL="$(pwd)/fake-editor.sh" +export VISUAL + +test_expect_success 'no changes are a nop' ' + git rebase -i F && + test $(git rev-parse I) = $(git rev-parse HEAD) +' + +test_expect_success 'rebase on top of a non-conflicting commit' ' + git checkout branch1 && + git tag original-branch1 && + git rebase -i branch2 && + test file6 = $(git diff --name-only original-branch1) && + test $(git rev-parse I) = $(git rev-parse HEAD~2) +' + +test_expect_success 'exchange two commits' ' + FAKE_LINES="2 1" git rebase -i HEAD~2 && + test H = $(git cat-file commit HEAD^ | tail -n 1) && + test G = $(git cat-file commit HEAD | tail -n 1) +' + +cat > expect << EOF +diff --git a/file1 b/file1 +index e69de29..00750ed 100644 +--- a/file1 ++++ b/file1 +@@ -0,0 +1 @@ ++3 +EOF + +cat > expect2 << EOF +<<<<<<< HEAD:file1 +2 +======= +3 +>>>>>>> b7ca976... G:file1 +EOF + +test_expect_success 'stop on conflicting pick' ' + git tag new-branch1 && + ! git rebase -i master && + diff -u expect .git/.dotest-merge/patch && + diff -u expect2 file1 && + test 4 = $(grep -v "^#" < .git/.dotest-merge/done | wc -l) && + test 0 = $(grep -v "^#" < .git/.dotest-merge/todo | wc -l) +' + +test_expect_success 'abort' ' + git rebase --abort && + test $(git rev-parse new-branch1) = $(git rev-parse HEAD) && + ! test -d .git/.dotest-merge +' + +test_expect_success 'retain authorship' ' + echo A > file7 && + git add file7 && + GIT_AUTHOR_NAME="Twerp Snog" git commit -m "different author" && + git tag twerp && + git rebase -i --onto master HEAD^ && + git show HEAD | grep "^Author: Twerp Snog" +' + +test_expect_success 'squash' ' + git reset --hard twerp && + echo B > file7 && + GIT_AUTHOR_NAME="Nitfol" git commit -m "nitfol" file7 && + echo "******************************" && + FAKE_LINES="1 squash 2" git rebase -i --onto master HEAD~2 && + test B = $(cat file7) && + test $(git rev-parse HEAD^) = $(git rev-parse master) +' + +test_expect_success 'retain authorship when squashing' ' + git show HEAD | grep "^Author: Nitfol" +' + +test_done -- cgit v1.2.3 From e3ae6bb9aaf030251f1d13c4de3aa220cf282460 Mon Sep 17 00:00:00 2001 From: Sam Vilain Date: Wed, 27 Jun 2007 11:44:22 +1200 Subject: cleanup merge-base test script Add a picture, and keep the setup and the tests together. Signed-off-by: Sam Vilain Signed-off-by: Junio C Hamano --- t/t6010-merge-base.sh | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 't') diff --git a/t/t6010-merge-base.sh b/t/t6010-merge-base.sh index b15920b852..22e0893056 100755 --- a/t/t6010-merge-base.sh +++ b/t/t6010-merge-base.sh @@ -34,6 +34,12 @@ doit() { echo $commit } +# E---D---C---B---A +# \'-_ \ \ +# \ `---------G \ +# \ \ +# F----------------H + # Setup... E=$(doit 5 E) D=$(doit 4 D $E) @@ -44,6 +50,18 @@ A=$(doit 1 A $B) G=$(doit 7 G $B $E) H=$(doit 8 H $A $F) +test_expect_success 'compute merge-base (single)' \ + 'MB=$(git-merge-base G H) && + expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"' + +test_expect_success 'compute merge-base (all)' \ + 'MB=$(git-merge-base --all G H) && + expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"' + +test_expect_success 'compute merge-base with show-branch' \ + 'MB=$(git-show-branch --merge-base G H) && + expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"' + # Setup for second test to demonstrate that relying on timestamps in a # distributed SCM to provide a _consistent_ partial ordering of commits # leads to insanity. @@ -81,18 +99,6 @@ R2=$(doit 3 R2 $R1) PL=$(doit 4 PL $L2 $C2) PR=$(doit 4 PR $C2 $R2) -test_expect_success 'compute merge-base (single)' \ - 'MB=$(git-merge-base G H) && - expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"' - -test_expect_success 'compute merge-base (all)' \ - 'MB=$(git-merge-base --all G H) && - expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"' - -test_expect_success 'compute merge-base with show-branch' \ - 'MB=$(git-show-branch --merge-base G H) && - expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"' - test_expect_success 'compute merge-base (single)' \ 'MB=$(git-merge-base PL PR) && expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/C2"' -- cgit v1.2.3 From b69ba460bb0710b2af8a20b4b0d62233f29401ec Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Mon, 25 Jun 2007 16:03:54 +0200 Subject: config: Change output of --get-regexp for valueless keys Print no space after the name of a key without value. Otherwise keys without values are printed exactly the same as keys with empty values. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- t/t1300-repo-config.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 't') diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 3f3fd2d7f7..f1a78b19ac 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -283,6 +283,12 @@ EOF test_expect_success 'get variable with no value' \ 'git-config --get novalue.variable ^$' +echo novalue.variable > expect + +test_expect_success 'get-regexp variable with no value' \ + 'git-config --get-regexp novalue > output && + cmp output expect' + git-config > output 2>&1 test_expect_success 'no arguments, but no crash' \ -- cgit v1.2.3 From c54b7817f4f6bf422ea532d81217c28f63c259c5 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 25 Jun 2007 18:56:55 +0100 Subject: rebase -i: several cleanups Support "--verbose" in addition to "-v", show short names in the list comment, clean up if there is nothing to do, and add several "test_ticks" in the test script. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 48aa8ea814..19a3a8e813 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -140,6 +140,7 @@ test_expect_success 'abort' ' test_expect_success 'retain authorship' ' echo A > file7 && git add file7 && + test_tick && GIT_AUTHOR_NAME="Twerp Snog" git commit -m "different author" && git tag twerp && git rebase -i --onto master HEAD^ && @@ -149,6 +150,7 @@ test_expect_success 'retain authorship' ' test_expect_success 'squash' ' git reset --hard twerp && echo B > file7 && + test_tick && GIT_AUTHOR_NAME="Nitfol" git commit -m "nitfol" file7 && echo "******************************" && FAKE_LINES="1 squash 2" git rebase -i --onto master HEAD~2 && -- cgit v1.2.3 From 68a163c9b483ae352fcfee8c4505d113213daa73 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 25 Jun 2007 18:58:28 +0100 Subject: rebase -i: provide reasonable reflog for the rebased branch If your rebase succeeded, the HEAD's reflog will still show the whole mess, but "@{1}" now shows the state _before_ the rebase, so that you can reset (or compare) the original and the rebased revisions more easily. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 19a3a8e813..9f12bb9321 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -99,6 +99,10 @@ test_expect_success 'rebase on top of a non-conflicting commit' ' test $(git rev-parse I) = $(git rev-parse HEAD~2) ' +test_expect_success 'reflog for the branch shows state before rebase' ' + test $(git rev-parse branch1@{1}) = $(git rev-parse original-branch1) +' + test_expect_success 'exchange two commits' ' FAKE_LINES="2 1" git rebase -i HEAD~2 && test H = $(git cat-file commit HEAD^ | tail -n 1) && -- cgit v1.2.3 From f09c9b8c5ff9d8a15499b09ccd6c3e7b3c76af77 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 25 Jun 2007 18:59:43 +0100 Subject: Teach rebase -i about --preserve-merges The option "-p" (or long "--preserve-merges") makes it possible to rebase side branches including merges, without straightening the history. Example: X \ A---M---B / ---o---O---P---Q When the current HEAD is "B", "git rebase -i -p --onto Q O" will yield X \ ---o---O---P---Q---A'---M'---B' Note that this will - _not_ touch X [*1*], it does - _not_ work without the --interactive flag [*2*], it does - _not_ guess the type of the merge, but blindly uses recursive or whatever strategy you provided with "-s " for all merges it has to redo, and it does - _not_ make use of the original merge commit via git-rerere. *1*: only commits which reach a merge base between and HEAD are reapplied. The others are kept as-are. *2*: git-rebase without --interactive is inherently patch based (at least at the moment), and therefore merges cannot be preserved. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 9f12bb9321..883cf29595 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -166,4 +166,26 @@ test_expect_success 'retain authorship when squashing' ' git show HEAD | grep "^Author: Nitfol" ' +test_expect_success 'preserve merges with -p' ' + git checkout -b to-be-preserved master^ && + : > unrelated-file && + git add unrelated-file && + test_tick && + git commit -m "unrelated" && + git checkout -b to-be-rebased master && + echo B > file1 && + test_tick && + git commit -m J file1 && + test_tick && + git merge to-be-preserved && + echo C > file1 && + test_tick && + git commit -m K file1 && + git rebase -i -p --onto branch1 master && + test $(git rev-parse HEAD^^2) = $(git rev-parse to-be-preserved) && + test $(git rev-parse HEAD~3) = $(git rev-parse branch1) && + test $(git show HEAD:file1) = C && + test $(git show HEAD~2:file1) = B +' + test_done -- cgit v1.2.3 From 2275d502114c71045af991697048191fed88aac4 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Mon, 25 Jun 2007 16:03:55 +0200 Subject: config: Add --null/-z option for null-delimted output Use \n as delimiter between key and value and \0 as delimiter after each key/value pair. This should be easily parsable output. Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- t/t1300-repo-config.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 't') diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 84977355a3..7a77bef4c0 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -519,4 +519,36 @@ git config --list > result test_expect_success 'value continued on next line' 'cmp result expect' +cat > .git/config <<\EOF +[section "sub=section"] + val1 = foo=bar + val2 = foo\nbar + val3 = \n\n + val4 = + val5 +EOF + +cat > expect <<\EOF +Key: section.sub=section.val1 +Value: foo=bar +Key: section.sub=section.val2 +Value: foo +bar +Key: section.sub=section.val3 +Value: + + +Key: section.sub=section.val4 +Value: +Key: section.sub=section.val5 +EOF + +git config --null --list | perl -0ne 'chop;($key,$value)=split(/\n/,$_,2);print "Key: $key\n";print "Value: $value\n" if defined($value)' > result + +test_expect_success '--null --list' 'cmp result expect' + +git config --null --get-regexp 'val[0-9]' | perl -0ne 'chop;($key,$value)=split(/\n/,$_,2);print "Key: $key\n";print "Value: $value\n" if defined($value)' > result + +test_expect_success '--null --get-regexp' 'cmp result expect' + test_done -- cgit v1.2.3 From db1696b8ab1d1bde67e78c773c58d837fa8b5e70 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Mon, 25 Jun 2007 16:00:24 +0200 Subject: config: add support for --bool and --int while setting values Signed-off-by: Frank Lichtenheld Signed-off-by: Junio C Hamano --- t/t1300-repo-config.sh | 48 ++++++++++++++++++++++++++++++++++++++++- t/t9400-git-cvsserver-server.sh | 4 ++-- 2 files changed, 49 insertions(+), 3 deletions(-) (limited to 't') diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 7a77bef4c0..9443b875e2 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -471,11 +471,57 @@ test_expect_success bool ' done && cmp expect result' -test_expect_failure 'invalid bool' ' +test_expect_failure 'invalid bool (--get)' ' git-config bool.nobool foobar && git-config --bool --get bool.nobool' +test_expect_failure 'invalid bool (set)' ' + + git-config --bool bool.nobool foobar' + +rm .git/config + +cat > expect <<\EOF +[bool] + true1 = true + true2 = true + true3 = true + true4 = true + false1 = false + false2 = false + false3 = false + false4 = false +EOF + +test_expect_success 'set --bool' ' + + git-config --bool bool.true1 01 && + git-config --bool bool.true2 -1 && + git-config --bool bool.true3 YeS && + git-config --bool bool.true4 true && + git-config --bool bool.false1 000 && + git-config --bool bool.false2 "" && + git-config --bool bool.false3 nO && + git-config --bool bool.false4 FALSE && + cmp expect .git/config' + +rm .git/config + +cat > expect <<\EOF +[int] + val1 = 1 + val2 = -1 + val3 = 5242880 +EOF + +test_expect_success 'set --int' ' + + git-config --int int.val1 01 && + git-config --int int.val2 -1 && + git-config --int int.val3 5m && + cmp expect .git/config' + rm .git/config git-config quote.leading " test" diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh index 0331770686..641303e0a1 100755 --- a/t/t9400-git-cvsserver-server.sh +++ b/t/t9400-git-cvsserver-server.sh @@ -38,7 +38,7 @@ echo >empty && git commit -q -m "First Commit" && git clone -q --local --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 && GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true && - GIT_DIR="$SERVERDIR" git config --bool gitcvs.logfile "$SERVERDIR/gitcvs.log" || + GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log" || exit 1 # note that cvs doesn't accept absolute pathnames @@ -255,7 +255,7 @@ rm -fr "$SERVERDIR" cd "$WORKDIR" && git clone -q --local --bare "$WORKDIR/.git" "$SERVERDIR" >/dev/null 2>&1 && GIT_DIR="$SERVERDIR" git config --bool gitcvs.enabled true && -GIT_DIR="$SERVERDIR" git config --bool gitcvs.logfile "$SERVERDIR/gitcvs.log" || +GIT_DIR="$SERVERDIR" git config gitcvs.logfile "$SERVERDIR/gitcvs.log" || exit 1 test_expect_success 'cvs update (create new file)' \ -- cgit v1.2.3 From 30d038e2ffb5d11cd8047c0e88b71f39f379dd6c Mon Sep 17 00:00:00 2001 From: Carlos Rica Date: Mon, 25 Jun 2007 21:24:21 +0200 Subject: Add test script for git-stripspace. These tests check some features that git-stripspace already has and those that it should manage well: Removing trailing spaces from lines, removing blank lines at the beginning and end, unifying multiple lines between paragraphs, doing the correct when there is no newline at the last line, etc. It seems that the implementation needs to save the whole line in memory to be able to manage correctly long lines with text and spaces conveniently distribuited on them. Signed-off-by: Carlos Rica Signed-off-by: Junio C Hamano --- t/t0030-stripspace.sh | 355 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 355 insertions(+) create mode 100755 t/t0030-stripspace.sh (limited to 't') diff --git a/t/t0030-stripspace.sh b/t/t0030-stripspace.sh new file mode 100755 index 0000000000..f4294d72d9 --- /dev/null +++ b/t/t0030-stripspace.sh @@ -0,0 +1,355 @@ +#!/bin/sh +# +# Copyright (c) 2007 Carlos Rica +# + +test_description='git-stripspace' + +. ./test-lib.sh + +t40='A quick brown fox jumps over the lazy do' +s40=' ' +sss="$s40$s40$s40$s40$s40$s40$s40$s40$s40$s40" # 400 +ttt="$t40$t40$t40$t40$t40$t40$t40$t40$t40$t40" # 400 + +test_expect_success \ + 'long lines without spaces should be unchanged' ' + echo "$ttt" >expect && + git-stripspace actual && + git diff expect actual && + + echo "$ttt$ttt" >expect && + git-stripspace actual && + git diff expect actual && + + echo "$ttt$ttt$ttt" >expect && + git-stripspace actual && + git diff expect actual && + + echo "$ttt$ttt$ttt$ttt" >expect && + git-stripspace actual && + git diff expect actual +' + +test_expect_success \ + 'lines with spaces at the beginning should be unchanged' ' + echo "$sss$ttt" >expect && + git-stripspace actual && + git diff expect actual && + + echo "$sss$sss$ttt" >expect && + git-stripspace actual && + git diff expect actual && + + echo "$sss$sss$sss$ttt" >expect && + git-stripspace actual && + git diff expect actual +' + +test_expect_success \ + 'lines with intermediate spaces should be unchanged' ' + echo "$ttt$sss$ttt" >expect && + git-stripspace actual && + git diff expect actual && + + echo "$ttt$sss$sss$ttt" >expect && + git-stripspace actual && + git diff expect actual +' + +test_expect_success \ + 'consecutive blank lines should be unified' ' + printf "$ttt\n\n$ttt\n" > expect && + printf "$ttt\n\n\n\n\n$ttt\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt$ttt\n\n$ttt\n" > expect && + printf "$ttt$ttt\n\n\n\n\n$ttt\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt$ttt$ttt\n\n$ttt\n" > expect && + printf "$ttt$ttt$ttt\n\n\n\n\n$ttt\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n\n$ttt\n" > expect && + printf "$ttt\n\n\n\n\n$ttt\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n\n$ttt$ttt\n" > expect && + printf "$ttt\n\n\n\n\n$ttt$ttt\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n\n$ttt$ttt$ttt\n" > expect && + printf "$ttt\n\n\n\n\n$ttt$ttt$ttt\n" | git-stripspace >actual && + git diff expect actual +' + +test_expect_success \ + 'consecutive blank lines at the beginning should be removed' ' + printf "" > expect && + printf "\n" | git-stripspace >actual && + git diff expect actual && + + printf "" > expect && + printf "\n\n\n" | git-stripspace >actual && + git diff expect actual && + + printf "" > expect && + printf "$sss\n$sss\n$sss\n" | git-stripspace >actual && + git diff expect actual && + + printf "" > expect && + printf "$sss$sss\n$sss\n\n" | git-stripspace >actual && + git diff expect actual && + + printf "" > expect && + printf "\n$sss\n$sss$sss\n" | git-stripspace >actual && + git diff expect actual && + + printf "" > expect && + printf "$sss$sss$sss$sss\n\n\n" | git-stripspace >actual && + git diff expect actual && + + printf "" > expect && + printf "\n$sss$sss$sss$sss\n\n" | git-stripspace >actual && + git diff expect actual && + + printf "" > expect && + printf "\n\n$sss$sss$sss$sss\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" > expect && + printf "\n$ttt\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" > expect && + printf "\n\n\n$ttt\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt$ttt\n" > expect && + printf "\n\n\n$ttt$ttt\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt$ttt$ttt\n" > expect && + printf "\n\n\n$ttt$ttt$ttt\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt$ttt$ttt$ttt\n" > expect && + printf "\n\n\n$ttt$ttt$ttt$ttt\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" > expect && + printf "$sss\n$sss\n$sss\n$ttt\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" > expect && + printf "\n$sss\n$sss$sss\n$ttt\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" > expect && + printf "$sss$sss\n$sss\n\n$ttt\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" > expect && + printf "$sss$sss$sss\n\n\n$ttt\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" > expect && + printf "\n$sss$sss$sss\n\n$ttt\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" > expect && + printf "\n\n$sss$sss$sss\n$ttt\n" | git-stripspace >actual && + git diff expect actual +' + +test_expect_success \ + 'consecutive blank lines at the end should be removed' ' + printf "$ttt\n" > expect && + printf "$ttt\n\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" > expect && + printf "$ttt\n\n\n\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt$ttt\n" > expect && + printf "$ttt$ttt\n\n\n\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt$ttt$ttt\n" > expect && + printf "$ttt$ttt$ttt\n\n\n\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt$ttt$ttt$ttt\n" > expect && + printf "$ttt$ttt$ttt$ttt\n\n\n\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" > expect && + printf "$ttt\n$sss\n$sss\n$sss\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" > expect && + printf "$ttt\n\n$sss\n$sss$sss\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" > expect && + printf "$ttt\n$sss$sss\n$sss\n\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" > expect && + printf "$ttt\n$sss$sss$sss\n\n\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" > expect && + printf "$ttt\n\n$sss$sss$sss\n\n" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" > expect && + printf "$ttt\n\n\n$sss$sss$sss\n" | git-stripspace >actual && + git diff expect actual +' + +test_expect_success \ + 'text without newline at end should end with newline' ' + test `printf "$ttt" | git-stripspace | wc -l` -gt 0 && + test `printf "$ttt$ttt" | git-stripspace | wc -l` -gt 0 && + test `printf "$ttt$ttt$ttt" | git-stripspace | wc -l` -gt 0 && + test `printf "$ttt$ttt$ttt$ttt" | git-stripspace | wc -l` -gt 0 +' + +# text plus spaces at the end: + +test_expect_success \ + 'text plus spaces without newline at end should end with newline' ' + test `printf "$ttt$sss" | git-stripspace | wc -l` -gt 0 && + test `printf "$ttt$ttt$sss" | git-stripspace | wc -l` -gt 0 && + test `printf "$ttt$ttt$ttt$sss" | git-stripspace | wc -l` -gt 0 + test `printf "$ttt$sss$sss" | git-stripspace | wc -l` -gt 0 && + test `printf "$ttt$ttt$sss$sss" | git-stripspace | wc -l` -gt 0 && + test `printf "$ttt$sss$sss$sss" | git-stripspace | wc -l` -gt 0 +' + +test_expect_failure \ + 'text plus spaces without newline at end should not show spaces' ' + printf "$ttt$sss" | git-stripspace | grep -q " " || + printf "$ttt$ttt$sss" | git-stripspace | grep -q " " || + printf "$ttt$ttt$ttt$sss" | git-stripspace | grep -q " " || + printf "$ttt$sss$sss" | git-stripspace | grep -q " " || + printf "$ttt$ttt$sss$sss" | git-stripspace | grep -q " " || + printf "$ttt$sss$sss$sss" | git-stripspace | grep -q " " +' + +test_expect_success \ + 'text plus spaces without newline should show the correct lines' ' + printf "$ttt\n" >expect && + printf "$ttt$sss" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" >expect && + printf "$ttt$sss$sss" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt\n" >expect && + printf "$ttt$sss$sss$sss" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt$ttt\n" >expect && + printf "$ttt$ttt$sss" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt$ttt\n" >expect && + printf "$ttt$ttt$sss$sss" | git-stripspace >actual && + git diff expect actual && + + printf "$ttt$ttt$ttt\n" >expect && + printf "$ttt$ttt$ttt$sss" | git-stripspace >actual && + git diff expect actual +' + +test_expect_failure \ + 'text plus spaces at end should not show spaces' ' + echo "$ttt$sss" | git-stripspace | grep -q " " || + echo "$ttt$ttt$sss" | git-stripspace | grep -q " " || + echo "$ttt$ttt$ttt$sss" | git-stripspace | grep -q " " || + echo "$ttt$sss$sss" | git-stripspace | grep -q " " || + echo "$ttt$ttt$sss$sss" | git-stripspace | grep -q " " || + echo "$ttt$sss$sss$sss" | git-stripspace | grep -q " " +' + +test_expect_success \ + 'text plus spaces at end should be cleaned and newline must remain' ' + echo "$ttt" >expect && + echo "$ttt$sss" | git-stripspace >actual && + git diff expect actual && + + echo "$ttt" >expect && + echo "$ttt$sss$sss" | git-stripspace >actual && + git diff expect actual && + + echo "$ttt" >expect && + echo "$ttt$sss$sss$sss" | git-stripspace >actual && + git diff expect actual && + + echo "$ttt$ttt" >expect && + echo "$ttt$ttt$sss" | git-stripspace >actual && + git diff expect actual && + + echo "$ttt$ttt" >expect && + echo "$ttt$ttt$sss$sss" | git-stripspace >actual && + git diff expect actual && + + echo "$ttt$ttt$ttt" >expect && + echo "$ttt$ttt$ttt$sss" | git-stripspace >actual && + git diff expect actual +' + +# spaces only: + +test_expect_success \ + 'spaces with newline at end should be replaced with empty string' ' + printf "" >expect && + + echo | git-stripspace >actual && + git diff expect actual && + + echo "$sss" | git-stripspace >actual && + git diff expect actual && + + echo "$sss$sss" | git-stripspace >actual && + git diff expect actual && + + echo "$sss$sss$sss" | git-stripspace >actual && + git diff expect actual && + + echo "$sss$sss$sss$sss" | git-stripspace >actual && + git diff expect actual +' + +test_expect_failure \ + 'spaces without newline at end should not show spaces' ' + printf "" | git-stripspace | grep -q " " || + printf "$sss" | git-stripspace | grep -q " " || + printf "$sss$sss" | git-stripspace | grep -q " " || + printf "$sss$sss$sss" | git-stripspace | grep -q " " || + printf "$sss$sss$sss$sss" | git-stripspace | grep -q " " +' + +test_expect_success \ + 'spaces without newline at end should be replaced with empty string' ' + printf "" >expect && + + printf "" | git-stripspace >actual && + git diff expect actual + + printf "$sss$sss" | git-stripspace >actual && + git diff expect actual + + printf "$sss$sss$sss" | git-stripspace >actual && + git diff expect actual + + printf "$sss$sss$sss$sss" | git-stripspace >actual && + git diff expect actual +' + +test_done -- cgit v1.2.3 From ef5a6fb59759006605b36c28cb1e61ec08ac2725 Mon Sep 17 00:00:00 2001 From: Carlos Rica Date: Thu, 28 Jun 2007 22:09:12 +0200 Subject: Add test-script for git-tag These tests are useful to develop the C version for git-tag.sh, ensuring that the future builtin-tag.c will not break previous behaviour. The tests are focused on listing, verifying, deleting and creating tags, checking always that the correct status value is returned and everything remains as expected. In order to verify and create signed tags, a PGP key was also added, being created this way: gpg --homedir t/t7004 --gen-key Type DSA and Elgamal, size 2048 bits, no expiration date. Name and email: C O Mitter No password given, to enable non-interactive operation. Signed-off-by: Carlos Rica Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 686 ++++++++++++++++++++++++++++++++++++++++++++++++++++ t/t7004/pubring.gpg | Bin 0 -> 1164 bytes t/t7004/random_seed | Bin 0 -> 600 bytes t/t7004/secring.gpg | Bin 0 -> 1237 bytes 4 files changed, 686 insertions(+) create mode 100755 t/t7004-tag.sh create mode 100644 t/t7004/pubring.gpg create mode 100644 t/t7004/random_seed create mode 100644 t/t7004/secring.gpg (limited to 't') diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh new file mode 100755 index 0000000000..5d15449be5 --- /dev/null +++ b/t/t7004-tag.sh @@ -0,0 +1,686 @@ +#!/bin/sh +# +# Copyright (c) 2007 Carlos Rica +# + +test_description='git-tag + +Basic tests for operations with tags.' + +. ./test-lib.sh + +# creating and listing lightweight tags: + +tag_exists () { + git show-ref --quiet --verify refs/tags/"$1" +} + +# todo: git tag -l now returns always zero, when fixed, change this test +test_expect_success 'listing all tags in an empty tree should succeed' \ + 'git tag -l' + +test_expect_success 'listing all tags in an empty tree should output nothing' \ + 'test `git-tag -l | wc -l` -eq 0' + +test_expect_failure 'looking for a tag in an empty tree should fail' \ + 'tag_exists mytag' + +test_expect_success 'creating a tag in an empty tree should fail' ' + ! git-tag mynotag && + ! tag_exists mynotag +' + +test_expect_success 'creating a tag for HEAD in an empty tree should fail' ' + ! git-tag mytaghead HEAD && + ! tag_exists mytaghead +' + +test_expect_success 'creating a tag for an unknown revision should fail' ' + ! git-tag mytagnorev aaaaaaaaaaa && + ! tag_exists mytagnorev +' + +# commit used in the tests, test_tick is also called here to freeze the date: +test_expect_success 'creating a tag using default HEAD should succeed' ' + test_tick && + echo foo >foo && + git add foo && + git commit -m Foo && + git tag mytag +' + +test_expect_success 'listing all tags if one exists should succeed' \ + 'git-tag -l' + +test_expect_success 'listing all tags if one exists should output that tag' \ + 'test `git-tag -l` = mytag' + +# pattern matching: + +test_expect_success 'listing a tag using a matching pattern should succeed' \ + 'git-tag -l mytag' + +test_expect_success \ + 'listing a tag using a matching pattern should output that tag' \ + 'test `git-tag -l mytag` = mytag' + +# todo: git tag -l now returns always zero, when fixed, change this test +test_expect_success \ + 'listing tags using a non-matching pattern should suceed' \ + 'git-tag -l xxx' + +test_expect_success \ + 'listing tags using a non-matching pattern should output nothing' \ + 'test `git-tag -l xxx | wc -l` -eq 0' + +# special cases for creating tags: + +test_expect_failure \ + 'trying to create a tag with the name of one existing should fail' \ + 'git tag mytag' + +test_expect_success \ + 'trying to create a tag with a non-valid name should fail' ' + test `git-tag -l | wc -l` -eq 1 && + ! git tag "" && + ! git tag .othertag && + ! git tag "other tag" && + ! git tag "othertag^" && + ! git tag "other~tag" && + test `git-tag -l | wc -l` -eq 1 +' + +test_expect_success 'creating a tag using HEAD directly should succeed' ' + git tag myhead HEAD && + tag_exists myhead +' + +# deleting tags: + +test_expect_success 'trying to delete an unknown tag should fail' ' + ! tag_exists unknown-tag && + ! git-tag -d unknown-tag +' + +cat >expect < actual && git diff expect actual && + git-tag -d && + git tag -l > actual && git diff expect actual +' + +test_expect_success \ + 'deleting two existing tags in one command should succeed' ' + tag_exists mytag && + tag_exists myhead && + git-tag -d mytag myhead && + ! tag_exists mytag && + ! tag_exists myhead +' + +test_expect_success \ + 'creating a tag with the name of another deleted one should succeed' ' + ! tag_exists mytag && + git-tag mytag && + tag_exists mytag +' + +test_expect_success \ + 'trying to delete two tags, existing and not, should fail in the 2nd' ' + tag_exists mytag && + ! tag_exists myhead && + ! git-tag -d mytag anothertag && + ! tag_exists mytag && + ! tag_exists myhead +' + +test_expect_failure 'trying to delete an already deleted tag should fail' \ + 'git-tag -d mytag' + +# listing various tags with pattern matching: + +cat >expect < actual + git diff expect actual +' + +cat >expect < actual && + git-diff expect actual +' + +cat >expect < actual && + git-diff expect actual +' + +cat >expect < actual && + git-diff expect actual +' + +cat >expect < actual && + git-diff expect actual +' + +cat >expect < actual && + git-diff expect actual +' + +cat >expect < actual && + git-diff expect actual +' + +>expect +test_expect_success \ + 'listing tags using v.* should print nothing because none have v.' ' + git-tag -l "v.*" > actual && + git-diff expect actual +' + +cat >expect < actual && + git-diff expect actual +' + +# creating and verifying lightweight tags: + +test_expect_success \ + 'a non-annotated tag created without parameters should point to HEAD' ' + git-tag non-annotated-tag && + test $(git-cat-file -t non-annotated-tag) = commit && + test $(git-rev-parse non-annotated-tag) = $(git-rev-parse HEAD) +' + +test_expect_failure 'trying to verify an unknown tag should fail' \ + 'git-tag -v unknown-tag' + +test_expect_failure \ + 'trying to verify a non-annotated and non-signed tag should fail' \ + 'git-tag -v non-annotated-tag' + +# creating annotated tags: + +get_tag_msg () { + git cat-file tag "$1" | sed -e "/BEGIN PGP/q" +} + +# run test_tick before committing always gives the time in that timezone +get_tag_header () { +cat < $4 -0700 + +EOF +} + +commit=$(git rev-parse HEAD) +time=$test_tick + +get_tag_header annotated-tag $commit commit $time >expect +echo "A message" >>expect +test_expect_success \ + 'creating an annotated tag with -m message should succeed' ' + git-tag -m "A message" annotated-tag && + get_tag_msg annotated-tag >actual && + git diff expect actual +' + +cat >msgfile <expect +cat msgfile >>expect +test_expect_success \ + 'creating an annotated tag with -F messagefile should succeed' ' + git-tag -F msgfile file-annotated-tag && + get_tag_msg file-annotated-tag >actual && + git diff expect actual +' + +# blank and empty messages: + +get_tag_header empty-annotated-tag $commit commit $time >expect +test_expect_success \ + 'creating a tag with an empty -m message should succeed' ' + git-tag -m "" empty-annotated-tag && + get_tag_msg empty-annotated-tag >actual && + git diff expect actual +' + +>emptyfile +get_tag_header emptyfile-annotated-tag $commit commit $time >expect +test_expect_success \ + 'creating a tag with an empty -F messagefile should succeed' ' + git-tag -F emptyfile emptyfile-annotated-tag && + get_tag_msg emptyfile-annotated-tag >actual && + git diff expect actual +' + +printf '\n\n \n\t\nLeading blank lines\n' >blanksfile +printf '\n\t \t \nRepeated blank lines\n' >>blanksfile +printf '\n\n\nTrailing spaces \t \n' >>blanksfile +printf '\nTrailing blank lines\n\n\t \n\n' >>blanksfile +get_tag_header blanks-annotated-tag $commit commit $time >expect +cat >>expect <actual && + git diff expect actual +' + +get_tag_header blank-annotated-tag $commit commit $time >expect +test_expect_success \ + 'creating a tag with blank -m message with spaces should succeed' ' + git-tag -m " " blank-annotated-tag && + get_tag_msg blank-annotated-tag >actual && + git diff expect actual +' + +echo ' ' >blankfile +echo '' >>blankfile +echo ' ' >>blankfile +get_tag_header blankfile-annotated-tag $commit commit $time >expect +test_expect_success \ + 'creating a tag with blank -F messagefile with spaces should succeed' ' + git-tag -F blankfile blankfile-annotated-tag && + get_tag_msg blankfile-annotated-tag >actual && + git diff expect actual +' + +printf ' ' >blanknonlfile +get_tag_header blanknonlfile-annotated-tag $commit commit $time >expect +test_expect_success \ + 'creating a tag with -F file of spaces and no newline should succeed' ' + git-tag -F blanknonlfile blanknonlfile-annotated-tag && + get_tag_msg blanknonlfile-annotated-tag >actual && + git diff expect actual +' + +# messages with commented lines: + +cat >commentsfile <expect +cat >>expect <actual && + git diff expect actual +' + +get_tag_header comment-annotated-tag $commit commit $time >expect +test_expect_success \ + 'creating a tag with a #comment in the -m message should succeed' ' + git-tag -m "#comment" comment-annotated-tag && + get_tag_msg comment-annotated-tag >actual && + git diff expect actual +' + +echo '#comment' >commentfile +echo '' >>commentfile +echo '####' >>commentfile +get_tag_header commentfile-annotated-tag $commit commit $time >expect +test_expect_success \ + 'creating a tag with #comments in the -F messagefile should succeed' ' + git-tag -F commentfile commentfile-annotated-tag && + get_tag_msg commentfile-annotated-tag >actual && + git diff expect actual +' + +printf '#comment' >commentnonlfile +get_tag_header commentnonlfile-annotated-tag $commit commit $time >expect +test_expect_success \ + 'creating a tag with a file of #comment and no newline should succeed' ' + git-tag -F commentnonlfile commentnonlfile-annotated-tag && + get_tag_msg commentnonlfile-annotated-tag >actual && + git diff expect actual +' + +# trying to verify annotated non-signed tags: + +test_expect_success \ + 'trying to verify an annotated non-signed tag should fail' ' + tag_exists annotated-tag && + ! git-tag -v annotated-tag +' + +test_expect_success \ + 'trying to verify a file-annotated non-signed tag should fail' ' + tag_exists file-annotated-tag && + ! git-tag -v file-annotated-tag +' + +# creating and verifying signed tags: + +gpg --version >/dev/null +if [ $? -eq 127 ]; then + echo "Skipping signed tags tests, because gpg was not found" + test_done + exit +fi + +# key generation info: gpg --homedir t/t7004 --gen-key +# Type DSA and Elgamal, size 2048 bits, no expiration date. +# Name and email: C O Mitter +# No password given, to enable non-interactive operation. + +cp -R ../t7004 ./gpghome +chmod 0700 gpghome +export GNUPGHOME="$(pwd)/gpghome" + +get_tag_header signed-tag $commit commit $time >expect +echo 'A signed tag message' >>expect +echo '-----BEGIN PGP SIGNATURE-----' >>expect +test_expect_success 'creating a signed tag with -m message should succeed' ' + git-tag -s -m "A signed tag message" signed-tag && + get_tag_msg signed-tag >actual && + git-diff expect actual +' + +test_expect_success 'verifying a signed tag should succeed' \ + 'git-tag -v signed-tag' + +test_expect_success 'verifying a forged tag should fail' ' + forged=$(git cat-file tag signed-tag | + sed -e "s/signed-tag/forged-tag/" | + git mktag) && + git tag forged-tag $forged && + ! git-tag -v forged-tag +' + +# blank and empty messages for signed tags: + +get_tag_header empty-signed-tag $commit commit $time >expect +echo '-----BEGIN PGP SIGNATURE-----' >>expect +test_expect_success \ + 'creating a signed tag with an empty -m message should succeed' ' + git-tag -s -m "" empty-signed-tag && + get_tag_msg empty-signed-tag >actual && + git diff expect actual && + git-tag -v empty-signed-tag +' + +>sigemptyfile +get_tag_header emptyfile-signed-tag $commit commit $time >expect +echo '-----BEGIN PGP SIGNATURE-----' >>expect +test_expect_success \ + 'creating a signed tag with an empty -F messagefile should succeed' ' + git-tag -s -F sigemptyfile emptyfile-signed-tag && + get_tag_msg emptyfile-signed-tag >actual && + git diff expect actual && + git-tag -v emptyfile-signed-tag +' + +printf '\n\n \n\t\nLeading blank lines\n' > sigblanksfile +printf '\n\t \t \nRepeated blank lines\n' >>sigblanksfile +printf '\n\n\nTrailing spaces \t \n' >>sigblanksfile +printf '\nTrailing blank lines\n\n\t \n\n' >>sigblanksfile +get_tag_header blanks-signed-tag $commit commit $time >expect +cat >>expect <>expect +test_expect_success \ + 'extra blanks in the message for a signed tag should be removed' ' + git-tag -s -F sigblanksfile blanks-signed-tag && + get_tag_msg blanks-signed-tag >actual && + git diff expect actual && + git-tag -v blanks-signed-tag +' + +get_tag_header blank-signed-tag $commit commit $time >expect +echo '-----BEGIN PGP SIGNATURE-----' >>expect +test_expect_success \ + 'creating a signed tag with a blank -m message should succeed' ' + git-tag -s -m " " blank-signed-tag && + get_tag_msg blank-signed-tag >actual && + git diff expect actual && + git-tag -v blank-signed-tag +' + +echo ' ' >sigblankfile +echo '' >>sigblankfile +echo ' ' >>sigblankfile +get_tag_header blankfile-signed-tag $commit commit $time >expect +echo '-----BEGIN PGP SIGNATURE-----' >>expect +test_expect_success \ + 'creating a signed tag with blank -F file with spaces should succeed' ' + git-tag -s -F sigblankfile blankfile-signed-tag && + get_tag_msg blankfile-signed-tag >actual && + git diff expect actual && + git-tag -v blankfile-signed-tag +' + +printf ' ' >sigblanknonlfile +get_tag_header blanknonlfile-signed-tag $commit commit $time >expect +echo '-----BEGIN PGP SIGNATURE-----' >>expect +test_expect_success \ + 'creating a signed tag with spaces and no newline should succeed' ' + git-tag -s -F sigblanknonlfile blanknonlfile-signed-tag && + get_tag_msg blanknonlfile-signed-tag >actual && + git diff expect actual && + git-tag -v signed-tag +' + +# messages with commented lines for signed tags: + +cat >sigcommentsfile <expect +cat >>expect <>expect +test_expect_success \ + 'creating a signed tag with a -F file with #comments should succeed' ' + git-tag -s -F sigcommentsfile comments-signed-tag && + get_tag_msg comments-signed-tag >actual && + git diff expect actual && + git-tag -v comments-signed-tag +' + +get_tag_header comment-signed-tag $commit commit $time >expect +echo '-----BEGIN PGP SIGNATURE-----' >>expect +test_expect_success \ + 'creating a signed tag with #commented -m message should succeed' ' + git-tag -s -m "#comment" comment-signed-tag && + get_tag_msg comment-signed-tag >actual && + git diff expect actual && + git-tag -v comment-signed-tag +' + +echo '#comment' >sigcommentfile +echo '' >>sigcommentfile +echo '####' >>sigcommentfile +get_tag_header commentfile-signed-tag $commit commit $time >expect +echo '-----BEGIN PGP SIGNATURE-----' >>expect +test_expect_success \ + 'creating a signed tag with #commented -F messagefile should succeed' ' + git-tag -s -F sigcommentfile commentfile-signed-tag && + get_tag_msg commentfile-signed-tag >actual && + git diff expect actual && + git-tag -v commentfile-signed-tag +' + +printf '#comment' >sigcommentnonlfile +get_tag_header commentnonlfile-signed-tag $commit commit $time >expect +echo '-----BEGIN PGP SIGNATURE-----' >>expect +test_expect_success \ + 'creating a signed tag with a #comment and no newline should succeed' ' + git-tag -s -F sigcommentnonlfile commentnonlfile-signed-tag && + get_tag_msg commentnonlfile-signed-tag >actual && + git diff expect actual && + git-tag -v commentnonlfile-signed-tag +' + +# tags pointing to objects different from commits: + +tree=$(git rev-parse HEAD^{tree}) +blob=$(git rev-parse HEAD:foo) +tag=$(git rev-parse signed-tag) + +get_tag_header tree-signed-tag $tree tree $time >expect +echo "A message for a tree" >>expect +echo '-----BEGIN PGP SIGNATURE-----' >>expect +test_expect_success \ + 'creating a signed tag pointing to a tree should succeed' ' + git-tag -s -m "A message for a tree" tree-signed-tag HEAD^{tree} && + get_tag_msg tree-signed-tag >actual && + git diff expect actual +' + +get_tag_header blob-signed-tag $blob blob $time >expect +echo "A message for a blob" >>expect +echo '-----BEGIN PGP SIGNATURE-----' >>expect +test_expect_success \ + 'creating a signed tag pointing to a blob should succeed' ' + git-tag -s -m "A message for a blob" blob-signed-tag HEAD:foo && + get_tag_msg blob-signed-tag >actual && + git diff expect actual +' + +get_tag_header tag-signed-tag $tag tag $time >expect +echo "A message for another tag" >>expect +echo '-----BEGIN PGP SIGNATURE-----' >>expect +test_expect_success \ + 'creating a signed tag pointing to another tag should succeed' ' + git-tag -s -m "A message for another tag" tag-signed-tag signed-tag && + get_tag_msg tag-signed-tag >actual && + git diff expect actual +' + +# try to verify without gpg: + +rm -rf gpghome +test_expect_failure \ + 'verify signed tag fails when public key is not present' \ + 'git-tag -v signed-tag' + +test_done diff --git a/t/t7004/pubring.gpg b/t/t7004/pubring.gpg new file mode 100644 index 0000000000..83855fa4e1 Binary files /dev/null and b/t/t7004/pubring.gpg differ diff --git a/t/t7004/random_seed b/t/t7004/random_seed new file mode 100644 index 0000000000..8fed1339ed Binary files /dev/null and b/t/t7004/random_seed differ diff --git a/t/t7004/secring.gpg b/t/t7004/secring.gpg new file mode 100644 index 0000000000..d831cd9eb3 Binary files /dev/null and b/t/t7004/secring.gpg differ -- cgit v1.2.3 From 2b9a50208f2664d228b238affd8496d4d9677d56 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Wed, 27 Jun 2007 14:40:41 +0200 Subject: Avoid perl in t1300-repo-config It fixes the test on system where ActiveState Perl is used. Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- t/t1300-repo-config.sh | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 't') diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 7a77bef4c0..27486de4de 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -529,25 +529,23 @@ cat > .git/config <<\EOF EOF cat > expect <<\EOF -Key: section.sub=section.val1 -Value: foo=bar -Key: section.sub=section.val2 -Value: foo -bar -Key: section.sub=section.val3 -Value: +section.sub=section.val1 +foo=barQsection.sub=section.val2 +foo +barQsection.sub=section.val3 -Key: section.sub=section.val4 -Value: -Key: section.sub=section.val5 +Qsection.sub=section.val4 +Qsection.sub=section.val5Q EOF -git config --null --list | perl -0ne 'chop;($key,$value)=split(/\n/,$_,2);print "Key: $key\n";print "Value: $value\n" if defined($value)' > result +git config --null --list | tr '[\000]' 'Q' > result +echo >>result test_expect_success '--null --list' 'cmp result expect' -git config --null --get-regexp 'val[0-9]' | perl -0ne 'chop;($key,$value)=split(/\n/,$_,2);print "Key: $key\n";print "Value: $value\n" if defined($value)' > result +git config --null --get-regexp 'val[0-9]' | tr '[\000]' 'Q' > result +echo >>result test_expect_success '--null --get-regexp' 'cmp result expect' -- cgit v1.2.3 From b9905fed7a028cc9749cf8ad479cbb07940c8638 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 28 Jun 2007 23:14:13 -0700 Subject: diffcore-delta.c: Ignore CR in CRLF for text files This ignores CR byte in CRLF sequence in text file when computing similarity of two blobs. Usually this should not matter as nobody sane would be checking in a file with CRLF line endings to the repository (they would use autocrlf so that the repository copy would have LF line endings). Signed-off-by: Junio C Hamano --- t/t0022-crlf-rename.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 t/t0022-crlf-rename.sh (limited to 't') diff --git a/t/t0022-crlf-rename.sh b/t/t0022-crlf-rename.sh new file mode 100755 index 0000000000..430a1d1d38 --- /dev/null +++ b/t/t0022-crlf-rename.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +test_description='ignore CR in CRLF sequence while computing similiarity' + +. ./test-lib.sh + +test_expect_success setup ' + + cat ../t0022-crlf-rename.sh >sample && + git add sample && + + test_tick && + git commit -m Initial && + + sed -e "s/\$/ /" ../t0022-crlf-rename.sh >elpmas && + git add elpmas && + rm -f sample && + + test_tick && + git commit -a -m Second + +' + +test_expect_success 'diff -M' ' + + git diff-tree -M -r --name-status HEAD^ HEAD | + sed -e "s/R[0-9]*/RNUM/" >actual && + echo "RNUM sample elpmas" >expect && + diff -u expect actual + +' + +test_done -- cgit v1.2.3 From a44c4267090366c81303b964ab64f3d51b78f885 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 30 Jun 2007 20:14:01 -0700 Subject: t7004: ship trustdb to avoid gpg warnings This avoids warning messages from gpg while verifying the tags; without it, the program complains that the key is not certified with a trusted signature. Signed-off-by: Junio C Hamano --- t/t7004/trustdb.gpg | Bin 0 -> 1280 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 t/t7004/trustdb.gpg (limited to 't') diff --git a/t/t7004/trustdb.gpg b/t/t7004/trustdb.gpg new file mode 100644 index 0000000000..abace962b8 Binary files /dev/null and b/t/t7004/trustdb.gpg differ -- cgit v1.2.3 From 20314271679e169f324c118c69c8d9e0399feec9 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 29 Jun 2007 18:32:46 +0100 Subject: git add: respect core.filemode with unmerged entries When a merge left unmerged entries, git add failed to pick up the file mode from the index, when core.filemode == 0. If more than one unmerged entry is there, the order of stage preference is 2, 1, 3. Noticed by Johannes Sixt. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3700-add.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 't') diff --git a/t/t3700-add.sh b/t/t3700-add.sh index ad8cc7d4ae..0d80c6aead 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -110,4 +110,30 @@ test_expect_success 'check correct prefix detection' ' git add 1/2/a 1/3/b 1/2/c ' +test_expect_success 'git add and filemode=0 with unmerged entries' ' + echo 1 > stage1 && + echo 2 > stage2 && + echo 3 > stage3 && + for s in 1 2 3 + do + echo "100755 $(git hash-object -w stage$s) $s file" + done | git update-index --index-info && + git config core.filemode 0 && + echo new > file && + git add file && + git ls-files --stage | grep "^100755 .* 0 file$" +' + +test_expect_success 'git add and filemode=0 prefers stage 2 over stage 1' ' + git rm --cached -f file && + ( + echo "100644 $(git hash-object -w stage1) 1 file" + echo "100755 $(git hash-object -w stage2) 2 file" + ) | git update-index --index-info && + git config core.filemode 0 && + echo new > file && + git add file && + git ls-files --stage | grep "^100755 .* 0 file$" +' + test_done -- cgit v1.2.3 From 9a3c6f7ba7c567e277da58a45ac6fa50461297e3 Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Sun, 1 Jul 2007 11:48:54 -0400 Subject: Fix t5516-fetch for systems where `wc -l` outputs whitespace. When wc outputs whitespace, the test "$(command | wc -l)" = 1 is broken because " 1" != "1". Let the shell eat the whitespace by using test 1 = $(command | wc -l) instead. Signed-off-by: Brian Gernhardt Signed-off-by: Junio C Hamano --- t/t5516-fetch-push.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index 08d58e1c8c..c0fa2ba404 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -226,7 +226,7 @@ test_expect_success 'push with colon-less refspec (3)' ' git branch -f frotz master && git push testrepo frotz && check_push_result $the_commit heads/frotz && - test "$( cd testrepo && git show-ref | wc -l )" = 1 + test 1 = $( cd testrepo && git show-ref | wc -l ) ' test_expect_success 'push with colon-less refspec (4)' ' @@ -239,7 +239,7 @@ test_expect_success 'push with colon-less refspec (4)' ' git tag -f frotz && git push testrepo frotz && check_push_result $the_commit tags/frotz && - test "$( cd testrepo && git show-ref | wc -l )" = 1 + test 1 = $( cd testrepo && git show-ref | wc -l ) ' -- cgit v1.2.3 From 05dcd69891632101d347b2f8a6bc37a08878aa1a Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Mon, 2 Jul 2007 13:28:42 +0200 Subject: Test 'git add' for unmerged entries when core.symlinks=false. In 20314271679e169f324c118c69c8d9e0399feec9 git add was fixed if unmerged entries are in the index and core.filemode=false. core.symlinks=false is a similar case, which touches the same code path. Here is a test that makes sure that the symlink property in the index is preserved, too. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t3700-add.sh | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) (limited to 't') diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 0d80c6aead..e6466d74a0 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -110,30 +110,37 @@ test_expect_success 'check correct prefix detection' ' git add 1/2/a 1/3/b 1/2/c ' -test_expect_success 'git add and filemode=0 with unmerged entries' ' - echo 1 > stage1 && - echo 2 > stage2 && - echo 3 > stage3 && +test_expect_success 'git add with filemode=0, symlinks=0, and unmerged entries' ' for s in 1 2 3 do + echo $s > stage$s echo "100755 $(git hash-object -w stage$s) $s file" + echo "120000 $(printf $s | git hash-object -w -t blob --stdin) $s symlink" done | git update-index --index-info && git config core.filemode 0 && + git config core.symlinks 0 && echo new > file && - git add file && - git ls-files --stage | grep "^100755 .* 0 file$" + echo new > symlink && + git add file symlink && + git ls-files --stage | grep "^100755 .* 0 file$" && + git ls-files --stage | grep "^120000 .* 0 symlink$" ' -test_expect_success 'git add and filemode=0 prefers stage 2 over stage 1' ' - git rm --cached -f file && +test_expect_success 'git add with filemode=0, symlinks=0 prefers stage 2 over stage 1' ' + git rm --cached -f file symlink && ( echo "100644 $(git hash-object -w stage1) 1 file" echo "100755 $(git hash-object -w stage2) 2 file" + echo "100644 $(printf $s | git hash-object -w -t blob --stdin) 1 symlink" + echo "120000 $(printf $s | git hash-object -w -t blob --stdin) 2 symlink" ) | git update-index --index-info && git config core.filemode 0 && + git config core.symlinks 0 && echo new > file && - git add file && - git ls-files --stage | grep "^100755 .* 0 file$" + echo new > symlink && + git add file symlink && + git ls-files --stage | grep "^100755 .* 0 file$" && + git ls-files --stage | grep "^120000 .* 0 symlink$" ' test_done -- cgit v1.2.3 From dbd21447361364d646f3972738a475a92f711513 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Sun, 1 Jul 2007 17:48:59 -0700 Subject: format-patch: Add format.subjectprefix config option This change lets you use the format.subjectprefix config option to override the default subject prefix. Signed-off-by: Adam Roben Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 2 + ...ff.config_format.subjectprefix_DIFFERENT_PREFIX | 2 + ...ormat-patch_--inline_--stdout_initial..master^^ | 60 ++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 t/t4013/diff.config_format.subjectprefix_DIFFERENT_PREFIX create mode 100644 t/t4013/diff.format-patch_--inline_--stdout_initial..master^^ (limited to 't') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 8f4c29a6b5..b453b42af7 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -242,6 +242,8 @@ format-patch --inline --stdout initial..side format-patch --inline --stdout initial..master^ format-patch --inline --stdout initial..master format-patch --inline --stdout --subject-prefix=TESTCASE initial..master +config format.subjectprefix DIFFERENT_PREFIX +format-patch --inline --stdout initial..master^^ diff --abbrev initial..side diff -r initial..side diff --git a/t/t4013/diff.config_format.subjectprefix_DIFFERENT_PREFIX b/t/t4013/diff.config_format.subjectprefix_DIFFERENT_PREFIX new file mode 100644 index 0000000000..78f8970e2b --- /dev/null +++ b/t/t4013/diff.config_format.subjectprefix_DIFFERENT_PREFIX @@ -0,0 +1,2 @@ +$ git config format.subjectprefix DIFFERENT_PREFIX +$ diff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^ new file mode 100644 index 0000000000..b8e81e1552 --- /dev/null +++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^ @@ -0,0 +1,60 @@ +$ git format-patch --inline --stdout initial..master^^ +From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001 +From: A U Thor +Date: Mon, 26 Jun 2006 00:01:00 +0000 +Subject: [DIFFERENT_PREFIX] Second +MIME-Version: 1.0 +Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n" + +This is a multi-part message in MIME format. +--------------g-i-t--v-e-r-s-i-o-n +Content-Type: text/plain; charset=UTF-8; format=fixed +Content-Transfer-Encoding: 8bit + + +This is the second commit. +--- + dir/sub | 2 ++ + file0 | 3 +++ + file2 | 3 --- + 3 files changed, 5 insertions(+), 3 deletions(-) + delete mode 100644 file2 +--------------g-i-t--v-e-r-s-i-o-n +Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" +Content-Transfer-Encoding: 8bit +Content-Disposition: inline; filename="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" + +diff --git a/dir/sub b/dir/sub +index 35d242b..8422d40 100644 +--- a/dir/sub ++++ b/dir/sub +@@ -1,2 +1,4 @@ + A + B ++C ++D +diff --git a/file0 b/file0 +index 01e79c3..b414108 100644 +--- a/file0 ++++ b/file0 +@@ -1,3 +1,6 @@ + 1 + 2 + 3 ++4 ++5 ++6 +diff --git a/file2 b/file2 +deleted file mode 100644 +index 01e79c3..0000000 +--- a/file2 ++++ /dev/null +@@ -1,3 +0,0 @@ +-1 +-2 +-3 + +--------------g-i-t--v-e-r-s-i-o-n-- + + +$ -- cgit v1.2.3 From 68f6c019fd8d49fbaa72f1aeeb21eb921b6a16bf Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 3 Jul 2007 01:33:54 +0100 Subject: git-fsck: add --lost-found option With this option, dangling objects are not only reported, but also written to .git/lost-found/commit/ or .git/lost-found/other/. This option implies '--full' and '--no-reflogs'. 'git fsck --lost-found' is meant as a replacement for git-lost-found. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t1420-lost-found.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100755 t/t1420-lost-found.sh (limited to 't') diff --git a/t/t1420-lost-found.sh b/t/t1420-lost-found.sh new file mode 100755 index 0000000000..dc9e402c55 --- /dev/null +++ b/t/t1420-lost-found.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# +# Copyright (c) 2007 Johannes E. Schindelin +# + +test_description='Test fsck --lost-found' +. ./test-lib.sh + +test_expect_success setup ' + git config core.logAllRefUpdates 0 && + : > file1 && + git add file1 && + test_tick && + git commit -m initial && + echo 1 > file1 && + echo 2 > file2 && + git add file1 file2 && + test_tick && + git commit -m second && + echo 3 > file3 && + git add file3 +' + +test_expect_success 'lost and found something' ' + git rev-parse HEAD > lost-commit && + git rev-parse :file3 > lost-other && + test_tick && + git reset --hard HEAD^ && + git fsck --lost-found && + test 2 = $(ls .git/lost-found/*/* | wc -l) && + test -f .git/lost-found/commit/$(cat lost-commit) && + test -f .git/lost-found/other/$(cat lost-other) +' + +test_done -- cgit v1.2.3 From 5be60078c935ed08ee8eb5a32680bdfb6bb5bdf3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 2 Jul 2007 22:52:14 -0700 Subject: Rewrite "git-frotz" to "git frotz" This uses the remove-dashes target to replace "git-frotz" to "git frotz". Signed-off-by: Junio C Hamano --- t/lib-read-tree-m-3way.sh | 58 +++++------ t/t0000-basic.sh | 104 +++++++++---------- t/t0030-stripspace.sh | 188 +++++++++++++++++------------------ t/t1000-read-tree-m-3way.sh | 172 ++++++++++++++++---------------- t/t1001-read-tree-m-2way.sh | 176 ++++++++++++++++---------------- t/t1002-read-tree-m-u-2way.sh | 174 ++++++++++++++++---------------- t/t1003-read-tree-prefix.sh | 10 +- t/t1004-read-tree-m-u-wf.sh | 2 +- t/t1020-subdirectory.sh | 36 +++---- t/t1100-commit-tree-options.sh | 10 +- t/t1200-tutorial.sh | 24 ++--- t/t1300-repo-config.sh | 152 ++++++++++++++-------------- t/t1400-update-ref.sh | 74 +++++++------- t/t2000-checkout-cache-clash.sh | 18 ++-- t/t2001-checkout-cache-clash.sh | 34 +++---- t/t2002-checkout-cache-u.sh | 26 ++--- t/t2003-checkout-cache-mkdir.sh | 18 ++-- t/t2004-checkout-cache-temp.sh | 48 ++++----- t/t2005-checkout-index-symlinks.sh | 10 +- t/t2100-update-cache-badpath.sh | 12 +-- t/t2101-update-index-reupdate.sh | 28 +++--- t/t2102-update-index-symlinks.sh | 14 +-- t/t2200-add-update.sh | 14 +-- t/t3000-ls-files-others.sh | 18 ++-- t/t3001-ls-files-others-exclude.sh | 16 +-- t/t3002-ls-files-dashpath.sh | 24 ++--- t/t3010-ls-files-killed-modified.sh | 20 ++-- t/t3020-ls-files-error-unmatch.sh | 14 +-- t/t3100-ls-tree-restrict.sh | 32 +++--- t/t3101-ls-tree-dirname.sh | 24 ++--- t/t3200-branch.sh | 162 +++++++++++++++--------------- t/t3210-pack-refs.sh | 86 ++++++++-------- t/t3300-funny-names.sh | 76 +++++++------- t/t3400-rebase.sh | 6 +- t/t3401-rebase-partial.sh | 18 ++-- t/t3403-rebase-skip.sh | 2 +- t/t3500-cherry.sh | 22 ++-- t/t3600-rm.sh | 48 ++++----- t/t3700-add.sh | 70 ++++++------- t/t3800-mktag.sh | 4 +- t/t3900-i18n-commit.sh | 32 +++--- t/t3901-i18n-patch.sh | 34 +++---- t/t4000-diff-format.sh | 8 +- t/t4001-diff-rename.sh | 10 +- t/t4002-diff-basic.sh | 70 ++++++------- t/t4003-diff-rename-1.sh | 18 ++-- t/t4004-diff-rename-symlink.sh | 8 +- t/t4005-diff-rename-2.sh | 16 +-- t/t4006-diff-mode.sh | 16 +-- t/t4007-rename-3.sh | 16 +-- t/t4008-diff-break-rewrite.sh | 38 +++---- t/t4009-diff-rename-4.sh | 16 +-- t/t4010-diff-pathspec.sh | 16 +-- t/t4011-diff-symlink.sh | 20 ++-- t/t4012-diff-binary.sh | 26 ++--- t/t4015-diff-whitespace.sh | 16 +-- t/t4100-apply-stat.sh | 16 +-- t/t4101-apply-nonl.sh | 4 +- t/t4102-apply-rename.sh | 10 +- t/t4103-apply-binary.sh | 52 +++++----- t/t4104-apply-boundary.sh | 2 +- t/t4109-apply-multifrag.sh | 14 +-- t/t4110-apply-scan.sh | 6 +- t/t4112-apply-renames.sh | 8 +- t/t4113-apply-ending.sh | 10 +- t/t4114-apply-typechange.sh | 2 +- t/t4115-apply-symlink.sh | 2 +- t/t4116-apply-reverse.sh | 2 +- t/t4117-apply-reject.sh | 2 +- t/t4118-apply-empty-context.sh | 2 +- t/t4119-apply-config.sh | 2 +- t/t4120-apply-popt.sh | 2 +- t/t4121-apply-diffs.sh | 2 +- t/t4200-rerere.sh | 2 +- t/t4201-shortlog.sh | 2 +- t/t5000-tar-tree.sh | 50 +++++----- t/t5100-mailinfo.sh | 6 +- t/t5300-pack-object.sh | 72 +++++++------- t/t5301-sliding-window.sh | 40 ++++---- t/t5302-pack-index.sh | 56 +++++------ t/t5400-send-pack.sh | 36 +++---- t/t5401-update-hooks.sh | 26 ++--- t/t5500-fetch-pack.sh | 30 +++--- t/t6000lib.sh | 4 +- t/t6002-rev-list-bisect.sh | 38 +++---- t/t6003-rev-list-topo-order.sh | 76 +++++++------- t/t6004-rev-list-path-optim.sh | 8 +- t/t6005-rev-list-count.sh | 44 ++++---- t/t6006-rev-list-format.sh | 10 +- t/t6010-merge-base.sh | 24 ++--- t/t6023-merge-file.sh | 10 +- t/t6024-recursive-merge.sh | 8 +- t/t6025-merge-symlinks.sh | 14 +-- t/t6101-rev-parse-parents.sh | 28 +++--- t/t6120-describe.sh | 22 ++-- t/t7001-mv.sh | 32 +++--- t/t7003-filter-branch.sh | 14 +-- t/t7004-tag.sh | 22 ++-- t/t7101-reset.sh | 10 +- t/t7300-clean.sh | 6 +- t/t7400-submodule-basic.sh | 32 +++--- t/t8001-annotate.sh | 2 +- t/t8002-blame.sh | 2 +- t/t9100-git-svn-basic.sh | 12 +-- t/t9104-git-svn-follow-parent.sh | 30 +++--- t/t9107-git-svn-migrate.sh | 26 ++--- t/t9110-git-svn-use-svm-props.sh | 20 ++-- t/t9111-git-svn-use-svnsync-props.sh | 20 ++-- t/t9300-fast-import.sh | 100 +++++++++---------- 109 files changed, 1738 insertions(+), 1738 deletions(-) (limited to 't') diff --git a/t/lib-read-tree-m-3way.sh b/t/lib-read-tree-m-3way.sh index 586df2113f..168329adbc 100644 --- a/t/lib-read-tree-m-3way.sh +++ b/t/lib-read-tree-m-3way.sh @@ -10,14 +10,14 @@ do echo This is Z/$p from the original tree. >Z/$p test_expect_success \ "adding test file $p and Z/$p" \ - 'git-update-index --add $p && - git-update-index --add Z/$p' + 'git update-index --add $p && + git update-index --add Z/$p' done done echo This is SS from the original tree. >SS test_expect_success \ 'adding test file SS' \ - 'git-update-index --add SS' + 'git update-index --add SS' cat >TT <<\EOF This is a trivial merge sample text. Branch A is expected to upcase this word, here. @@ -32,10 +32,10 @@ This concludes the trivial merge sample file. EOF test_expect_success \ 'adding test file TT' \ - 'git-update-index --add TT' + 'git update-index --add TT' test_expect_success \ 'prepare initial tree' \ - 'tree_O=$(git-write-tree)' + 'tree_O=$(git write-tree)' ################################################################ # Branch A and B makes the changes according to the above matrix. @@ -47,14 +47,14 @@ to_remove=$(echo D? Z/D?) rm -f $to_remove test_expect_success \ 'change in branch A (removal)' \ - 'git-update-index --remove $to_remove' + 'git update-index --remove $to_remove' for p in M? Z/M? do echo This is modified $p in the branch A. >$p test_expect_success \ 'change in branch A (modification)' \ - "git-update-index $p" + "git update-index $p" done for p in AN AA Z/AN Z/AA @@ -62,31 +62,31 @@ do echo This is added $p in the branch A. >$p test_expect_success \ 'change in branch A (addition)' \ - "git-update-index --add $p" + "git update-index --add $p" done echo This is SS from the modified tree. >SS echo This is LL from the modified tree. >LL test_expect_success \ 'change in branch A (addition)' \ - 'git-update-index --add LL && - git-update-index SS' + 'git update-index --add LL && + git update-index SS' mv TT TT- sed -e '/Branch A/s/word/WORD/g' TT rm -f TT- test_expect_success \ 'change in branch A (edit)' \ - 'git-update-index TT' + 'git update-index TT' mkdir DF echo Branch A makes a file at DF/DF, creating a directory DF. >DF/DF test_expect_success \ 'change in branch A (change file to directory)' \ - 'git-update-index --add DF/DF' + 'git update-index --add DF/DF' test_expect_success \ 'recording branch A tree' \ - 'tree_A=$(git-write-tree)' + 'tree_A=$(git write-tree)' ################################################################ # Branch B @@ -96,21 +96,21 @@ rm -rf [NDMASLT][NDMASLT] Z DF mkdir Z test_expect_success \ 'reading original tree and checking out' \ - 'git-read-tree $tree_O && - git-checkout-index -a' + 'git read-tree $tree_O && + git checkout-index -a' to_remove=$(echo ?D Z/?D) rm -f $to_remove test_expect_success \ 'change in branch B (removal)' \ - "git-update-index --remove $to_remove" + "git update-index --remove $to_remove" for p in ?M Z/?M do echo This is modified $p in the branch B. >$p test_expect_success \ 'change in branch B (modification)' \ - "git-update-index $p" + "git update-index $p" done for p in NA AA Z/NA Z/AA @@ -118,41 +118,41 @@ do echo This is added $p in the branch B. >$p test_expect_success \ 'change in branch B (addition)' \ - "git-update-index --add $p" + "git update-index --add $p" done echo This is SS from the modified tree. >SS echo This is LL from the modified tree. >LL test_expect_success \ 'change in branch B (addition and modification)' \ - 'git-update-index --add LL && - git-update-index SS' + 'git update-index --add LL && + git update-index SS' mv TT TT- sed -e '/Branch B/s/word/WORD/g' TT rm -f TT- test_expect_success \ 'change in branch B (modification)' \ - 'git-update-index TT' + 'git update-index TT' echo Branch B makes a file at DF. >DF test_expect_success \ 'change in branch B (addition of a file to conflict with directory)' \ - 'git-update-index --add DF' + 'git update-index --add DF' test_expect_success \ 'recording branch B tree' \ - 'tree_B=$(git-write-tree)' + 'tree_B=$(git write-tree)' test_expect_success \ 'keep contents of 3 trees for easy access' \ 'rm -f .git/index && - git-read-tree $tree_O && + git read-tree $tree_O && mkdir .orig-O && - git-checkout-index --prefix=.orig-O/ -f -q -a && + git checkout-index --prefix=.orig-O/ -f -q -a && rm -f .git/index && - git-read-tree $tree_A && + git read-tree $tree_A && mkdir .orig-A && - git-checkout-index --prefix=.orig-A/ -f -q -a && + git checkout-index --prefix=.orig-A/ -f -q -a && rm -f .git/index && - git-read-tree $tree_B && + git read-tree $tree_B && mkdir .orig-B && - git-checkout-index --prefix=.orig-B/ -f -q -a' + git checkout-index --prefix=.orig-B/ -f -q -a' diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index 8bfe8320ea..4bba9c0717 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -31,12 +31,12 @@ fi . ./test-lib.sh ################################################################ -# git-init has been done in an empty repository. +# git init has been done in an empty repository. # make sure it is empty. find .git/objects -type f -print >should-be-empty test_expect_success \ - '.git/objects should be empty after git-init in an empty repo.' \ + '.git/objects should be empty after git init in an empty repo.' \ 'cmp -s /dev/null should-be-empty' # also it should have 2 subdirectories; no fan-out anymore, pack, and info. @@ -51,17 +51,17 @@ test_expect_success \ # updating a new file without --add should fail. test_expect_failure \ - 'git-update-index without --add should fail adding.' \ - 'git-update-index should-be-empty' + 'git update-index without --add should fail adding.' \ + 'git update-index should-be-empty' # and with --add it should succeed, even if it is empty (it used to fail). test_expect_success \ - 'git-update-index with --add should succeed.' \ - 'git-update-index --add should-be-empty' + 'git update-index with --add should succeed.' \ + 'git update-index --add should-be-empty' test_expect_success \ - 'writing tree out with git-write-tree' \ - 'tree=$(git-write-tree)' + 'writing tree out with git write-tree' \ + 'tree=$(git write-tree)' # we know the shape and contents of the tree and know the object ID for it. test_expect_success \ @@ -71,17 +71,17 @@ test_expect_success \ # Removing paths. rm -f should-be-empty full-of-directories test_expect_failure \ - 'git-update-index without --remove should fail removing.' \ - 'git-update-index should-be-empty' + 'git update-index without --remove should fail removing.' \ + 'git update-index should-be-empty' test_expect_success \ - 'git-update-index with --remove should be able to remove.' \ - 'git-update-index --remove should-be-empty' + 'git update-index with --remove should be able to remove.' \ + 'git update-index --remove should-be-empty' # Empty tree can be written with recent write-tree. test_expect_success \ - 'git-write-tree should be able to write an empty tree.' \ - 'tree=$(git-write-tree)' + 'git write-tree should be able to write an empty tree.' \ + 'tree=$(git write-tree)' test_expect_success \ 'validate object ID of a known tree.' \ @@ -95,13 +95,13 @@ do ln -s "hello $p" ${p}sym done test_expect_success \ - 'adding various types of objects with git-update-index --add.' \ - 'find path* ! -type d -print | xargs git-update-index --add' + 'adding various types of objects with git update-index --add.' \ + 'find path* ! -type d -print | xargs git update-index --add' # Show them and see that matches what we expect. test_expect_success \ - 'showing stage with git-ls-files --stage' \ - 'git-ls-files --stage >current' + 'showing stage with git ls-files --stage' \ + 'git ls-files --stage >current' cat >expected <<\EOF 100644 f87290f8eb2cbbea7857214459a0739927eab154 0 path0 @@ -114,19 +114,19 @@ cat >expected <<\EOF 120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0 path3/subp3/file3sym EOF test_expect_success \ - 'validate git-ls-files output for a known tree.' \ + 'validate git ls-files output for a known tree.' \ 'diff current expected' test_expect_success \ - 'writing tree out with git-write-tree.' \ - 'tree=$(git-write-tree)' + 'writing tree out with git write-tree.' \ + 'tree=$(git write-tree)' test_expect_success \ 'validate object ID for a known tree.' \ 'test "$tree" = 087704a96baf1c2d1c869a8b084481e121c88b5b' test_expect_success \ - 'showing tree with git-ls-tree' \ - 'git-ls-tree $tree >current' + 'showing tree with git ls-tree' \ + 'git ls-tree $tree >current' cat >expected <<\EOF 100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0 120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym @@ -134,14 +134,14 @@ cat >expected <<\EOF 040000 tree 21ae8269cacbe57ae09138dcc3a2887f904d02b3 path3 EOF test_expect_success \ - 'git-ls-tree output for a known tree.' \ + 'git ls-tree output for a known tree.' \ 'diff current expected' # This changed in ls-tree pathspec change -- recursive does # not show tree nodes anymore. test_expect_success \ - 'showing tree with git-ls-tree -r' \ - 'git-ls-tree -r $tree >current' + 'showing tree with git ls-tree -r' \ + 'git ls-tree -r $tree >current' cat >expected <<\EOF 100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0 120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym @@ -153,13 +153,13 @@ cat >expected <<\EOF 120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c path3/subp3/file3sym EOF test_expect_success \ - 'git-ls-tree -r output for a known tree.' \ + 'git ls-tree -r output for a known tree.' \ 'diff current expected' # But with -r -t we can have both. test_expect_success \ - 'showing tree with git-ls-tree -r -t' \ - 'git-ls-tree -r -t $tree >current' + 'showing tree with git ls-tree -r -t' \ + 'git ls-tree -r -t $tree >current' cat >expected <<\EOF 100644 blob f87290f8eb2cbbea7857214459a0739927eab154 path0 120000 blob 15a98433ae33114b085f3eb3bb03b832b3180a01 path0sym @@ -174,19 +174,19 @@ cat >expected <<\EOF 120000 blob 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c path3/subp3/file3sym EOF test_expect_success \ - 'git-ls-tree -r output for a known tree.' \ + 'git ls-tree -r output for a known tree.' \ 'diff current expected' test_expect_success \ - 'writing partial tree out with git-write-tree --prefix.' \ - 'ptree=$(git-write-tree --prefix=path3)' + 'writing partial tree out with git write-tree --prefix.' \ + 'ptree=$(git write-tree --prefix=path3)' test_expect_success \ 'validate object ID for a known tree.' \ 'test "$ptree" = 21ae8269cacbe57ae09138dcc3a2887f904d02b3' test_expect_success \ - 'writing partial tree out with git-write-tree --prefix.' \ - 'ptree=$(git-write-tree --prefix=path3/subp3)' + 'writing partial tree out with git write-tree --prefix.' \ + 'ptree=$(git write-tree --prefix=path3/subp3)' test_expect_success \ 'validate object ID for a known tree.' \ 'test "$ptree" = 3c5e5399f3a333eddecce7a9b9465b63f65f51e2' @@ -202,24 +202,24 @@ EOF rm .git/index test_expect_success \ 'put invalid objects into the index.' \ - 'git-update-index --index-info < badobjects' + 'git update-index --index-info < badobjects' test_expect_failure \ 'writing this tree without --missing-ok.' \ - 'git-write-tree' + 'git write-tree' test_expect_success \ 'writing this tree with --missing-ok.' \ - 'git-write-tree --missing-ok' + 'git write-tree --missing-ok' ################################################################ rm .git/index test_expect_success \ - 'git-read-tree followed by write-tree should be idempotent.' \ - 'git-read-tree $tree && + 'git read-tree followed by write-tree should be idempotent.' \ + 'git read-tree $tree && test -f .git/index && - newtree=$(git-write-tree) && + newtree=$(git write-tree) && test "$newtree" = "$tree"' cat >expected <<\EOF @@ -233,36 +233,36 @@ cat >expected <<\EOF :120000 120000 6649a1ebe9e9f1c553b66f5a6e74136a07ccc57c 0000000000000000000000000000000000000000 M path3/subp3/file3sym EOF test_expect_success \ - 'validate git-diff-files output for a know cache/work tree state.' \ - 'git-diff-files >current && diff >/dev/null -b current expected' + 'validate git diff-files output for a know cache/work tree state.' \ + 'git diff-files >current && diff >/dev/null -b current expected' test_expect_success \ - 'git-update-index --refresh should succeed.' \ - 'git-update-index --refresh' + 'git update-index --refresh should succeed.' \ + 'git update-index --refresh' test_expect_success \ - 'no diff after checkout and git-update-index --refresh.' \ - 'git-diff-files >current && cmp -s current /dev/null' + 'no diff after checkout and git update-index --refresh.' \ + 'git diff-files >current && cmp -s current /dev/null' ################################################################ P=087704a96baf1c2d1c869a8b084481e121c88b5b test_expect_success \ - 'git-commit-tree records the correct tree in a commit.' \ - 'commit0=$(echo NO | git-commit-tree $P) && + 'git commit-tree records the correct tree in a commit.' \ + 'commit0=$(echo NO | git commit-tree $P) && tree=$(git show --pretty=raw $commit0 | sed -n -e "s/^tree //p" -e "/^author /q") && test "z$tree" = "z$P"' test_expect_success \ - 'git-commit-tree records the correct parent in a commit.' \ - 'commit1=$(echo NO | git-commit-tree $P -p $commit0) && + 'git commit-tree records the correct parent in a commit.' \ + 'commit1=$(echo NO | git commit-tree $P -p $commit0) && parent=$(git show --pretty=raw $commit1 | sed -n -e "s/^parent //p" -e "/^author /q") && test "z$commit0" = "z$parent"' test_expect_success \ - 'git-commit-tree omits duplicated parent in a commit.' \ - 'commit2=$(echo NO | git-commit-tree $P -p $commit0 -p $commit0) && + 'git commit-tree omits duplicated parent in a commit.' \ + 'commit2=$(echo NO | git commit-tree $P -p $commit0 -p $commit0) && parent=$(git show --pretty=raw $commit2 | sed -n -e "s/^parent //p" -e "/^author /q" | sort -u) && diff --git a/t/t0030-stripspace.sh b/t/t0030-stripspace.sh index f4294d72d9..fdc9fdce6f 100755 --- a/t/t0030-stripspace.sh +++ b/t/t0030-stripspace.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Carlos Rica # -test_description='git-stripspace' +test_description='git stripspace' . ./test-lib.sh @@ -15,292 +15,292 @@ ttt="$t40$t40$t40$t40$t40$t40$t40$t40$t40$t40" # 400 test_expect_success \ 'long lines without spaces should be unchanged' ' echo "$ttt" >expect && - git-stripspace actual && + git stripspace actual && git diff expect actual && echo "$ttt$ttt" >expect && - git-stripspace actual && + git stripspace actual && git diff expect actual && echo "$ttt$ttt$ttt" >expect && - git-stripspace actual && + git stripspace actual && git diff expect actual && echo "$ttt$ttt$ttt$ttt" >expect && - git-stripspace actual && + git stripspace actual && git diff expect actual ' test_expect_success \ 'lines with spaces at the beginning should be unchanged' ' echo "$sss$ttt" >expect && - git-stripspace actual && + git stripspace actual && git diff expect actual && echo "$sss$sss$ttt" >expect && - git-stripspace actual && + git stripspace actual && git diff expect actual && echo "$sss$sss$sss$ttt" >expect && - git-stripspace actual && + git stripspace actual && git diff expect actual ' test_expect_success \ 'lines with intermediate spaces should be unchanged' ' echo "$ttt$sss$ttt" >expect && - git-stripspace actual && + git stripspace actual && git diff expect actual && echo "$ttt$sss$sss$ttt" >expect && - git-stripspace actual && + git stripspace actual && git diff expect actual ' test_expect_success \ 'consecutive blank lines should be unified' ' printf "$ttt\n\n$ttt\n" > expect && - printf "$ttt\n\n\n\n\n$ttt\n" | git-stripspace >actual && + printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && git diff expect actual && printf "$ttt$ttt\n\n$ttt\n" > expect && - printf "$ttt$ttt\n\n\n\n\n$ttt\n" | git-stripspace >actual && + printf "$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && git diff expect actual && printf "$ttt$ttt$ttt\n\n$ttt\n" > expect && - printf "$ttt$ttt$ttt\n\n\n\n\n$ttt\n" | git-stripspace >actual && + printf "$ttt$ttt$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n\n$ttt\n" > expect && - printf "$ttt\n\n\n\n\n$ttt\n" | git-stripspace >actual && + printf "$ttt\n\n\n\n\n$ttt\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n\n$ttt$ttt\n" > expect && - printf "$ttt\n\n\n\n\n$ttt$ttt\n" | git-stripspace >actual && + printf "$ttt\n\n\n\n\n$ttt$ttt\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n\n$ttt$ttt$ttt\n" > expect && - printf "$ttt\n\n\n\n\n$ttt$ttt$ttt\n" | git-stripspace >actual && + printf "$ttt\n\n\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual && git diff expect actual ' test_expect_success \ 'consecutive blank lines at the beginning should be removed' ' printf "" > expect && - printf "\n" | git-stripspace >actual && + printf "\n" | git stripspace >actual && git diff expect actual && printf "" > expect && - printf "\n\n\n" | git-stripspace >actual && + printf "\n\n\n" | git stripspace >actual && git diff expect actual && printf "" > expect && - printf "$sss\n$sss\n$sss\n" | git-stripspace >actual && + printf "$sss\n$sss\n$sss\n" | git stripspace >actual && git diff expect actual && printf "" > expect && - printf "$sss$sss\n$sss\n\n" | git-stripspace >actual && + printf "$sss$sss\n$sss\n\n" | git stripspace >actual && git diff expect actual && printf "" > expect && - printf "\n$sss\n$sss$sss\n" | git-stripspace >actual && + printf "\n$sss\n$sss$sss\n" | git stripspace >actual && git diff expect actual && printf "" > expect && - printf "$sss$sss$sss$sss\n\n\n" | git-stripspace >actual && + printf "$sss$sss$sss$sss\n\n\n" | git stripspace >actual && git diff expect actual && printf "" > expect && - printf "\n$sss$sss$sss$sss\n\n" | git-stripspace >actual && + printf "\n$sss$sss$sss$sss\n\n" | git stripspace >actual && git diff expect actual && printf "" > expect && - printf "\n\n$sss$sss$sss$sss\n" | git-stripspace >actual && + printf "\n\n$sss$sss$sss$sss\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n" > expect && - printf "\n$ttt\n" | git-stripspace >actual && + printf "\n$ttt\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n" > expect && - printf "\n\n\n$ttt\n" | git-stripspace >actual && + printf "\n\n\n$ttt\n" | git stripspace >actual && git diff expect actual && printf "$ttt$ttt\n" > expect && - printf "\n\n\n$ttt$ttt\n" | git-stripspace >actual && + printf "\n\n\n$ttt$ttt\n" | git stripspace >actual && git diff expect actual && printf "$ttt$ttt$ttt\n" > expect && - printf "\n\n\n$ttt$ttt$ttt\n" | git-stripspace >actual && + printf "\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual && git diff expect actual && printf "$ttt$ttt$ttt$ttt\n" > expect && - printf "\n\n\n$ttt$ttt$ttt$ttt\n" | git-stripspace >actual && + printf "\n\n\n$ttt$ttt$ttt$ttt\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n" > expect && - printf "$sss\n$sss\n$sss\n$ttt\n" | git-stripspace >actual && + printf "$sss\n$sss\n$sss\n$ttt\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n" > expect && - printf "\n$sss\n$sss$sss\n$ttt\n" | git-stripspace >actual && + printf "\n$sss\n$sss$sss\n$ttt\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n" > expect && - printf "$sss$sss\n$sss\n\n$ttt\n" | git-stripspace >actual && + printf "$sss$sss\n$sss\n\n$ttt\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n" > expect && - printf "$sss$sss$sss\n\n\n$ttt\n" | git-stripspace >actual && + printf "$sss$sss$sss\n\n\n$ttt\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n" > expect && - printf "\n$sss$sss$sss\n\n$ttt\n" | git-stripspace >actual && + printf "\n$sss$sss$sss\n\n$ttt\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n" > expect && - printf "\n\n$sss$sss$sss\n$ttt\n" | git-stripspace >actual && + printf "\n\n$sss$sss$sss\n$ttt\n" | git stripspace >actual && git diff expect actual ' test_expect_success \ 'consecutive blank lines at the end should be removed' ' printf "$ttt\n" > expect && - printf "$ttt\n\n" | git-stripspace >actual && + printf "$ttt\n\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n" > expect && - printf "$ttt\n\n\n\n" | git-stripspace >actual && + printf "$ttt\n\n\n\n" | git stripspace >actual && git diff expect actual && printf "$ttt$ttt\n" > expect && - printf "$ttt$ttt\n\n\n\n" | git-stripspace >actual && + printf "$ttt$ttt\n\n\n\n" | git stripspace >actual && git diff expect actual && printf "$ttt$ttt$ttt\n" > expect && - printf "$ttt$ttt$ttt\n\n\n\n" | git-stripspace >actual && + printf "$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual && git diff expect actual && printf "$ttt$ttt$ttt$ttt\n" > expect && - printf "$ttt$ttt$ttt$ttt\n\n\n\n" | git-stripspace >actual && + printf "$ttt$ttt$ttt$ttt\n\n\n\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n" > expect && - printf "$ttt\n$sss\n$sss\n$sss\n" | git-stripspace >actual && + printf "$ttt\n$sss\n$sss\n$sss\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n" > expect && - printf "$ttt\n\n$sss\n$sss$sss\n" | git-stripspace >actual && + printf "$ttt\n\n$sss\n$sss$sss\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n" > expect && - printf "$ttt\n$sss$sss\n$sss\n\n" | git-stripspace >actual && + printf "$ttt\n$sss$sss\n$sss\n\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n" > expect && - printf "$ttt\n$sss$sss$sss\n\n\n" | git-stripspace >actual && + printf "$ttt\n$sss$sss$sss\n\n\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n" > expect && - printf "$ttt\n\n$sss$sss$sss\n\n" | git-stripspace >actual && + printf "$ttt\n\n$sss$sss$sss\n\n" | git stripspace >actual && git diff expect actual && printf "$ttt\n" > expect && - printf "$ttt\n\n\n$sss$sss$sss\n" | git-stripspace >actual && + printf "$ttt\n\n\n$sss$sss$sss\n" | git stripspace >actual && git diff expect actual ' test_expect_success \ 'text without newline at end should end with newline' ' - test `printf "$ttt" | git-stripspace | wc -l` -gt 0 && - test `printf "$ttt$ttt" | git-stripspace | wc -l` -gt 0 && - test `printf "$ttt$ttt$ttt" | git-stripspace | wc -l` -gt 0 && - test `printf "$ttt$ttt$ttt$ttt" | git-stripspace | wc -l` -gt 0 + test `printf "$ttt" | git stripspace | wc -l` -gt 0 && + test `printf "$ttt$ttt" | git stripspace | wc -l` -gt 0 && + test `printf "$ttt$ttt$ttt" | git stripspace | wc -l` -gt 0 && + test `printf "$ttt$ttt$ttt$ttt" | git stripspace | wc -l` -gt 0 ' # text plus spaces at the end: test_expect_success \ 'text plus spaces without newline at end should end with newline' ' - test `printf "$ttt$sss" | git-stripspace | wc -l` -gt 0 && - test `printf "$ttt$ttt$sss" | git-stripspace | wc -l` -gt 0 && - test `printf "$ttt$ttt$ttt$sss" | git-stripspace | wc -l` -gt 0 - test `printf "$ttt$sss$sss" | git-stripspace | wc -l` -gt 0 && - test `printf "$ttt$ttt$sss$sss" | git-stripspace | wc -l` -gt 0 && - test `printf "$ttt$sss$sss$sss" | git-stripspace | wc -l` -gt 0 + test `printf "$ttt$sss" | git stripspace | wc -l` -gt 0 && + test `printf "$ttt$ttt$sss" | git stripspace | wc -l` -gt 0 && + test `printf "$ttt$ttt$ttt$sss" | git stripspace | wc -l` -gt 0 + test `printf "$ttt$sss$sss" | git stripspace | wc -l` -gt 0 && + test `printf "$ttt$ttt$sss$sss" | git stripspace | wc -l` -gt 0 && + test `printf "$ttt$sss$sss$sss" | git stripspace | wc -l` -gt 0 ' test_expect_failure \ 'text plus spaces without newline at end should not show spaces' ' - printf "$ttt$sss" | git-stripspace | grep -q " " || - printf "$ttt$ttt$sss" | git-stripspace | grep -q " " || - printf "$ttt$ttt$ttt$sss" | git-stripspace | grep -q " " || - printf "$ttt$sss$sss" | git-stripspace | grep -q " " || - printf "$ttt$ttt$sss$sss" | git-stripspace | grep -q " " || - printf "$ttt$sss$sss$sss" | git-stripspace | grep -q " " + printf "$ttt$sss" | git stripspace | grep -q " " || + printf "$ttt$ttt$sss" | git stripspace | grep -q " " || + printf "$ttt$ttt$ttt$sss" | git stripspace | grep -q " " || + printf "$ttt$sss$sss" | git stripspace | grep -q " " || + printf "$ttt$ttt$sss$sss" | git stripspace | grep -q " " || + printf "$ttt$sss$sss$sss" | git stripspace | grep -q " " ' test_expect_success \ 'text plus spaces without newline should show the correct lines' ' printf "$ttt\n" >expect && - printf "$ttt$sss" | git-stripspace >actual && + printf "$ttt$sss" | git stripspace >actual && git diff expect actual && printf "$ttt\n" >expect && - printf "$ttt$sss$sss" | git-stripspace >actual && + printf "$ttt$sss$sss" | git stripspace >actual && git diff expect actual && printf "$ttt\n" >expect && - printf "$ttt$sss$sss$sss" | git-stripspace >actual && + printf "$ttt$sss$sss$sss" | git stripspace >actual && git diff expect actual && printf "$ttt$ttt\n" >expect && - printf "$ttt$ttt$sss" | git-stripspace >actual && + printf "$ttt$ttt$sss" | git stripspace >actual && git diff expect actual && printf "$ttt$ttt\n" >expect && - printf "$ttt$ttt$sss$sss" | git-stripspace >actual && + printf "$ttt$ttt$sss$sss" | git stripspace >actual && git diff expect actual && printf "$ttt$ttt$ttt\n" >expect && - printf "$ttt$ttt$ttt$sss" | git-stripspace >actual && + printf "$ttt$ttt$ttt$sss" | git stripspace >actual && git diff expect actual ' test_expect_failure \ 'text plus spaces at end should not show spaces' ' - echo "$ttt$sss" | git-stripspace | grep -q " " || - echo "$ttt$ttt$sss" | git-stripspace | grep -q " " || - echo "$ttt$ttt$ttt$sss" | git-stripspace | grep -q " " || - echo "$ttt$sss$sss" | git-stripspace | grep -q " " || - echo "$ttt$ttt$sss$sss" | git-stripspace | grep -q " " || - echo "$ttt$sss$sss$sss" | git-stripspace | grep -q " " + echo "$ttt$sss" | git stripspace | grep -q " " || + echo "$ttt$ttt$sss" | git stripspace | grep -q " " || + echo "$ttt$ttt$ttt$sss" | git stripspace | grep -q " " || + echo "$ttt$sss$sss" | git stripspace | grep -q " " || + echo "$ttt$ttt$sss$sss" | git stripspace | grep -q " " || + echo "$ttt$sss$sss$sss" | git stripspace | grep -q " " ' test_expect_success \ 'text plus spaces at end should be cleaned and newline must remain' ' echo "$ttt" >expect && - echo "$ttt$sss" | git-stripspace >actual && + echo "$ttt$sss" | git stripspace >actual && git diff expect actual && echo "$ttt" >expect && - echo "$ttt$sss$sss" | git-stripspace >actual && + echo "$ttt$sss$sss" | git stripspace >actual && git diff expect actual && echo "$ttt" >expect && - echo "$ttt$sss$sss$sss" | git-stripspace >actual && + echo "$ttt$sss$sss$sss" | git stripspace >actual && git diff expect actual && echo "$ttt$ttt" >expect && - echo "$ttt$ttt$sss" | git-stripspace >actual && + echo "$ttt$ttt$sss" | git stripspace >actual && git diff expect actual && echo "$ttt$ttt" >expect && - echo "$ttt$ttt$sss$sss" | git-stripspace >actual && + echo "$ttt$ttt$sss$sss" | git stripspace >actual && git diff expect actual && echo "$ttt$ttt$ttt" >expect && - echo "$ttt$ttt$ttt$sss" | git-stripspace >actual && + echo "$ttt$ttt$ttt$sss" | git stripspace >actual && git diff expect actual ' @@ -310,45 +310,45 @@ test_expect_success \ 'spaces with newline at end should be replaced with empty string' ' printf "" >expect && - echo | git-stripspace >actual && + echo | git stripspace >actual && git diff expect actual && - echo "$sss" | git-stripspace >actual && + echo "$sss" | git stripspace >actual && git diff expect actual && - echo "$sss$sss" | git-stripspace >actual && + echo "$sss$sss" | git stripspace >actual && git diff expect actual && - echo "$sss$sss$sss" | git-stripspace >actual && + echo "$sss$sss$sss" | git stripspace >actual && git diff expect actual && - echo "$sss$sss$sss$sss" | git-stripspace >actual && + echo "$sss$sss$sss$sss" | git stripspace >actual && git diff expect actual ' test_expect_failure \ 'spaces without newline at end should not show spaces' ' - printf "" | git-stripspace | grep -q " " || - printf "$sss" | git-stripspace | grep -q " " || - printf "$sss$sss" | git-stripspace | grep -q " " || - printf "$sss$sss$sss" | git-stripspace | grep -q " " || - printf "$sss$sss$sss$sss" | git-stripspace | grep -q " " + printf "" | git stripspace | grep -q " " || + printf "$sss" | git stripspace | grep -q " " || + printf "$sss$sss" | git stripspace | grep -q " " || + printf "$sss$sss$sss" | git stripspace | grep -q " " || + printf "$sss$sss$sss$sss" | git stripspace | grep -q " " ' test_expect_success \ 'spaces without newline at end should be replaced with empty string' ' printf "" >expect && - printf "" | git-stripspace >actual && + printf "" | git stripspace >actual && git diff expect actual - printf "$sss$sss" | git-stripspace >actual && + printf "$sss$sss" | git stripspace >actual && git diff expect actual - printf "$sss$sss$sss" | git-stripspace >actual && + printf "$sss$sss$sss" | git stripspace >actual && git diff expect actual - printf "$sss$sss$sss$sss" | git-stripspace >actual && + printf "$sss$sss$sss$sss" | git stripspace >actual && git diff expect actual ' diff --git a/t/t1000-read-tree-m-3way.sh b/t/t1000-read-tree-m-3way.sh index de4e5eb61f..37add1b504 100755 --- a/t/t1000-read-tree-m-3way.sh +++ b/t/t1000-read-tree-m-3way.sh @@ -130,28 +130,28 @@ _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40" check_result () { - git-ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current && + git ls-files --stage | sed -e 's/ '"$_x40"' / X /' >current && git diff expected current } # This is done on an empty work directory, which is the normal # merge person behaviour. test_expect_success \ - '3-way merge with git-read-tree -m, empty cache' \ + '3-way merge with git read-tree -m, empty cache' \ "rm -fr [NDMALTS][NDMALTSF] Z && rm .git/index && - git-read-tree -m $tree_O $tree_A $tree_B && + git read-tree -m $tree_O $tree_A $tree_B && check_result" # This starts out with the first head, which is the normal # patch submitter behaviour. test_expect_success \ - '3-way merge with git-read-tree -m, match H' \ + '3-way merge with git read-tree -m, match H' \ "rm -fr [NDMALTS][NDMALTSF] Z && rm .git/index && - git-read-tree $tree_A && - git-checkout-index -f -u -a && - git-read-tree -m $tree_O $tree_A $tree_B && + git read-tree $tree_A && + git checkout-index -f -u -a && + git read-tree -m $tree_O $tree_A $tree_B && check_result" : <<\END_OF_CASE_TABLE @@ -160,7 +160,7 @@ We have so far tested only empty index and clean-and-matching-A index case which are trivial. Make sure index requirements are also checked. -"git-read-tree -m O A B" +"git read-tree -m O A B" O A B result index requirements ------------------------------------------------------------------- @@ -214,87 +214,87 @@ test_expect_failure \ '1 - must not have an entry not in A.' \ "rm -f .git/index XX && echo XX >XX && - git-update-index --add XX && - git-read-tree -m $tree_O $tree_A $tree_B" + git update-index --add XX && + git read-tree -m $tree_O $tree_A $tree_B" test_expect_success \ '2 - must match B in !O && !A && B case.' \ "rm -f .git/index NA && cp .orig-B/NA NA && - git-update-index --add NA && - git-read-tree -m $tree_O $tree_A $tree_B" + git update-index --add NA && + git read-tree -m $tree_O $tree_A $tree_B" test_expect_success \ '2 - matching B alone is OK in !O && !A && B case.' \ "rm -f .git/index NA && cp .orig-B/NA NA && - git-update-index --add NA && + git update-index --add NA && echo extra >>NA && - git-read-tree -m $tree_O $tree_A $tree_B" + git read-tree -m $tree_O $tree_A $tree_B" test_expect_success \ '3 - must match A in !O && A && !B case.' \ "rm -f .git/index AN && cp .orig-A/AN AN && - git-update-index --add AN && - git-read-tree -m $tree_O $tree_A $tree_B && + git update-index --add AN && + git read-tree -m $tree_O $tree_A $tree_B && check_result" test_expect_success \ '3 - matching A alone is OK in !O && A && !B case.' \ "rm -f .git/index AN && cp .orig-A/AN AN && - git-update-index --add AN && + git update-index --add AN && echo extra >>AN && - git-read-tree -m $tree_O $tree_A $tree_B" + git read-tree -m $tree_O $tree_A $tree_B" test_expect_failure \ '3 (fail) - must match A in !O && A && !B case.' \ "rm -f .git/index AN && cp .orig-A/AN AN && echo extra >>AN && - git-update-index --add AN && - git-read-tree -m $tree_O $tree_A $tree_B" + git update-index --add AN && + git read-tree -m $tree_O $tree_A $tree_B" test_expect_success \ '4 - must match and be up-to-date in !O && A && B && A!=B case.' \ "rm -f .git/index AA && cp .orig-A/AA AA && - git-update-index --add AA && - git-read-tree -m $tree_O $tree_A $tree_B && + git update-index --add AA && + git read-tree -m $tree_O $tree_A $tree_B && check_result" test_expect_failure \ '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' \ "rm -f .git/index AA && cp .orig-A/AA AA && - git-update-index --add AA && + git update-index --add AA && echo extra >>AA && - git-read-tree -m $tree_O $tree_A $tree_B" + git read-tree -m $tree_O $tree_A $tree_B" test_expect_failure \ '4 (fail) - must match and be up-to-date in !O && A && B && A!=B case.' \ "rm -f .git/index AA && cp .orig-A/AA AA && echo extra >>AA && - git-update-index --add AA && - git-read-tree -m $tree_O $tree_A $tree_B" + git update-index --add AA && + git read-tree -m $tree_O $tree_A $tree_B" test_expect_success \ '5 - must match in !O && A && B && A==B case.' \ "rm -f .git/index LL && cp .orig-A/LL LL && - git-update-index --add LL && - git-read-tree -m $tree_O $tree_A $tree_B && + git update-index --add LL && + git read-tree -m $tree_O $tree_A $tree_B && check_result" test_expect_success \ '5 - must match in !O && A && B && A==B case.' \ "rm -f .git/index LL && cp .orig-A/LL LL && - git-update-index --add LL && + git update-index --add LL && echo extra >>LL && - git-read-tree -m $tree_O $tree_A $tree_B && + git read-tree -m $tree_O $tree_A $tree_B && check_result" test_expect_failure \ @@ -302,117 +302,117 @@ test_expect_failure \ "rm -f .git/index LL && cp .orig-A/LL LL && echo extra >>LL && - git-update-index --add LL && - git-read-tree -m $tree_O $tree_A $tree_B" + git update-index --add LL && + git read-tree -m $tree_O $tree_A $tree_B" test_expect_failure \ '6 - must not exist in O && !A && !B case' \ "rm -f .git/index DD && echo DD >DD - git-update-index --add DD && - git-read-tree -m $tree_O $tree_A $tree_B" + git update-index --add DD && + git read-tree -m $tree_O $tree_A $tree_B" test_expect_failure \ '7 - must not exist in O && !A && B && O!=B case' \ "rm -f .git/index DM && cp .orig-B/DM DM && - git-update-index --add DM && - git-read-tree -m $tree_O $tree_A $tree_B" + git update-index --add DM && + git read-tree -m $tree_O $tree_A $tree_B" test_expect_failure \ '8 - must not exist in O && !A && B && O==B case' \ "rm -f .git/index DN && cp .orig-B/DN DN && - git-update-index --add DN && - git-read-tree -m $tree_O $tree_A $tree_B" + git update-index --add DN && + git read-tree -m $tree_O $tree_A $tree_B" test_expect_success \ '9 - must match and be up-to-date in O && A && !B && O!=A case' \ "rm -f .git/index MD && cp .orig-A/MD MD && - git-update-index --add MD && - git-read-tree -m $tree_O $tree_A $tree_B && + git update-index --add MD && + git read-tree -m $tree_O $tree_A $tree_B && check_result" test_expect_failure \ '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' \ "rm -f .git/index MD && cp .orig-A/MD MD && - git-update-index --add MD && + git update-index --add MD && echo extra >>MD && - git-read-tree -m $tree_O $tree_A $tree_B" + git read-tree -m $tree_O $tree_A $tree_B" test_expect_failure \ '9 (fail) - must match and be up-to-date in O && A && !B && O!=A case' \ "rm -f .git/index MD && cp .orig-A/MD MD && echo extra >>MD && - git-update-index --add MD && - git-read-tree -m $tree_O $tree_A $tree_B" + git update-index --add MD && + git read-tree -m $tree_O $tree_A $tree_B" test_expect_success \ '10 - must match and be up-to-date in O && A && !B && O==A case' \ "rm -f .git/index ND && cp .orig-A/ND ND && - git-update-index --add ND && - git-read-tree -m $tree_O $tree_A $tree_B && + git update-index --add ND && + git read-tree -m $tree_O $tree_A $tree_B && check_result" test_expect_failure \ '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' \ "rm -f .git/index ND && cp .orig-A/ND ND && - git-update-index --add ND && + git update-index --add ND && echo extra >>ND && - git-read-tree -m $tree_O $tree_A $tree_B" + git read-tree -m $tree_O $tree_A $tree_B" test_expect_failure \ '10 (fail) - must match and be up-to-date in O && A && !B && O==A case' \ "rm -f .git/index ND && cp .orig-A/ND ND && echo extra >>ND && - git-update-index --add ND && - git-read-tree -m $tree_O $tree_A $tree_B" + git update-index --add ND && + git read-tree -m $tree_O $tree_A $tree_B" test_expect_success \ '11 - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \ "rm -f .git/index MM && cp .orig-A/MM MM && - git-update-index --add MM && - git-read-tree -m $tree_O $tree_A $tree_B && + git update-index --add MM && + git read-tree -m $tree_O $tree_A $tree_B && check_result" test_expect_failure \ '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \ "rm -f .git/index MM && cp .orig-A/MM MM && - git-update-index --add MM && + git update-index --add MM && echo extra >>MM && - git-read-tree -m $tree_O $tree_A $tree_B" + git read-tree -m $tree_O $tree_A $tree_B" test_expect_failure \ '11 (fail) - must match and be up-to-date in O && A && B && O!=A && O!=B && A!=B case' \ "rm -f .git/index MM && cp .orig-A/MM MM && echo extra >>MM && - git-update-index --add MM && - git-read-tree -m $tree_O $tree_A $tree_B" + git update-index --add MM && + git read-tree -m $tree_O $tree_A $tree_B" test_expect_success \ '12 - must match A in O && A && B && O!=A && A==B case' \ "rm -f .git/index SS && cp .orig-A/SS SS && - git-update-index --add SS && - git-read-tree -m $tree_O $tree_A $tree_B && + git update-index --add SS && + git read-tree -m $tree_O $tree_A $tree_B && check_result" test_expect_success \ '12 - must match A in O && A && B && O!=A && A==B case' \ "rm -f .git/index SS && cp .orig-A/SS SS && - git-update-index --add SS && + git update-index --add SS && echo extra >>SS && - git-read-tree -m $tree_O $tree_A $tree_B && + git read-tree -m $tree_O $tree_A $tree_B && check_result" test_expect_failure \ @@ -420,74 +420,74 @@ test_expect_failure \ "rm -f .git/index SS && cp .orig-A/SS SS && echo extra >>SS && - git-update-index --add SS && - git-read-tree -m $tree_O $tree_A $tree_B" + git update-index --add SS && + git read-tree -m $tree_O $tree_A $tree_B" test_expect_success \ '13 - must match A in O && A && B && O!=A && O==B case' \ "rm -f .git/index MN && cp .orig-A/MN MN && - git-update-index --add MN && - git-read-tree -m $tree_O $tree_A $tree_B && + git update-index --add MN && + git read-tree -m $tree_O $tree_A $tree_B && check_result" test_expect_success \ '13 - must match A in O && A && B && O!=A && O==B case' \ "rm -f .git/index MN && cp .orig-A/MN MN && - git-update-index --add MN && + git update-index --add MN && echo extra >>MN && - git-read-tree -m $tree_O $tree_A $tree_B && + git read-tree -m $tree_O $tree_A $tree_B && check_result" test_expect_success \ '14 - must match and be up-to-date in O && A && B && O==A && O!=B case' \ "rm -f .git/index NM && cp .orig-A/NM NM && - git-update-index --add NM && - git-read-tree -m $tree_O $tree_A $tree_B && + git update-index --add NM && + git read-tree -m $tree_O $tree_A $tree_B && check_result" test_expect_success \ '14 - may match B in O && A && B && O==A && O!=B case' \ "rm -f .git/index NM && cp .orig-B/NM NM && - git-update-index --add NM && + git update-index --add NM && echo extra >>NM && - git-read-tree -m $tree_O $tree_A $tree_B && + git read-tree -m $tree_O $tree_A $tree_B && check_result" test_expect_failure \ '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' \ "rm -f .git/index NM && cp .orig-A/NM NM && - git-update-index --add NM && + git update-index --add NM && echo extra >>NM && - git-read-tree -m $tree_O $tree_A $tree_B" + git read-tree -m $tree_O $tree_A $tree_B" test_expect_failure \ '14 (fail) - must match and be up-to-date in O && A && B && O==A && O!=B case' \ "rm -f .git/index NM && cp .orig-A/NM NM && echo extra >>NM && - git-update-index --add NM && - git-read-tree -m $tree_O $tree_A $tree_B" + git update-index --add NM && + git read-tree -m $tree_O $tree_A $tree_B" test_expect_success \ '15 - must match A in O && A && B && O==A && O==B case' \ "rm -f .git/index NN && cp .orig-A/NN NN && - git-update-index --add NN && - git-read-tree -m $tree_O $tree_A $tree_B && + git update-index --add NN && + git read-tree -m $tree_O $tree_A $tree_B && check_result" test_expect_success \ '15 - must match A in O && A && B && O==A && O==B case' \ "rm -f .git/index NN && cp .orig-A/NN NN && - git-update-index --add NN && + git update-index --add NN && echo extra >>NN && - git-read-tree -m $tree_O $tree_A $tree_B && + git read-tree -m $tree_O $tree_A $tree_B && check_result" test_expect_failure \ @@ -495,20 +495,20 @@ test_expect_failure \ "rm -f .git/index NN && cp .orig-A/NN NN && echo extra >>NN && - git-update-index --add NN && - git-read-tree -m $tree_O $tree_A $tree_B" + git update-index --add NN && + git read-tree -m $tree_O $tree_A $tree_B" # #16 test_expect_success \ '16 - A matches in one and B matches in another.' \ 'rm -f .git/index F16 && echo F16 >F16 && - git-update-index --add F16 && - tree0=`git-write-tree` && + git update-index --add F16 && + tree0=`git write-tree` && echo E16 >F16 && - git-update-index F16 && - tree1=`git-write-tree` && - git-read-tree -m $tree0 $tree1 $tree1 $tree0 && - git-ls-files --stage' + git update-index F16 && + tree1=`git write-tree` && + git read-tree -m $tree0 $tree1 $tree1 $tree0 && + git ls-files --stage' test_done diff --git a/t/t1001-read-tree-m-2way.sh b/t/t1001-read-tree-m-2way.sh index 030226bbfb..b01b0037a0 100755 --- a/t/t1001-read-tree-m-2way.sh +++ b/t/t1001-read-tree-m-2way.sh @@ -11,7 +11,7 @@ There is the head (called H) and another commit (called M), which is simply ahead of H. The index and the work tree contains a state that is derived from H, but may also have local changes. This test checks all the combinations described in the two-tree merge "carry forward" -rules, found in . +rules, found in . In the test, these paths are used: bozbar - in H, stays in M, modified from bozbar to gnusto @@ -23,7 +23,7 @@ In the test, these paths are used: . ./test-lib.sh read_tree_twoway () { - git-read-tree -m "$1" "$2" && git-ls-files --stage + git read-tree -m "$1" "$2" && git ls-files --stage } _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' @@ -37,7 +37,7 @@ compare_change () { } check_cache_at () { - clean_if_empty=`git-diff-files -- "$1"` + clean_if_empty=`git diff-files -- "$1"` case "$clean_if_empty" in '') echo "$1: clean" ;; ?*) echo "$1: dirty" ;; @@ -68,24 +68,24 @@ test_expect_success \ cat bozbar-old >bozbar && echo rezrov >rezrov && echo yomin >yomin && - git-update-index --add nitfol bozbar rezrov && - treeH=`git-write-tree` && + git update-index --add nitfol bozbar rezrov && + treeH=`git write-tree` && echo treeH $treeH && - git-ls-tree $treeH && + git ls-tree $treeH && cat bozbar-new >bozbar && - git-update-index --add frotz bozbar --force-remove rezrov && - git-ls-files --stage >M.out && - treeM=`git-write-tree` && + git update-index --add frotz bozbar --force-remove rezrov && + git ls-files --stage >M.out && + treeM=`git write-tree` && echo treeM $treeM && - git-ls-tree $treeM && - git-diff-tree $treeH $treeM' + git ls-tree $treeM && + git diff-tree $treeH $treeM' test_expect_success \ '1, 2, 3 - no carry forward' \ 'rm -f .git/index && read_tree_twoway $treeH $treeM && - git-ls-files --stage >1-3.out && + git ls-files --stage >1-3.out && git diff M.out 1-3.out && check_cache_at bozbar dirty && check_cache_at frotz dirty && @@ -96,11 +96,11 @@ echo '+100644 X 0 yomin' >expected test_expect_success \ '4 - carry forward local addition.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && - git-update-index --add yomin && + git read-tree $treeH && + git checkout-index -u -f -q -a && + git update-index --add yomin && read_tree_twoway $treeH $treeM && - git-ls-files --stage >4.out || return 1 + git ls-files --stage >4.out || return 1 git diff M.out 4.out >4diff.out compare_change 4diff.out expected && check_cache_at yomin clean' @@ -108,13 +108,13 @@ test_expect_success \ test_expect_success \ '5 - carry forward local addition.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && echo yomin >yomin && - git-update-index --add yomin && + git update-index --add yomin && echo yomin yomin >yomin && read_tree_twoway $treeH $treeM && - git-ls-files --stage >5.out || return 1 + git ls-files --stage >5.out || return 1 git diff M.out 5.out >5diff.out compare_change 5diff.out expected && check_cache_at yomin dirty' @@ -122,83 +122,83 @@ test_expect_success \ test_expect_success \ '6 - local addition already has the same.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && - git-update-index --add frotz && + git read-tree $treeH && + git checkout-index -u -f -q -a && + git update-index --add frotz && read_tree_twoway $treeH $treeM && - git-ls-files --stage >6.out && + git ls-files --stage >6.out && git diff M.out 6.out && check_cache_at frotz clean' test_expect_success \ '7 - local addition already has the same.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && echo frotz >frotz && - git-update-index --add frotz && + git update-index --add frotz && echo frotz frotz >frotz && read_tree_twoway $treeH $treeM && - git-ls-files --stage >7.out && + git ls-files --stage >7.out && git diff M.out 7.out && check_cache_at frotz dirty' test_expect_success \ '8 - conflicting addition.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && echo frotz frotz >frotz && - git-update-index --add frotz && + git update-index --add frotz && if read_tree_twoway $treeH $treeM; then false; else :; fi' test_expect_success \ '9 - conflicting addition.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && echo frotz frotz >frotz && - git-update-index --add frotz && + git update-index --add frotz && echo frotz >frotz && if read_tree_twoway $treeH $treeM; then false; else :; fi' test_expect_success \ '10 - path removed.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && echo rezrov >rezrov && - git-update-index --add rezrov && + git update-index --add rezrov && read_tree_twoway $treeH $treeM && - git-ls-files --stage >10.out && + git ls-files --stage >10.out && git diff M.out 10.out' test_expect_success \ '11 - dirty path removed.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && echo rezrov >rezrov && - git-update-index --add rezrov && + git update-index --add rezrov && echo rezrov rezrov >rezrov && if read_tree_twoway $treeH $treeM; then false; else :; fi' test_expect_success \ '12 - unmatching local changes being removed.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && echo rezrov rezrov >rezrov && - git-update-index --add rezrov && + git update-index --add rezrov && if read_tree_twoway $treeH $treeM; then false; else :; fi' test_expect_success \ '13 - unmatching local changes being removed.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && echo rezrov rezrov >rezrov && - git-update-index --add rezrov && + git update-index --add rezrov && echo rezrov >rezrov && if read_tree_twoway $treeH $treeM; then false; else :; fi' @@ -210,12 +210,12 @@ EOF test_expect_success \ '14 - unchanged in two heads.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && echo nitfol nitfol >nitfol && - git-update-index --add nitfol && + git update-index --add nitfol && read_tree_twoway $treeH $treeM && - git-ls-files --stage >14.out || return 1 + git ls-files --stage >14.out || return 1 git diff M.out 14.out >14diff.out compare_change 14diff.out expected && check_cache_at nitfol clean' @@ -223,13 +223,13 @@ test_expect_success \ test_expect_success \ '15 - unchanged in two heads.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && echo nitfol nitfol >nitfol && - git-update-index --add nitfol && + git update-index --add nitfol && echo nitfol nitfol nitfol >nitfol && read_tree_twoway $treeH $treeM && - git-ls-files --stage >15.out || return 1 + git ls-files --stage >15.out || return 1 git diff M.out 15.out >15diff.out compare_change 15diff.out expected && check_cache_at nitfol dirty' @@ -237,66 +237,66 @@ test_expect_success \ test_expect_success \ '16 - conflicting local change.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && echo bozbar bozbar >bozbar && - git-update-index --add bozbar && + git update-index --add bozbar && if read_tree_twoway $treeH $treeM; then false; else :; fi' test_expect_success \ '17 - conflicting local change.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && echo bozbar bozbar >bozbar && - git-update-index --add bozbar && + git update-index --add bozbar && echo bozbar bozbar bozbar >bozbar && if read_tree_twoway $treeH $treeM; then false; else :; fi' test_expect_success \ '18 - local change already having a good result.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && cat bozbar-new >bozbar && - git-update-index --add bozbar && + git update-index --add bozbar && read_tree_twoway $treeH $treeM && - git-ls-files --stage >18.out && + git ls-files --stage >18.out && git diff M.out 18.out && check_cache_at bozbar clean' test_expect_success \ '19 - local change already having a good result, further modified.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && cat bozbar-new >bozbar && - git-update-index --add bozbar && + git update-index --add bozbar && echo gnusto gnusto >bozbar && read_tree_twoway $treeH $treeM && - git-ls-files --stage >19.out && + git ls-files --stage >19.out && git diff M.out 19.out && check_cache_at bozbar dirty' test_expect_success \ '20 - no local change, use new tree.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && cat bozbar-old >bozbar && - git-update-index --add bozbar && + git update-index --add bozbar && read_tree_twoway $treeH $treeM && - git-ls-files --stage >20.out && + git ls-files --stage >20.out && git diff M.out 20.out && check_cache_at bozbar dirty' test_expect_success \ '21 - no local change, dirty cache.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && cat bozbar-old >bozbar && - git-update-index --add bozbar && + git update-index --add bozbar && echo gnusto gnusto >bozbar && if read_tree_twoway $treeH $treeM; then false; else :; fi' @@ -304,10 +304,10 @@ test_expect_success \ test_expect_success \ '22 - local change cache updated.' \ 'rm -f .git/index && - git-read-tree $treeH && - git-checkout-index -u -f -q -a && + git read-tree $treeH && + git checkout-index -u -f -q -a && sed -e "s/such as/SUCH AS/" bozbar-old >bozbar && - git-update-index --add bozbar && + git update-index --add bozbar && if read_tree_twoway $treeH $treeM; then false; else :; fi' # Also make sure we did not break DF vs DF/DF case. @@ -315,28 +315,28 @@ test_expect_success \ 'DF vs DF/DF case setup.' \ 'rm -f .git/index && echo DF >DF && - git-update-index --add DF && - treeDF=`git-write-tree` && + git update-index --add DF && + treeDF=`git write-tree` && echo treeDF $treeDF && - git-ls-tree $treeDF && + git ls-tree $treeDF && rm -f DF && mkdir DF && echo DF/DF >DF/DF && - git-update-index --add --remove DF DF/DF && - treeDFDF=`git-write-tree` && + git update-index --add --remove DF DF/DF && + treeDFDF=`git write-tree` && echo treeDFDF $treeDFDF && - git-ls-tree $treeDFDF && - git-ls-files --stage >DFDF.out' + git ls-tree $treeDFDF && + git ls-files --stage >DFDF.out' test_expect_success \ 'DF vs DF/DF case test.' \ 'rm -f .git/index && rm -fr DF && echo DF >DF && - git-update-index --add DF && + git update-index --add DF && read_tree_twoway $treeDF $treeDFDF && - git-ls-files --stage >DFDFcheck.out && + git ls-files --stage >DFDFcheck.out && git diff DFDF.out DFDFcheck.out && check_cache_at DF/DF dirty && :' diff --git a/t/t1002-read-tree-m-u-2way.sh b/t/t1002-read-tree-m-u-2way.sh index 87fe993f59..42e5cf8181 100755 --- a/t/t1002-read-tree-m-u-2way.sh +++ b/t/t1002-read-tree-m-u-2way.sh @@ -20,7 +20,7 @@ compare_change () { } check_cache_at () { - clean_if_empty=`git-diff-files -- "$1"` + clean_if_empty=`git diff-files -- "$1"` case "$clean_if_empty" in '') echo "$1: clean" ;; ?*) echo "$1: dirty" ;; @@ -39,26 +39,26 @@ test_expect_success \ echo nitfol >nitfol && echo bozbar >bozbar && echo rezrov >rezrov && - git-update-index --add nitfol bozbar rezrov && - treeH=`git-write-tree` && + git update-index --add nitfol bozbar rezrov && + treeH=`git write-tree` && echo treeH $treeH && - git-ls-tree $treeH && + git ls-tree $treeH && echo gnusto >bozbar && - git-update-index --add frotz bozbar --force-remove rezrov && - git-ls-files --stage >M.out && - treeM=`git-write-tree` && + git update-index --add frotz bozbar --force-remove rezrov && + git ls-files --stage >M.out && + treeM=`git write-tree` && echo treeM $treeM && - git-ls-tree $treeM && + git ls-tree $treeM && sum bozbar frotz nitfol >M.sum && - git-diff-tree $treeH $treeM' + git diff-tree $treeH $treeM' test_expect_success \ '1, 2, 3 - no carry forward' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && - git-read-tree -m -u $treeH $treeM && - git-ls-files --stage >1-3.out && + git read-tree --reset -u $treeH && + git read-tree -m -u $treeH $treeM && + git ls-files --stage >1-3.out && cmp M.out 1-3.out && sum bozbar frotz nitfol >actual3.sum && cmp M.sum actual3.sum && @@ -69,12 +69,12 @@ test_expect_success \ test_expect_success \ '4 - carry forward local addition.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo "+100644 X 0 yomin" >expected && echo yomin >yomin && - git-update-index --add yomin && - git-read-tree -m -u $treeH $treeM && - git-ls-files --stage >4.out || return 1 + git update-index --add yomin && + git read-tree -m -u $treeH $treeM && + git ls-files --stage >4.out || return 1 diff -U0 M.out 4.out >4diff.out compare_change 4diff.out expected && check_cache_at yomin clean && @@ -87,13 +87,13 @@ test_expect_success \ test_expect_success \ '5 - carry forward local addition.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && - git-read-tree -m -u $treeH && + git read-tree --reset -u $treeH && + git read-tree -m -u $treeH && echo yomin >yomin && - git-update-index --add yomin && + git update-index --add yomin && echo yomin yomin >yomin && - git-read-tree -m -u $treeH $treeM && - git-ls-files --stage >5.out || return 1 + git read-tree -m -u $treeH $treeM && + git ls-files --stage >5.out || return 1 diff -U0 M.out 5.out >5diff.out compare_change 5diff.out expected && check_cache_at yomin dirty && @@ -107,11 +107,11 @@ test_expect_success \ test_expect_success \ '6 - local addition already has the same.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo frotz >frotz && - git-update-index --add frotz && - git-read-tree -m -u $treeH $treeM && - git-ls-files --stage >6.out && + git update-index --add frotz && + git read-tree -m -u $treeH $treeM && + git ls-files --stage >6.out && diff -U0 M.out 6.out && check_cache_at frotz clean && sum bozbar frotz nitfol >actual3.sum && @@ -123,12 +123,12 @@ test_expect_success \ test_expect_success \ '7 - local addition already has the same.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo frotz >frotz && - git-update-index --add frotz && + git update-index --add frotz && echo frotz frotz >frotz && - git-read-tree -m -u $treeH $treeM && - git-ls-files --stage >7.out && + git read-tree -m -u $treeH $treeM && + git ls-files --stage >7.out && diff -U0 M.out 7.out && check_cache_at frotz dirty && sum bozbar frotz nitfol >actual7.sum && @@ -141,28 +141,28 @@ test_expect_success \ test_expect_success \ '8 - conflicting addition.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo frotz frotz >frotz && - git-update-index --add frotz && - if git-read-tree -m -u $treeH $treeM; then false; else :; fi' + git update-index --add frotz && + if git read-tree -m -u $treeH $treeM; then false; else :; fi' test_expect_success \ '9 - conflicting addition.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo frotz frotz >frotz && - git-update-index --add frotz && + git update-index --add frotz && echo frotz >frotz && - if git-read-tree -m -u $treeH $treeM; then false; else :; fi' + if git read-tree -m -u $treeH $treeM; then false; else :; fi' test_expect_success \ '10 - path removed.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo rezrov >rezrov && - git-update-index --add rezrov && - git-read-tree -m -u $treeH $treeM && - git-ls-files --stage >10.out && + git update-index --add rezrov && + git read-tree -m -u $treeH $treeM && + git ls-files --stage >10.out && cmp M.out 10.out && sum bozbar frotz nitfol >actual10.sum && cmp M.sum actual10.sum' @@ -170,28 +170,28 @@ test_expect_success \ test_expect_success \ '11 - dirty path removed.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo rezrov >rezrov && - git-update-index --add rezrov && + git update-index --add rezrov && echo rezrov rezrov >rezrov && - if git-read-tree -m -u $treeH $treeM; then false; else :; fi' + if git read-tree -m -u $treeH $treeM; then false; else :; fi' test_expect_success \ '12 - unmatching local changes being removed.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo rezrov rezrov >rezrov && - git-update-index --add rezrov && - if git-read-tree -m -u $treeH $treeM; then false; else :; fi' + git update-index --add rezrov && + if git read-tree -m -u $treeH $treeM; then false; else :; fi' test_expect_success \ '13 - unmatching local changes being removed.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo rezrov rezrov >rezrov && - git-update-index --add rezrov && + git update-index --add rezrov && echo rezrov >rezrov && - if git-read-tree -m -u $treeH $treeM; then false; else :; fi' + if git read-tree -m -u $treeH $treeM; then false; else :; fi' cat >expected <nitfol && - git-update-index --add nitfol && - git-read-tree -m -u $treeH $treeM && - git-ls-files --stage >14.out || return 1 + git update-index --add nitfol && + git read-tree -m -u $treeH $treeM && + git ls-files --stage >14.out || return 1 diff -U0 M.out 14.out >14diff.out compare_change 14diff.out expected && sum bozbar frotz >actual14.sum && @@ -221,12 +221,12 @@ test_expect_success \ test_expect_success \ '15 - unchanged in two heads.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo nitfol nitfol >nitfol && - git-update-index --add nitfol && + git update-index --add nitfol && echo nitfol nitfol nitfol >nitfol && - git-read-tree -m -u $treeH $treeM && - git-ls-files --stage >15.out || return 1 + git read-tree -m -u $treeH $treeM && + git ls-files --stage >15.out || return 1 diff -U0 M.out 15.out >15diff.out compare_change 15diff.out expected && check_cache_at nitfol dirty && @@ -242,28 +242,28 @@ test_expect_success \ test_expect_success \ '16 - conflicting local change.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo bozbar bozbar >bozbar && - git-update-index --add bozbar && - if git-read-tree -m -u $treeH $treeM; then false; else :; fi' + git update-index --add bozbar && + if git read-tree -m -u $treeH $treeM; then false; else :; fi' test_expect_success \ '17 - conflicting local change.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo bozbar bozbar >bozbar && - git-update-index --add bozbar && + git update-index --add bozbar && echo bozbar bozbar bozbar >bozbar && - if git-read-tree -m -u $treeH $treeM; then false; else :; fi' + if git read-tree -m -u $treeH $treeM; then false; else :; fi' test_expect_success \ '18 - local change already having a good result.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo gnusto >bozbar && - git-update-index --add bozbar && - git-read-tree -m -u $treeH $treeM && - git-ls-files --stage >18.out && + git update-index --add bozbar && + git read-tree -m -u $treeH $treeM && + git ls-files --stage >18.out && diff -U0 M.out 18.out && check_cache_at bozbar clean && sum bozbar frotz nitfol >actual18.sum && @@ -272,12 +272,12 @@ test_expect_success \ test_expect_success \ '19 - local change already having a good result, further modified.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo gnusto >bozbar && - git-update-index --add bozbar && + git update-index --add bozbar && echo gnusto gnusto >bozbar && - git-read-tree -m -u $treeH $treeM && - git-ls-files --stage >19.out && + git read-tree -m -u $treeH $treeM && + git ls-files --stage >19.out && diff -U0 M.out 19.out && check_cache_at bozbar dirty && sum frotz nitfol >actual19.sum && @@ -292,11 +292,11 @@ test_expect_success \ test_expect_success \ '20 - no local change, use new tree.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo bozbar >bozbar && - git-update-index --add bozbar && - git-read-tree -m -u $treeH $treeM && - git-ls-files --stage >20.out && + git update-index --add bozbar && + git read-tree -m -u $treeH $treeM && + git ls-files --stage >20.out && diff -U0 M.out 20.out && check_cache_at bozbar clean && sum bozbar frotz nitfol >actual20.sum && @@ -305,39 +305,39 @@ test_expect_success \ test_expect_success \ '21 - no local change, dirty cache.' \ 'rm -f .git/index nitfol bozbar rezrov frotz && - git-read-tree --reset -u $treeH && + git read-tree --reset -u $treeH && echo bozbar >bozbar && - git-update-index --add bozbar && + git update-index --add bozbar && echo gnusto gnusto >bozbar && - if git-read-tree -m -u $treeH $treeM; then false; else :; fi' + if git read-tree -m -u $treeH $treeM; then false; else :; fi' # Also make sure we did not break DF vs DF/DF case. test_expect_success \ 'DF vs DF/DF case setup.' \ 'rm -f .git/index echo DF >DF && - git-update-index --add DF && - treeDF=`git-write-tree` && + git update-index --add DF && + treeDF=`git write-tree` && echo treeDF $treeDF && - git-ls-tree $treeDF && + git ls-tree $treeDF && rm -f DF && mkdir DF && echo DF/DF >DF/DF && - git-update-index --add --remove DF DF/DF && - treeDFDF=`git-write-tree` && + git update-index --add --remove DF DF/DF && + treeDFDF=`git write-tree` && echo treeDFDF $treeDFDF && - git-ls-tree $treeDFDF && - git-ls-files --stage >DFDF.out' + git ls-tree $treeDFDF && + git ls-files --stage >DFDF.out' test_expect_success \ 'DF vs DF/DF case test.' \ 'rm -f .git/index && rm -fr DF && echo DF >DF && - git-update-index --add DF && - git-read-tree -m -u $treeDF $treeDFDF && - git-ls-files --stage >DFDFcheck.out && + git update-index --add DF && + git read-tree -m -u $treeDF $treeDFDF && + git ls-files --stage >DFDFcheck.out && diff -U0 DFDF.out DFDFcheck.out && check_cache_at DF/DF clean' diff --git a/t/t1003-read-tree-prefix.sh b/t/t1003-read-tree-prefix.sh index 48ab117d75..8c6d67edda 100755 --- a/t/t1003-read-tree-prefix.sh +++ b/t/t1003-read-tree-prefix.sh @@ -3,15 +3,15 @@ # Copyright (c) 2006 Junio C Hamano # -test_description='git-read-tree --prefix test. +test_description='git read-tree --prefix test. ' . ./test-lib.sh test_expect_success setup ' echo hello >one && - git-update-index --add one && - tree=`git-write-tree` && + git update-index --add one && + tree=`git write-tree` && echo tree is $tree ' @@ -19,8 +19,8 @@ echo 'one two/one' >expect test_expect_success 'read-tree --prefix' ' - git-read-tree --prefix=two/ $tree && - git-ls-files >actual && + git read-tree --prefix=two/ $tree && + git ls-files >actual && cmp expect actual ' diff --git a/t/t1004-read-tree-m-u-wf.sh b/t/t1004-read-tree-m-u-wf.sh index c11420a8b6..d609a551ae 100755 --- a/t/t1004-read-tree-m-u-wf.sh +++ b/t/t1004-read-tree-m-u-wf.sh @@ -84,7 +84,7 @@ test_expect_success 'three-way not complaining on an untracked path in both' ' echo >file2 file two is untracked on the master side && echo >subdir/file2 file two is untracked on the master side && - git-read-tree -m -u branch-point master side + git read-tree -m -u branch-point master side ' test_expect_success 'three-way not clobbering a working tree file' ' diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh index 1e8f9e59df..b9cef3422c 100755 --- a/t/t1020-subdirectory.sh +++ b/t/t1020-subdirectory.sh @@ -22,19 +22,19 @@ LF=' test_expect_success 'update-index and ls-files' ' cd $HERE && - git-update-index --add one && - case "`git-ls-files`" in + git update-index --add one && + case "`git ls-files`" in one) echo ok one ;; *) echo bad one; exit 1 ;; esac && cd dir && - git-update-index --add two && - case "`git-ls-files`" in + git update-index --add two && + case "`git ls-files`" in two) echo ok two ;; *) echo bad two; exit 1 ;; esac && cd .. && - case "`git-ls-files`" in + case "`git ls-files`" in dir/two"$LF"one) echo ok both ;; *) echo bad; exit 1 ;; esac @@ -42,13 +42,13 @@ test_expect_success 'update-index and ls-files' ' test_expect_success 'cat-file' ' cd $HERE && - two=`git-ls-files -s dir/two` && + two=`git ls-files -s dir/two` && two=`expr "$two" : "[0-7]* \\([0-9a-f]*\\)"` && echo "$two" && - git-cat-file -p "$two" >actual && + git cat-file -p "$two" >actual && cmp dir/two actual && cd dir && - git-cat-file -p "$two" >actual && + git cat-file -p "$two" >actual && cmp two actual ' rm -f actual dir/actual @@ -57,17 +57,17 @@ test_expect_success 'diff-files' ' cd $HERE && echo a >>one && echo d >>dir/two && - case "`git-diff-files --name-only`" in + case "`git diff-files --name-only`" in dir/two"$LF"one) echo ok top ;; *) echo bad top; exit 1 ;; esac && # diff should not omit leading paths cd dir && - case "`git-diff-files --name-only`" in + case "`git diff-files --name-only`" in dir/two"$LF"one) echo ok subdir ;; *) echo bad subdir; exit 1 ;; esac && - case "`git-diff-files --name-only .`" in + case "`git diff-files --name-only .`" in dir/two) echo ok subdir limited ;; *) echo bad subdir limited; exit 1 ;; esac @@ -75,33 +75,33 @@ test_expect_success 'diff-files' ' test_expect_success 'write-tree' ' cd $HERE && - top=`git-write-tree` && + top=`git write-tree` && echo $top && cd dir && - sub=`git-write-tree` && + sub=`git write-tree` && echo $sub && test "z$top" = "z$sub" ' test_expect_success 'checkout-index' ' cd $HERE && - git-checkout-index -f -u one && + git checkout-index -f -u one && cmp one original.one && cd dir && - git-checkout-index -f -u two && + git checkout-index -f -u two && cmp two ../original.two ' test_expect_success 'read-tree' ' cd $HERE && rm -f one dir/two && - tree=`git-write-tree` && - git-read-tree --reset -u "$tree" && + tree=`git write-tree` && + git read-tree --reset -u "$tree" && cmp one original.one && cmp dir/two original.two && cd dir && rm -f two && - git-read-tree --reset -u "$tree" && + git read-tree --reset -u "$tree" && cmp two ../original.two && cmp ../one ../original.one ' diff --git a/t/t1100-commit-tree-options.sh b/t/t1100-commit-tree-options.sh index 19a0ed4d20..7f7fc36734 100755 --- a/t/t1100-commit-tree-options.sh +++ b/t/t1100-commit-tree-options.sh @@ -3,9 +3,9 @@ # Copyright (C) 2005 Rene Scharfe # -test_description='git-commit-tree options test +test_description='git commit-tree options test -This test checks that git-commit-tree can create a specific commit +This test checks that git commit-tree can create a specific commit object by defining all environment variables that it understands. ' @@ -21,7 +21,7 @@ EOF test_expect_success \ 'test preparation: write empty tree' \ - 'git-write-tree >treeid' + 'git write-tree >treeid' test_expect_success \ 'construct commit' \ @@ -32,11 +32,11 @@ test_expect_success \ GIT_COMMITTER_NAME="Committer Name" \ GIT_COMMITTER_EMAIL="committer@email" \ GIT_COMMITTER_DATE="2005-05-26 23:30" \ - TZ=GMT git-commit-tree `cat treeid` >commitid 2>/dev/null' + TZ=GMT git commit-tree `cat treeid` >commitid 2>/dev/null' test_expect_success \ 'read commit' \ - 'git-cat-file commit `cat commitid` >commit' + 'git cat-file commit `cat commitid` >commit' test_expect_success \ 'compare commit' \ diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh index d3f8358485..991d3c5e9c 100755 --- a/t/t1200-tutorial.sh +++ b/t/t1200-tutorial.sh @@ -10,11 +10,11 @@ test_description='A simple turial in the form of a test case' echo "Hello World" > hello echo "Silly example" > example -git-update-index --add hello example +git update-index --add hello example -test_expect_success 'blob' "test blob = \"$(git-cat-file -t 557db03)\"" +test_expect_success 'blob' "test blob = \"$(git cat-file -t 557db03)\"" -test_expect_success 'blob 557db03' "test \"Hello World\" = \"$(git-cat-file blob 557db03)\"" +test_expect_success 'blob 557db03' "test \"Hello World\" = \"$(git cat-file blob 557db03)\"" echo "It's a new day for git" >>hello cat > diff.expect << EOF @@ -26,25 +26,25 @@ index 557db03..263414f 100644 Hello World +It's a new day for git EOF -git-diff-files -p > diff.output -test_expect_success 'git-diff-files -p' 'cmp diff.expect diff.output' +git diff-files -p > diff.output +test_expect_success 'git diff-files -p' 'cmp diff.expect diff.output' git diff > diff.output test_expect_success 'git diff' 'cmp diff.expect diff.output' -tree=$(git-write-tree 2>/dev/null) +tree=$(git write-tree 2>/dev/null) test_expect_success 'tree' "test 8988da15d077d4829fc51d8544c097def6644dbb = $tree" -output="$(echo "Initial commit" | git-commit-tree $(git-write-tree) 2>&1 > .git/refs/heads/master)" +output="$(echo "Initial commit" | git commit-tree $(git write-tree) 2>&1 > .git/refs/heads/master)" -git-diff-index -p HEAD > diff.output -test_expect_success 'git-diff-index -p HEAD' 'cmp diff.expect diff.output' +git diff-index -p HEAD > diff.output +test_expect_success 'git diff-index -p HEAD' 'cmp diff.expect diff.output' git diff HEAD > diff.output test_expect_success 'git diff HEAD' 'cmp diff.expect diff.output' #rm hello -#test_expect_success 'git-read-tree --reset HEAD' "git-read-tree --reset HEAD ; test \"hello: needs update\" = \"$(git-update-index --refresh)\"" +#test_expect_success 'git read-tree --reset HEAD' "git read-tree --reset HEAD ; test \"hello: needs update\" = \"$(git update-index --refresh)\"" cat > whatchanged.expect << EOF commit VARIABLE @@ -69,11 +69,11 @@ index 0000000..557db03 +Hello World EOF -git-whatchanged -p --root | \ +git whatchanged -p --root | \ sed -e "1s/^\(.\{7\}\).\{40\}/\1VARIABLE/" \ -e "2,3s/^\(.\{8\}\).*$/\1VARIABLE/" \ > whatchanged.output -test_expect_success 'git-whatchanged -p --root' 'cmp whatchanged.expect whatchanged.output' +test_expect_success 'git whatchanged -p --root' 'cmp whatchanged.expect whatchanged.output' git tag my-first-tag test_expect_success 'git tag my-first-tag' 'cmp .git/refs/heads/master .git/refs/tags/my-first-tag' diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index a2c11c4639..1c43cc333d 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -3,13 +3,13 @@ # Copyright (c) 2005 Johannes Schindelin # -test_description='Test git-config in different settings' +test_description='Test git config in different settings' . ./test-lib.sh test -f .git/config && rm .git/config -git-config core.penguin "little blue" +git config core.penguin "little blue" cat > expect << EOF [core] @@ -18,7 +18,7 @@ EOF test_expect_success 'initial' 'cmp .git/config expect' -git-config Core.Movie BadPhysics +git config Core.Movie BadPhysics cat > expect << EOF [core] @@ -28,7 +28,7 @@ EOF test_expect_success 'mixed case' 'cmp .git/config expect' -git-config Cores.WhatEver Second +git config Cores.WhatEver Second cat > expect << EOF [core] @@ -40,7 +40,7 @@ EOF test_expect_success 'similar section' 'cmp .git/config expect' -git-config CORE.UPPERCASE true +git config CORE.UPPERCASE true cat > expect << EOF [core] @@ -54,10 +54,10 @@ EOF test_expect_success 'similar section' 'cmp .git/config expect' test_expect_success 'replace with non-match' \ - 'git-config core.penguin kingpin !blue' + 'git config core.penguin kingpin !blue' test_expect_success 'replace with non-match (actually matching)' \ - 'git-config core.penguin "very blue" !kingpin' + 'git config core.penguin "very blue" !kingpin' cat > expect << EOF [core] @@ -86,7 +86,7 @@ EOF cp .git/config .git/config2 test_expect_success 'multiple unset' \ - 'git-config --unset-all beta.haha' + 'git config --unset-all beta.haha' cat > expect << EOF [beta] ; silly comment # another comment @@ -102,7 +102,7 @@ test_expect_success 'multiple unset is correct' 'cmp .git/config expect' mv .git/config2 .git/config test_expect_success '--replace-all' \ - 'git-config --replace-all beta.haha gamma' + 'git config --replace-all beta.haha gamma' cat > expect << EOF [beta] ; silly comment # another comment @@ -116,7 +116,7 @@ EOF test_expect_success 'all replaced' 'cmp .git/config expect' -git-config beta.haha alpha +git config beta.haha alpha cat > expect << EOF [beta] ; silly comment # another comment @@ -130,7 +130,7 @@ EOF test_expect_success 'really mean test' 'cmp .git/config expect' -git-config nextsection.nonewline wow +git config nextsection.nonewline wow cat > expect << EOF [beta] ; silly comment # another comment @@ -145,8 +145,8 @@ EOF test_expect_success 'really really mean test' 'cmp .git/config expect' -test_expect_success 'get value' 'test alpha = $(git-config beta.haha)' -git-config --unset beta.haha +test_expect_success 'get value' 'test alpha = $(git config beta.haha)' +git config --unset beta.haha cat > expect << EOF [beta] ; silly comment # another comment @@ -160,7 +160,7 @@ EOF test_expect_success 'unset' 'cmp .git/config expect' -git-config nextsection.NoNewLine "wow2 for me" "for me$" +git config nextsection.NoNewLine "wow2 for me" "for me$" cat > expect << EOF [beta] ; silly comment # another comment @@ -176,18 +176,18 @@ EOF test_expect_success 'multivar' 'cmp .git/config expect' test_expect_success 'non-match' \ - 'git-config --get nextsection.nonewline !for' + 'git config --get nextsection.nonewline !for' test_expect_success 'non-match value' \ - 'test wow = $(git-config --get nextsection.nonewline !for)' + 'test wow = $(git config --get nextsection.nonewline !for)' test_expect_failure 'ambiguous get' \ - 'git-config --get nextsection.nonewline' + 'git config --get nextsection.nonewline' test_expect_success 'get multivar' \ - 'git-config --get-all nextsection.nonewline' + 'git config --get-all nextsection.nonewline' -git-config nextsection.nonewline "wow3" "wow$" +git config nextsection.nonewline "wow3" "wow$" cat > expect << EOF [beta] ; silly comment # another comment @@ -202,15 +202,15 @@ EOF test_expect_success 'multivar replace' 'cmp .git/config expect' -test_expect_failure 'ambiguous value' 'git-config nextsection.nonewline' +test_expect_failure 'ambiguous value' 'git config nextsection.nonewline' test_expect_failure 'ambiguous unset' \ - 'git-config --unset nextsection.nonewline' + 'git config --unset nextsection.nonewline' test_expect_failure 'invalid unset' \ - 'git-config --unset somesection.nonewline' + 'git config --unset somesection.nonewline' -git-config --unset nextsection.nonewline "wow3$" +git config --unset nextsection.nonewline "wow3$" cat > expect << EOF [beta] ; silly comment # another comment @@ -224,12 +224,12 @@ EOF test_expect_success 'multivar unset' 'cmp .git/config expect' -test_expect_failure 'invalid key' 'git-config inval.2key blabla' +test_expect_failure 'invalid key' 'git config inval.2key blabla' -test_expect_success 'correct key' 'git-config 123456.a123 987' +test_expect_success 'correct key' 'git config 123456.a123 987' test_expect_success 'hierarchical section' \ - 'git-config Version.1.2.3eX.Alpha beta' + 'git config Version.1.2.3eX.Alpha beta' cat > expect << EOF [beta] ; silly comment # another comment @@ -255,7 +255,7 @@ version.1.2.3eX.alpha=beta EOF test_expect_success 'working --list' \ - 'git-config --list > output && cmp output expect' + 'git config --list > output && cmp output expect' cat > expect << EOF beta.noindent sillyValue @@ -263,9 +263,9 @@ nextsection.nonewline wow2 for me EOF test_expect_success '--get-regexp' \ - 'git-config --get-regexp in > output && cmp output expect' + 'git config --get-regexp in > output && cmp output expect' -git-config --add nextsection.nonewline "wow4 for you" +git config --add nextsection.nonewline "wow4 for you" cat > expect << EOF wow2 for me @@ -273,7 +273,7 @@ wow4 for you EOF test_expect_success '--add' \ - 'git-config --get-all nextsection.nonewline > output && cmp output expect' + 'git config --get-all nextsection.nonewline > output && cmp output expect' cat > .git/config << EOF [novalue] @@ -281,15 +281,15 @@ cat > .git/config << EOF EOF test_expect_success 'get variable with no value' \ - 'git-config --get novalue.variable ^$' + 'git config --get novalue.variable ^$' echo novalue.variable > expect test_expect_success 'get-regexp variable with no value' \ - 'git-config --get-regexp novalue > output && + 'git config --get-regexp novalue > output && cmp output expect' -git-config > output 2>&1 +git config > output 2>&1 test_expect_success 'no arguments, but no crash' \ "test $? = 129 && grep usage output" @@ -299,7 +299,7 @@ cat > .git/config << EOF c = d EOF -git-config a.x y +git config a.x y cat > expect << EOF [a.b] @@ -310,8 +310,8 @@ EOF test_expect_success 'new section is partial match of another' 'cmp .git/config expect' -git-config b.x y -git-config a.b c +git config b.x y +git config a.b c cat > expect << EOF [a.b] @@ -334,11 +334,11 @@ cat > expect << EOF ein.bahn=strasse EOF -GIT_CONFIG=other-config git-config -l > output +GIT_CONFIG=other-config git config -l > output test_expect_success 'alternative GIT_CONFIG' 'cmp output expect' -GIT_CONFIG=other-config git-config anwohner.park ausweis +GIT_CONFIG=other-config git config anwohner.park ausweis cat > expect << EOF [ein] @@ -361,7 +361,7 @@ weird EOF test_expect_success "rename section" \ - "git-config --rename-section branch.eins branch.zwei" + "git config --rename-section branch.eins branch.zwei" cat > expect << EOF # Hallo @@ -377,12 +377,12 @@ EOF test_expect_success "rename succeeded" "git diff expect .git/config" test_expect_failure "rename non-existing section" \ - 'git-config --rename-section branch."world domination" branch.drei' + 'git config --rename-section branch."world domination" branch.drei' test_expect_success "rename succeeded" "git diff expect .git/config" test_expect_success "rename another section" \ - 'git-config --rename-section branch."1 234 blabl/a" branch.drei' + 'git config --rename-section branch."1 234 blabl/a" branch.drei' cat > expect << EOF # Hallo @@ -425,20 +425,20 @@ EOF test_expect_success 'section ending' ' - git-config gitcvs.enabled true && - git-config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite && - git-config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite && + git config gitcvs.enabled true && + git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite && + git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite && cmp .git/config expect ' test_expect_success numbers ' - git-config kilo.gram 1k && - git-config mega.ton 1m && - k=$(git-config --int --get kilo.gram) && + git config kilo.gram 1k && + git config mega.ton 1m && + k=$(git config --int --get kilo.gram) && test z1024 = "z$k" && - m=$(git-config --int --get mega.ton) && + m=$(git config --int --get mega.ton) && test z1048576 = "z$m" ' @@ -455,30 +455,30 @@ EOF test_expect_success bool ' - git-config bool.true1 01 && - git-config bool.true2 -1 && - git-config bool.true3 YeS && - git-config bool.true4 true && - git-config bool.false1 000 && - git-config bool.false2 "" && - git-config bool.false3 nO && - git-config bool.false4 FALSE && + git config bool.true1 01 && + git config bool.true2 -1 && + git config bool.true3 YeS && + git config bool.true4 true && + git config bool.false1 000 && + git config bool.false2 "" && + git config bool.false3 nO && + git config bool.false4 FALSE && rm -f result && for i in 1 2 3 4 do - git-config --bool --get bool.true$i >>result - git-config --bool --get bool.false$i >>result + git config --bool --get bool.true$i >>result + git config --bool --get bool.false$i >>result done && cmp expect result' test_expect_failure 'invalid bool (--get)' ' - git-config bool.nobool foobar && - git-config --bool --get bool.nobool' + git config bool.nobool foobar && + git config --bool --get bool.nobool' test_expect_failure 'invalid bool (set)' ' - git-config --bool bool.nobool foobar' + git config --bool bool.nobool foobar' rm .git/config @@ -496,14 +496,14 @@ EOF test_expect_success 'set --bool' ' - git-config --bool bool.true1 01 && - git-config --bool bool.true2 -1 && - git-config --bool bool.true3 YeS && - git-config --bool bool.true4 true && - git-config --bool bool.false1 000 && - git-config --bool bool.false2 "" && - git-config --bool bool.false3 nO && - git-config --bool bool.false4 FALSE && + git config --bool bool.true1 01 && + git config --bool bool.true2 -1 && + git config --bool bool.true3 YeS && + git config --bool bool.true4 true && + git config --bool bool.false1 000 && + git config --bool bool.false2 "" && + git config --bool bool.false3 nO && + git config --bool bool.false4 FALSE && cmp expect .git/config' rm .git/config @@ -517,17 +517,17 @@ EOF test_expect_success 'set --int' ' - git-config --int int.val1 01 && - git-config --int int.val2 -1 && - git-config --int int.val3 5m && + git config --int int.val1 01 && + git config --int int.val2 -1 && + git config --int int.val3 5m && cmp expect .git/config' rm .git/config -git-config quote.leading " test" -git-config quote.ending "test " -git-config quote.semicolon "test;test" -git-config quote.hash "test#test" +git config quote.leading " test" +git config quote.ending "test " +git config quote.semicolon "test;test" +git config quote.hash "test#test" cat > expect << EOF [quote] diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index d0aba2c2ae..c4c0dfaab1 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Shawn Pearce # -test_description='Test git-update-ref and basic ref logging' +test_description='Test git update-ref and basic ref logging' . ./test-lib.sh Z=0000000000000000000000000000000000000000 @@ -19,34 +19,34 @@ n=$n_dir/fixes test_expect_success \ "create $m" \ - "git-update-ref $m $A && + "git update-ref $m $A && test $A"' = $(cat .git/'"$m"')' test_expect_success \ "create $m" \ - "git-update-ref $m $B $A && + "git update-ref $m $B $A && test $B"' = $(cat .git/'"$m"')' rm -f .git/$m test_expect_success \ "fail to create $n" \ "touch .git/$n_dir - git-update-ref $n $A >out 2>err"' + git update-ref $n $A >out 2>err"' test $? != 0' rm -f .git/$n_dir out err test_expect_success \ "create $m (by HEAD)" \ - "git-update-ref HEAD $A && + "git update-ref HEAD $A && test $A"' = $(cat .git/'"$m"')' test_expect_success \ "create $m (by HEAD)" \ - "git-update-ref HEAD $B $A && + "git update-ref HEAD $B $A && test $B"' = $(cat .git/'"$m"')' rm -f .git/$m test_expect_failure \ '(not) create HEAD with old sha1' \ - "git-update-ref HEAD $A $B" + "git update-ref HEAD $A $B" test_expect_failure \ "(not) prior created .git/$m" \ "test -f .git/$m" @@ -54,10 +54,10 @@ rm -f .git/$m test_expect_success \ "create HEAD" \ - "git-update-ref HEAD $A" + "git update-ref HEAD $A" test_expect_failure \ '(not) change HEAD with wrong SHA1' \ - "git-update-ref HEAD $B $Z" + "git update-ref HEAD $B $Z" test_expect_failure \ "(not) changed .git/$m" \ "test $B"' = $(cat .git/'"$m"')' @@ -68,17 +68,17 @@ rm -f .git/$m test_expect_success \ "create $m (logged by touch)" \ 'GIT_COMMITTER_DATE="2005-05-26 23:30" \ - git-update-ref HEAD '"$A"' -m "Initial Creation" && + git update-ref HEAD '"$A"' -m "Initial Creation" && test '"$A"' = $(cat .git/'"$m"')' test_expect_success \ "update $m (logged by touch)" \ 'GIT_COMMITTER_DATE="2005-05-26 23:31" \ - git-update-ref HEAD'" $B $A "'-m "Switch" && + git update-ref HEAD'" $B $A "'-m "Switch" && test '"$B"' = $(cat .git/'"$m"')' test_expect_success \ "set $m (logged by touch)" \ 'GIT_COMMITTER_DATE="2005-05-26 23:41" \ - git-update-ref HEAD'" $A && + git update-ref HEAD'" $A && test $A"' = $(cat .git/'"$m"')' cat >expect <expect <.git/logs/$m < 1117150320 -0500 $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500 @@ -136,49 +136,49 @@ ld="Thu, 26 May 2005 18:43:00 -0500" test_expect_success \ 'Query "master@{May 25 2005}" (before history)' \ 'rm -f o e - git-rev-parse --verify "master@{May 25 2005}" >o 2>e && + git rev-parse --verify "master@{May 25 2005}" >o 2>e && test '"$C"' = $(cat o) && test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"' test_expect_success \ "Query master@{2005-05-25} (before history)" \ 'rm -f o e - git-rev-parse --verify master@{2005-05-25} >o 2>e && + git rev-parse --verify master@{2005-05-25} >o 2>e && test '"$C"' = $(cat o) && echo test "warning: Log for '\'master\'' only goes back to $ed." = "$(cat e)"' test_expect_success \ 'Query "master@{May 26 2005 23:31:59}" (1 second before history)' \ 'rm -f o e - git-rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e && + git rev-parse --verify "master@{May 26 2005 23:31:59}" >o 2>e && test '"$C"' = $(cat o) && test "warning: Log for '\''master'\'' only goes back to $ed." = "$(cat e)"' test_expect_success \ 'Query "master@{May 26 2005 23:32:00}" (exactly history start)' \ 'rm -f o e - git-rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e && + git rev-parse --verify "master@{May 26 2005 23:32:00}" >o 2>e && test '"$A"' = $(cat o) && test "" = "$(cat e)"' test_expect_success \ 'Query "master@{2005-05-26 23:33:01}" (middle of history with gap)' \ 'rm -f o e - git-rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e && + git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e && test '"$B"' = $(cat o) && test "warning: Log .git/logs/'"$m has gap after $gd"'." = "$(cat e)"' test_expect_success \ 'Query "master@{2005-05-26 23:38:00}" (middle of history)' \ 'rm -f o e - git-rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e && + git rev-parse --verify "master@{2005-05-26 23:38:00}" >o 2>e && test '"$Z"' = $(cat o) && test "" = "$(cat e)"' test_expect_success \ 'Query "master@{2005-05-26 23:43:00}" (exact end of history)' \ 'rm -f o e - git-rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e && + git rev-parse --verify "master@{2005-05-26 23:43:00}" >o 2>e && test '"$E"' = $(cat o) && test "" = "$(cat e)"' test_expect_success \ 'Query "master@{2005-05-28}" (past end of history)' \ 'rm -f o e - git-rev-parse --verify "master@{2005-05-28}" >o 2>e && + git rev-parse --verify "master@{2005-05-28}" >o 2>e && test '"$D"' = $(cat o) && test "warning: Log .git/logs/'"$m unexpectedly ended on $ld"'." = "$(cat e)"' @@ -188,26 +188,26 @@ rm -f .git/$m .git/logs/$m expect test_expect_success \ 'creating initial files' \ 'echo TEST >F && - git-add F && + git add F && GIT_AUTHOR_DATE="2005-05-26 23:30" \ GIT_COMMITTER_DATE="2005-05-26 23:30" git-commit -m add -a && - h_TEST=$(git-rev-parse --verify HEAD) + h_TEST=$(git rev-parse --verify HEAD) echo The other day this did not work. >M && echo And then Bob told me how to fix it. >>M && echo OTHER >F && GIT_AUTHOR_DATE="2005-05-26 23:41" \ GIT_COMMITTER_DATE="2005-05-26 23:41" git-commit -F M -a && - h_OTHER=$(git-rev-parse --verify HEAD) && + h_OTHER=$(git rev-parse --verify HEAD) && echo FIXED >F && GIT_AUTHOR_DATE="2005-05-26 23:44" \ GIT_COMMITTER_DATE="2005-05-26 23:44" git-commit --amend && - h_FIXED=$(git-rev-parse --verify HEAD) && + h_FIXED=$(git rev-parse --verify HEAD) && echo TEST+FIXED >F && echo Merged initial commit and a later commit. >M && echo $h_TEST >.git/MERGE_HEAD && GIT_AUTHOR_DATE="2005-05-26 23:45" \ GIT_COMMITTER_DATE="2005-05-26 23:45" git-commit -F M && - h_MERGED=$(git-rev-parse --verify HEAD) + h_MERGED=$(git rev-parse --verify HEAD) rm -f M' cat >expect <path1/file1 test_expect_success \ - 'git-update-index --add various paths.' \ - 'git-update-index --add path0 path1/file1' + 'git update-index --add various paths.' \ + 'git update-index --add path0 path1/file1' rm -fr path0 path1 mkdir path0 @@ -37,15 +37,15 @@ date >path0/file0 date >path1 test_expect_failure \ - 'git-checkout-index without -f should fail on conflicting work tree.' \ - 'git-checkout-index -a' + 'git checkout-index without -f should fail on conflicting work tree.' \ + 'git checkout-index -a' test_expect_success \ - 'git-checkout-index with -f should succeed.' \ - 'git-checkout-index -f -a' + 'git checkout-index with -f should succeed.' \ + 'git checkout-index -f -a' test_expect_success \ - 'git-checkout-index conflicting paths.' \ + 'git checkout-index conflicting paths.' \ 'test -f path0 && test -d path1 && test -f path1/file1' test_done diff --git a/t/t2001-checkout-cache-clash.sh b/t/t2001-checkout-cache-clash.sh index b895a0fe36..ef007532b1 100755 --- a/t/t2001-checkout-cache-clash.sh +++ b/t/t2001-checkout-cache-clash.sh @@ -3,7 +3,7 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-checkout-index test. +test_description='git checkout-index test. This test registers the following filesystem structure in the cache: @@ -26,46 +26,46 @@ show_files() { find path? -ls | sed -e 's/^[0-9]* * [0-9]* * \([-bcdl]\)[^ ]* *[0-9]* *[^ ]* *[^ ]* *[0-9]* [A-Z][a-z][a-z] [0-9][0-9] [^ ]* /fs: \1 /' # what's in the cache, just mode and name - git-ls-files --stage | + git ls-files --stage | sed -e 's/^\([0-9]*\) [0-9a-f]* [0-3] /ca: \1 /' # what's in the tree, just mode and name. - git-ls-tree -r "$1" | + git ls-tree -r "$1" | sed -e 's/^\([0-9]*\) [^ ]* [0-9a-f]* /tr: \1 /' } mkdir path0 date >path0/file0 test_expect_success \ - 'git-update-index --add path0/file0' \ - 'git-update-index --add path0/file0' + 'git update-index --add path0/file0' \ + 'git update-index --add path0/file0' test_expect_success \ - 'writing tree out with git-write-tree' \ - 'tree1=$(git-write-tree)' + 'writing tree out with git write-tree' \ + 'tree1=$(git write-tree)' test_debug 'show_files $tree1' mkdir path1 date >path1/file1 test_expect_success \ - 'git-update-index --add path1/file1' \ - 'git-update-index --add path1/file1' + 'git update-index --add path1/file1' \ + 'git update-index --add path1/file1' test_expect_success \ - 'writing tree out with git-write-tree' \ - 'tree2=$(git-write-tree)' + 'writing tree out with git write-tree' \ + 'tree2=$(git write-tree)' test_debug 'show_files $tree2' rm -fr path1 test_expect_success \ 'read previously written tree and checkout.' \ - 'git-read-tree -m $tree1 && git-checkout-index -f -a' + 'git read-tree -m $tree1 && git checkout-index -f -a' test_debug 'show_files $tree1' ln -s path0 path1 test_expect_success \ - 'git-update-index --add a symlink.' \ - 'git-update-index --add path1' + 'git update-index --add a symlink.' \ + 'git update-index --add path1' test_expect_success \ - 'writing tree out with git-write-tree' \ - 'tree3=$(git-write-tree)' + 'writing tree out with git write-tree' \ + 'tree3=$(git write-tree)' test_debug 'show_files $tree3' # Morten says "Got that?" here. @@ -73,7 +73,7 @@ test_debug 'show_files $tree3' test_expect_success \ 'read previously written tree and checkout.' \ - 'git-read-tree $tree2 && git-checkout-index -f -a' + 'git read-tree $tree2 && git checkout-index -f -a' test_debug 'show_files $tree2' test_expect_success \ diff --git a/t/t2002-checkout-cache-u.sh b/t/t2002-checkout-cache-u.sh index 4352ddb1cb..f7a0055920 100755 --- a/t/t2002-checkout-cache-u.sh +++ b/t/t2002-checkout-cache-u.sh @@ -3,31 +3,31 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-checkout-index -u test. +test_description='git checkout-index -u test. -With -u flag, git-checkout-index internally runs the equivalent of -git-update-index --refresh on the checked out entry.' +With -u flag, git checkout-index internally runs the equivalent of +git update-index --refresh on the checked out entry.' . ./test-lib.sh test_expect_success \ 'preparation' ' echo frotz >path0 && -git-update-index --add path0 && -t=$(git-write-tree)' +git update-index --add path0 && +t=$(git write-tree)' test_expect_failure \ -'without -u, git-checkout-index smudges stat information.' ' +'without -u, git checkout-index smudges stat information.' ' rm -f path0 && -git-read-tree $t && -git-checkout-index -f -a && -git-diff-files | diff - /dev/null' +git read-tree $t && +git checkout-index -f -a && +git diff-files | diff - /dev/null' test_expect_success \ -'with -u, git-checkout-index picks up stat information from new files.' ' +'with -u, git checkout-index picks up stat information from new files.' ' rm -f path0 && -git-read-tree $t && -git-checkout-index -u -f -a && -git-diff-files | diff - /dev/null' +git read-tree $t && +git checkout-index -u -f -a && +git diff-files | diff - /dev/null' test_done diff --git a/t/t2003-checkout-cache-mkdir.sh b/t/t2003-checkout-cache-mkdir.sh index f9bc90aee4..71894b3743 100755 --- a/t/t2003-checkout-cache-mkdir.sh +++ b/t/t2003-checkout-cache-mkdir.sh @@ -3,7 +3,7 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-checkout-index --prefix test. +test_description='git checkout-index --prefix test. This test makes sure that --prefix option works as advertised, and also verifies that such leading path may contain symlinks, unlike @@ -17,14 +17,14 @@ test_expect_success \ 'mkdir path1 && echo frotz >path0 && echo rezrov >path1/file1 && - git-update-index --add path0 path1/file1' + git update-index --add path0 path1/file1' test_expect_success \ 'have symlink in place where dir is expected.' \ 'rm -fr path0 path1 && mkdir path2 && ln -s path2 path1 && - git-checkout-index -f -a && + git checkout-index -f -a && test ! -h path1 && test -d path1 && test -f path1/file1 && test ! -f path2/file1' @@ -32,7 +32,7 @@ test_expect_success \ 'use --prefix=path2/' \ 'rm -fr path0 path1 path2 && mkdir path2 && - git-checkout-index --prefix=path2/ -f -a && + git checkout-index --prefix=path2/ -f -a && test -f path2/path0 && test -f path2/path1/file1 && test ! -f path0 && @@ -41,7 +41,7 @@ test_expect_success \ test_expect_success \ 'use --prefix=tmp-' \ 'rm -fr path0 path1 path2 tmp* && - git-checkout-index --prefix=tmp- -f -a && + git checkout-index --prefix=tmp- -f -a && test -f tmp-path0 && test -f tmp-path1/file1 && test ! -f path0 && @@ -52,7 +52,7 @@ test_expect_success \ 'rm -fr path0 path1 path2 tmp* && echo nitfol >tmp-path1 && mkdir tmp-path0 && - git-checkout-index --prefix=tmp- -f -a && + git checkout-index --prefix=tmp- -f -a && test -f tmp-path0 && test -f tmp-path1/file1 && test ! -f path0 && @@ -64,7 +64,7 @@ test_expect_success \ 'rm -fr path0 path1 path2 tmp* && mkdir tmp1 tmp1/orary && ln -s tmp1 tmp && - git-checkout-index --prefix=tmp/orary/ -f -a && + git checkout-index --prefix=tmp/orary/ -f -a && test -d tmp1/orary && test -f tmp1/orary/path0 && test -f tmp1/orary/path1/file1 && @@ -76,7 +76,7 @@ test_expect_success \ 'rm -fr path0 path1 path2 tmp* && mkdir tmp1 && ln -s tmp1 tmp && - git-checkout-index --prefix=tmp/orary- -f -a && + git checkout-index --prefix=tmp/orary- -f -a && test -f tmp1/orary-path0 && test -f tmp1/orary-path1/file1 && test -h tmp' @@ -87,7 +87,7 @@ test_expect_success \ 'rm -fr path0 path1 path2 tmp* && mkdir tmp1 && ln -s tmp1 tmp-path1 && - git-checkout-index --prefix=tmp- -f -a && + git checkout-index --prefix=tmp- -f -a && test -f tmp-path0 && test ! -h tmp-path1 && test -d tmp-path1 && diff --git a/t/t2004-checkout-cache-temp.sh b/t/t2004-checkout-cache-temp.sh index c100959cad..39133b8c7a 100755 --- a/t/t2004-checkout-cache-temp.sh +++ b/t/t2004-checkout-cache-temp.sh @@ -3,9 +3,9 @@ # Copyright (c) 2006 Shawn Pearce # -test_description='git-checkout-index --temp test. +test_description='git checkout-index --temp test. -With --temp flag, git-checkout-index writes to temporary merge files +With --temp flag, git checkout-index writes to temporary merge files rather than the tracked path.' . ./test-lib.sh @@ -18,28 +18,28 @@ echo tree1path1 >path1 && echo tree1path3 >path3 && echo tree1path4 >path4 && echo tree1asubdir/path5 >asubdir/path5 && -git-update-index --add path0 path1 path3 path4 asubdir/path5 && -t1=$(git-write-tree) && +git update-index --add path0 path1 path3 path4 asubdir/path5 && +t1=$(git write-tree) && rm -f path* .merge_* out .git/index && echo tree2path0 >path0 && echo tree2path1 >path1 && echo tree2path2 >path2 && echo tree2path4 >path4 && -git-update-index --add path0 path1 path2 path4 && -t2=$(git-write-tree) && +git update-index --add path0 path1 path2 path4 && +t2=$(git write-tree) && rm -f path* .merge_* out .git/index && echo tree2path0 >path0 && echo tree3path1 >path1 && echo tree3path2 >path2 && echo tree3path3 >path3 && -git-update-index --add path0 path1 path2 path3 && -t3=$(git-write-tree)' +git update-index --add path0 path1 path2 path3 && +t3=$(git write-tree)' test_expect_success \ 'checkout one stage 0 to temporary file' ' rm -f path* .merge_* out .git/index && -git-read-tree $t1 && -git-checkout-index --temp -- path1 >out && +git read-tree $t1 && +git checkout-index --temp -- path1 >out && test $(wc -l out && +git read-tree $t1 && +git checkout-index -a --temp >out && test $(wc -l out && +git checkout-index --stage=2 --temp -- path1 >out && test $(wc -l out && +git checkout-index --all --stage=2 --temp >out && test $(wc -l out && +git checkout-index --stage=all --temp -- path0 >out && test $(wc -l out && +git checkout-index --stage=all --temp -- path1 >out && test $(wc -l out && +git checkout-index --stage=all --temp -- path2 >out && test $(wc -l out && +git checkout-index -a --stage=all --temp >out && test $(wc -l out && + git checkout-index -a --stage=all >out && test $(wc -l out && +git read-tree $t4 && +git checkout-index --temp -a >out && test $(wc -l path2/file2 date >path3/file3 test_expect_success \ - 'git-update-index --add to add various paths.' \ - 'git-update-index --add -- path0 path1 path2/file2 path3/file3' + 'git update-index --add to add various paths.' \ + 'git update-index --add -- path0 path1 path2/file2 path3/file3' rm -fr path? @@ -45,7 +45,7 @@ date >path1/file1 for p in path0/file0 path1/file1 path2 path3 do test_expect_failure \ - "git-update-index to add conflicting path $p should fail." \ - "git-update-index --add -- $p" + "git update-index to add conflicting path $p should fail." \ + "git update-index --add -- $p" done test_done diff --git a/t/t2101-update-index-reupdate.sh b/t/t2101-update-index-reupdate.sh index a78ea7f0b0..59b560bfdf 100755 --- a/t/t2101-update-index-reupdate.sh +++ b/t/t2101-update-index-reupdate.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Junio C Hamano # -test_description='git-update-index --again test. +test_description='git update-index --again test. ' . ./test-lib.sh @@ -15,29 +15,29 @@ EOF test_expect_success 'update-index --add' \ 'echo hello world >file1 && echo goodbye people >file2 && - git-update-index --add file1 file2 && - git-ls-files -s >current && + git update-index --add file1 file2 && + git ls-files -s >current && cmp current expected' test_expect_success 'update-index --again' \ 'rm -f file1 && echo hello everybody >file2 && - if git-update-index --again + if git update-index --again then echo should have refused to remove file1 exit 1 else echo happy - failed as expected fi && - git-ls-files -s >current && + git ls-files -s >current && cmp current expected' cat > expected <<\EOF 100644 0f1ae1422c2bf43f117d3dbd715c988a9ed2103f 0 file2 EOF test_expect_success 'update-index --remove --again' \ - 'git-update-index --remove --again && - git-ls-files -s >current && + 'git update-index --remove --again && + git ls-files -s >current && cmp current expected' test_expect_success 'first commit' 'git-commit -m initial' @@ -50,11 +50,11 @@ test_expect_success 'update-index again' \ 'mkdir -p dir1 && echo hello world >dir1/file3 && echo goodbye people >file2 && - git-update-index --add file2 dir1/file3 && + git update-index --add file2 dir1/file3 && echo hello everybody >file2 echo happy >dir1/file3 && - git-update-index --again && - git-ls-files -s >current && + git update-index --again && + git ls-files -s >current && cmp current expected' cat > expected <<\EOF @@ -65,9 +65,9 @@ test_expect_success 'update-index --update from subdir' \ 'echo not so happy >file2 && cd dir1 && cat ../file2 >file3 && - git-update-index --again && + git update-index --again && cd .. && - git-ls-files -s >current && + git ls-files -s >current && cmp current expected' cat > expected <<\EOF @@ -77,8 +77,8 @@ EOF test_expect_success 'update-index --update with pathspec' \ 'echo very happy >file2 && cat file2 >dir1/file3 && - git-update-index --again dir1/ && - git-ls-files -s >current && + git update-index --again dir1/ && + git ls-files -s >current && cmp current expected' test_done diff --git a/t/t2102-update-index-symlinks.sh b/t/t2102-update-index-symlinks.sh index 969ef891d3..19d0894d26 100755 --- a/t/t2102-update-index-symlinks.sh +++ b/t/t2102-update-index-symlinks.sh @@ -3,29 +3,29 @@ # Copyright (c) 2007 Johannes Sixt # -test_description='git-update-index on filesystem w/o symlinks test. +test_description='git update-index on filesystem w/o symlinks test. -This tests that git-update-index keeps the symbolic link property +This tests that git update-index keeps the symbolic link property even if a plain file is in the working tree if core.symlinks is false.' . ./test-lib.sh test_expect_success \ 'preparation' ' -git-config core.symlinks false && +git config core.symlinks false && l=$(echo -n file | git-hash-object -t blob -w --stdin) && -echo "120000 $l symlink" | git-update-index --index-info' +echo "120000 $l symlink" | git update-index --index-info' test_expect_success \ 'modify the symbolic link' ' echo -n new-file > symlink && -git-update-index symlink' +git update-index symlink' test_expect_success \ 'the index entry must still be a symbolic link' ' -case "`git-ls-files --stage --cached symlink`" in +case "`git ls-files --stage --cached symlink`" in 120000" "*symlink) echo ok;; -*) echo fail; git-ls-files --stage --cached symlink; (exit 1);; +*) echo fail; git ls-files --stage --cached symlink; (exit 1);; esac' test_done diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh index 83005e70d0..0a703af149 100755 --- a/t/t2200-add-update.sh +++ b/t/t2200-add-update.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-add -u with path limiting +test_description='git add -u with path limiting This test creates a working tree state with three files: @@ -8,7 +8,7 @@ This test creates a working tree state with three files: dir/sub (previously committed, modified) dir/other (untracked) -and issues a git-add -u with path limiting on "dir" to add +and issues a git add -u with path limiting on "dir" to add only the updates to dir/sub.' . ./test-lib.sh @@ -17,22 +17,22 @@ test_expect_success 'setup' ' echo initial >top && mkdir dir && echo initial >dir/sub && -git-add dir/sub top && +git add dir/sub top && git-commit -m initial && echo changed >top && echo changed >dir/sub && echo other >dir/other ' -test_expect_success 'update' 'git-add -u dir' +test_expect_success 'update' 'git add -u dir' test_expect_success 'update touched correct path' \ - 'test "`git-diff-files --name-status dir/sub`" = ""' + 'test "`git diff-files --name-status dir/sub`" = ""' test_expect_success 'update did not touch other tracked files' \ - 'test "`git-diff-files --name-status top`" = "M top"' + 'test "`git diff-files --name-status top`" = "M top"' test_expect_success 'update did not touch untracked files' \ - 'test "`git-diff-files --name-status dir/other`" = ""' + 'test "`git diff-files --name-status dir/other`" = ""' test_done diff --git a/t/t3000-ls-files-others.sh b/t/t3000-ls-files-others.sh index adcbe03d56..bc0a351392 100755 --- a/t/t3000-ls-files-others.sh +++ b/t/t3000-ls-files-others.sh @@ -3,9 +3,9 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-ls-files test (--others should pick up symlinks). +test_description='git ls-files test (--others should pick up symlinks). -This test runs git-ls-files --others with the following on the +This test runs git ls-files --others with the following on the filesystem. path0 - a file @@ -23,7 +23,7 @@ date >path2/file2 date >path2-junk date >path3/file3 date >path3-junk -git-update-index --add path3-junk path3/file3 +git update-index --add path3-junk path3/file3 cat >expected1 <expected2 test_expect_success \ - 'git-ls-files --others to show output.' \ - 'git-ls-files --others >output' + 'git ls-files --others to show output.' \ + 'git ls-files --others >output' test_expect_success \ - 'git-ls-files --others should pick up symlinks.' \ + 'git ls-files --others should pick up symlinks.' \ 'diff output expected1' test_expect_success \ - 'git-ls-files --others --directory to show output.' \ - 'git-ls-files --others --directory >output' + 'git ls-files --others --directory to show output.' \ + 'git ls-files --others --directory >output' test_expect_success \ - 'git-ls-files --others --directory should not get confused.' \ + 'git ls-files --others --directory should not get confused.' \ 'diff output expected2' test_done diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh index fcfcfbba7d..ae0639d8f3 100755 --- a/t/t3001-ls-files-others-exclude.sh +++ b/t/t3001-ls-files-others-exclude.sh @@ -3,9 +3,9 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-ls-files --others --exclude +test_description='git ls-files --others --exclude -This test runs git-ls-files --others and tests --exclude patterns. +This test runs git ls-files --others and tests --exclude patterns. ' . ./test-lib.sh @@ -59,8 +59,8 @@ echo '!*.2 !*.8' >one/two/.gitignore test_expect_success \ - 'git-ls-files --others with various exclude options.' \ - 'git-ls-files --others \ + 'git ls-files --others with various exclude options.' \ + 'git ls-files --others \ --exclude=\*.6 \ --exclude-per-directory=.gitignore \ --exclude-from=.git/ignore \ @@ -71,8 +71,8 @@ test_expect_success \ printf '*.1\r\n/*.3\r\n!*.6\r\n' >.gitignore test_expect_success \ - 'git-ls-files --others with \r\n line endings.' \ - 'git-ls-files --others \ + 'git ls-files --others with \r\n line endings.' \ + 'git ls-files --others \ --exclude=\*.6 \ --exclude-per-directory=.gitignore \ --exclude-from=.git/ignore \ @@ -84,9 +84,9 @@ cat > excludes-file << EOF e* EOF -git-config core.excludesFile excludes-file +git config core.excludesFile excludes-file -git-runstatus | grep "^# " > output +git runstatus | grep "^# " > output cat > expect << EOF # .gitignore diff --git a/t/t3002-ls-files-dashpath.sh b/t/t3002-ls-files-dashpath.sh index cc8967d76b..8687a01d2b 100755 --- a/t/t3002-ls-files-dashpath.sh +++ b/t/t3002-ls-files-dashpath.sh @@ -3,9 +3,9 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-ls-files test (-- to terminate the path list). +test_description='git ls-files test (-- to terminate the path list). -This test runs git-ls-files --others with the following on the +This test runs git ls-files --others with the following on the filesystem. path0 - a file @@ -21,8 +21,8 @@ test_expect_success \ echo frotz >./--' test_expect_success \ - 'git-ls-files without path restriction.' \ - 'git-ls-files --others >output && + 'git ls-files without path restriction.' \ + 'git ls-files --others >output && git diff output - <output && + 'git ls-files with path restriction.' \ + 'git ls-files --others path0 >output && git diff output - <output && + 'git ls-files with path restriction with --.' \ + 'git ls-files --others -- path0 >output && git diff output - <output && + 'git ls-files with path restriction with -- --.' \ + 'git ls-files --others -- -- >output && git diff output - <output && + 'git ls-files with no path restriction.' \ + 'git ls-files --others -- >output && git diff output - <path8 : >path9 date >path10 test_expect_success \ - 'git-update-index --add to add various paths.' \ - "git-update-index --add -- path0 path1 path?/file? path7 path8 path9 path10" + 'git update-index --add to add various paths.' \ + "git update-index --add -- path0 path1 path?/file? path7 path8 path9 path10" rm -fr path? ;# leave path10 alone date >path2 @@ -64,8 +64,8 @@ date >path7 touch path10 test_expect_success \ - 'git-ls-files -k to show killed files.' \ - 'git-ls-files -k >.output' + 'git ls-files -k to show killed files.' \ + 'git ls-files -k >.output' cat >.expected <.output' + 'git ls-files -m to show modified files.' \ + 'git ls-files -m >.output' cat >.expected <path2/baz/b && find path? \( -type f -o -type l \) -print | - xargs git-update-index --add && - tree=`git-write-tree` && + xargs git update-index --add && + tree=`git write-tree` && echo $tree' _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' @@ -40,7 +40,7 @@ test_output () { test_expect_success \ 'ls-tree plain' \ - 'git-ls-tree $tree >current && + 'git ls-tree $tree >current && cat >expected <<\EOF && 100644 blob X path0 120000 blob X path1 @@ -50,7 +50,7 @@ EOF test_expect_success \ 'ls-tree recursive' \ - 'git-ls-tree -r $tree >current && + 'git ls-tree -r $tree >current && cat >expected <<\EOF && 100644 blob X path0 120000 blob X path1 @@ -62,7 +62,7 @@ EOF test_expect_success \ 'ls-tree recursive with -t' \ - 'git-ls-tree -r -t $tree >current && + 'git ls-tree -r -t $tree >current && cat >expected <<\EOF && 100644 blob X path0 120000 blob X path1 @@ -76,7 +76,7 @@ EOF test_expect_success \ 'ls-tree recursive with -d' \ - 'git-ls-tree -r -d $tree >current && + 'git ls-tree -r -d $tree >current && cat >expected <<\EOF && 040000 tree X path2 040000 tree X path2/baz @@ -85,7 +85,7 @@ EOF test_expect_success \ 'ls-tree filtered with path' \ - 'git-ls-tree $tree path >current && + 'git ls-tree $tree path >current && cat >expected <<\EOF && EOF test_output' @@ -95,7 +95,7 @@ EOF # they are shown in canonical order. test_expect_success \ 'ls-tree filtered with path1 path0' \ - 'git-ls-tree $tree path1 path0 >current && + 'git ls-tree $tree path1 path0 >current && cat >expected <<\EOF && 100644 blob X path0 120000 blob X path1 @@ -104,7 +104,7 @@ EOF test_expect_success \ 'ls-tree filtered with path0/' \ - 'git-ls-tree $tree path0/ >current && + 'git ls-tree $tree path0/ >current && cat >expected <<\EOF && EOF test_output' @@ -113,7 +113,7 @@ EOF # with pathspec semantics it shows only path2 test_expect_success \ 'ls-tree filtered with path2' \ - 'git-ls-tree $tree path2 >current && + 'git ls-tree $tree path2 >current && cat >expected <<\EOF && 040000 tree X path2 EOF @@ -122,7 +122,7 @@ EOF # ... and path2/ shows the children. test_expect_success \ 'ls-tree filtered with path2/' \ - 'git-ls-tree $tree path2/ >current && + 'git ls-tree $tree path2/ >current && cat >expected <<\EOF && 040000 tree X path2/baz 120000 blob X path2/bazbo @@ -134,7 +134,7 @@ EOF # path2/baz test_expect_success \ 'ls-tree filtered with path2/baz' \ - 'git-ls-tree $tree path2/baz >current && + 'git ls-tree $tree path2/baz >current && cat >expected <<\EOF && 040000 tree X path2/baz EOF @@ -142,14 +142,14 @@ EOF test_expect_success \ 'ls-tree filtered with path2/bak' \ - 'git-ls-tree $tree path2/bak >current && + 'git ls-tree $tree path2/bak >current && cat >expected <<\EOF && EOF test_output' test_expect_success \ 'ls-tree -t filtered with path2/bak' \ - 'git-ls-tree -t $tree path2/bak >current && + 'git ls-tree -t $tree path2/bak >current && cat >expected <<\EOF && 040000 tree X path2 EOF diff --git a/t/t3101-ls-tree-dirname.sh b/t/t3101-ls-tree-dirname.sh index 087929a4bf..39fe2676dc 100755 --- a/t/t3101-ls-tree-dirname.sh +++ b/t/t3101-ls-tree-dirname.sh @@ -4,9 +4,9 @@ # Copyright (c) 2005 Robert Fitzsimons # -test_description='git-ls-tree directory and filenames handling. +test_description='git ls-tree directory and filenames handling. -This test runs git-ls-tree with the following in a tree. +This test runs git ls-tree with the following in a tree. 1.txt - a file 2.txt - a file @@ -35,8 +35,8 @@ test_expect_success \ echo 111 >path3/1.txt && echo 222 >path3/2.txt && find *.txt path* \( -type f -o -type l \) -print | - xargs git-update-index --add && - tree=`git-write-tree` && + xargs git update-index --add && + tree=`git write-tree` && echo $tree' _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' @@ -48,7 +48,7 @@ test_output () { test_expect_success \ 'ls-tree plain' \ - 'git-ls-tree $tree >current && + 'git ls-tree $tree >current && cat >expected <<\EOF && 100644 blob X 1.txt 100644 blob X 2.txt @@ -62,7 +62,7 @@ EOF # Recursive does not show tree nodes anymore... test_expect_success \ 'ls-tree recursive' \ - 'git-ls-tree -r $tree >current && + 'git ls-tree -r $tree >current && cat >expected <<\EOF && 100644 blob X 1.txt 100644 blob X 2.txt @@ -76,7 +76,7 @@ EOF test_expect_success \ 'ls-tree filter 1.txt' \ - 'git-ls-tree $tree 1.txt >current && + 'git ls-tree $tree 1.txt >current && cat >expected <<\EOF && 100644 blob X 1.txt EOF @@ -84,7 +84,7 @@ EOF test_expect_success \ 'ls-tree filter path1/b/c/1.txt' \ - 'git-ls-tree $tree path1/b/c/1.txt >current && + 'git ls-tree $tree path1/b/c/1.txt >current && cat >expected <<\EOF && 100644 blob X path1/b/c/1.txt EOF @@ -92,7 +92,7 @@ EOF test_expect_success \ 'ls-tree filter all 1.txt files' \ - 'git-ls-tree $tree 1.txt path0/a/b/c/1.txt path1/b/c/1.txt path2/1.txt path3/1.txt >current && + 'git ls-tree $tree 1.txt path0/a/b/c/1.txt path1/b/c/1.txt path2/1.txt path3/1.txt >current && cat >expected <<\EOF && 100644 blob X 1.txt 100644 blob X path0/a/b/c/1.txt @@ -107,7 +107,7 @@ EOF # it behaves as if path0/a/b/c, path1/b/c, path2 and path3 are specified. test_expect_success \ 'ls-tree filter directories' \ - 'git-ls-tree $tree path3 path2 path0/a/b/c path1/b/c path0/a >current && + 'git ls-tree $tree path3 path2 path0/a/b/c path1/b/c path0/a >current && cat >expected <<\EOF && 040000 tree X path0/a/b/c 040000 tree X path1/b/c @@ -120,7 +120,7 @@ EOF # having 1.txt and path3 test_expect_success \ 'ls-tree filter odd names' \ - 'git-ls-tree $tree 1.txt /1.txt //1.txt path3/1.txt /path3/1.txt //path3//1.txt path3 /path3/ path3// >current && + 'git ls-tree $tree 1.txt /1.txt //1.txt path3/1.txt /path3/1.txt //path3//1.txt path3 /path3/ path3// >current && cat >expected <<\EOF && 100644 blob X 1.txt 100644 blob X path3/1.txt @@ -130,7 +130,7 @@ EOF test_expect_success \ 'ls-tree filter missing files and extra slashes' \ - 'git-ls-tree $tree 1.txt/ abc.txt path3//23.txt path3/2.txt/// >current && + 'git ls-tree $tree 1.txt/ abc.txt path3//23.txt path3/2.txt/// >current && cat >expected <<\EOF && EOF test_output' diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index f1793d0b9a..c6f472ac04 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -13,22 +13,22 @@ handled. Specifically, that a bogus branch is not created. test_expect_success \ 'prepare a trivial repository' \ 'echo Hello > A && - git-update-index --add A && + git update-index --add A && git-commit -m "Initial commit." && - HEAD=$(git-rev-parse --verify HEAD)' + HEAD=$(git rev-parse --verify HEAD)' test_expect_failure \ 'git branch --help should not have created a bogus branch' \ - 'git-branch --help /dev/null 2>/dev/null || : + 'git branch --help /dev/null 2>/dev/null || : test -f .git/refs/heads/--help' test_expect_success \ 'git branch abc should create a branch' \ - 'git-branch abc && test -f .git/refs/heads/abc' + 'git branch abc && test -f .git/refs/heads/abc' test_expect_success \ 'git branch a/b/c should create a branch' \ - 'git-branch a/b/c && test -f .git/refs/heads/a/b/c' + 'git branch a/b/c && test -f .git/refs/heads/a/b/c' cat >expect < 1117150200 +0000 branch: Created from master @@ -36,149 +36,149 @@ EOF test_expect_success \ 'git branch -l d/e/f should create a branch and a log' \ 'GIT_COMMITTER_DATE="2005-05-26 23:30" \ - git-branch -l d/e/f && + git branch -l d/e/f && test -f .git/refs/heads/d/e/f && test -f .git/logs/refs/heads/d/e/f && diff expect .git/logs/refs/heads/d/e/f' test_expect_success \ 'git branch -d d/e/f should delete a branch and a log' \ - 'git-branch -d d/e/f && + 'git branch -d d/e/f && test ! -f .git/refs/heads/d/e/f && test ! -f .git/logs/refs/heads/d/e/f' test_expect_success \ 'git branch j/k should work after branch j has been deleted' \ - 'git-branch j && - git-branch -d j && - git-branch j/k' + 'git branch j && + git branch -d j && + git branch j/k' test_expect_success \ 'git branch l should work after branch l/m has been deleted' \ - 'git-branch l/m && - git-branch -d l/m && - git-branch l' + 'git branch l/m && + git branch -d l/m && + git branch l' test_expect_success \ 'git branch -m m m/m should work' \ - 'git-branch -l m && - git-branch -m m m/m && + 'git branch -l m && + git branch -m m m/m && test -f .git/logs/refs/heads/m/m' test_expect_success \ 'git branch -m n/n n should work' \ - 'git-branch -l n/n && - git-branch -m n/n n + 'git branch -l n/n && + git branch -m n/n n test -f .git/logs/refs/heads/n' test_expect_failure \ 'git branch -m o/o o should fail when o/p exists' \ - 'git-branch o/o && - git-branch o/p && - git-branch -m o/o o' + 'git branch o/o && + git branch o/p && + git branch -m o/o o' test_expect_failure \ 'git branch -m q r/q should fail when r exists' \ - 'git-branch q && - git-branch r && - git-branch -m q r/q' + 'git branch q && + git branch r && + git branch -m q r/q' mv .git/config .git/config-saved test_expect_success 'git branch -m q q2 without config should succeed' ' - git-branch -m q q2 && - git-branch -m q2 q + git branch -m q q2 && + git branch -m q2 q ' mv .git/config-saved .git/config -git-config branch.s/s.dummy Hello +git config branch.s/s.dummy Hello test_expect_success \ 'git branch -m s/s s should work when s/t is deleted' \ - 'git-branch -l s/s && + 'git branch -l s/s && test -f .git/logs/refs/heads/s/s && - git-branch -l s/t && + git branch -l s/t && test -f .git/logs/refs/heads/s/t && - git-branch -d s/t && - git-branch -m s/s s && + git branch -d s/t && + git branch -m s/s s && test -f .git/logs/refs/heads/s' test_expect_success 'config information was renamed, too' \ - "test $(git-config branch.s.dummy) = Hello && - ! git-config branch.s/s/dummy" + "test $(git config branch.s.dummy) = Hello && + ! git config branch.s/s/dummy" test_expect_failure \ - 'git-branch -m u v should fail when the reflog for u is a symlink' \ - 'git-branch -l u && + 'git branch -m u v should fail when the reflog for u is a symlink' \ + 'git branch -l u && mv .git/logs/refs/heads/u real-u && ln -s real-u .git/logs/refs/heads/u && - git-branch -m u v' + git branch -m u v' test_expect_success 'test tracking setup via --track' \ - 'git-config remote.local.url . && - git-config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git-show-ref -q refs/remotes/local/master || git-fetch local) && - git-branch --track my1 local/master && - test $(git-config branch.my1.remote) = local && - test $(git-config branch.my1.merge) = refs/heads/master' + 'git config remote.local.url . && + git config remote.local.fetch refs/heads/*:refs/remotes/local/* && + (git show-ref -q refs/remotes/local/master || git-fetch local) && + git branch --track my1 local/master && + test $(git config branch.my1.remote) = local && + test $(git config branch.my1.merge) = refs/heads/master' test_expect_success 'test tracking setup (non-wildcard, matching)' \ - 'git-config remote.local.url . && - git-config remote.local.fetch refs/heads/master:refs/remotes/local/master && - (git-show-ref -q refs/remotes/local/master || git-fetch local) && - git-branch --track my4 local/master && - test $(git-config branch.my4.remote) = local && - test $(git-config branch.my4.merge) = refs/heads/master' + 'git config remote.local.url . && + git config remote.local.fetch refs/heads/master:refs/remotes/local/master && + (git show-ref -q refs/remotes/local/master || git-fetch local) && + git branch --track my4 local/master && + test $(git config branch.my4.remote) = local && + test $(git config branch.my4.merge) = refs/heads/master' test_expect_success 'test tracking setup (non-wildcard, not matching)' \ - 'git-config remote.local.url . && - git-config remote.local.fetch refs/heads/s:refs/remotes/local/s && - (git-show-ref -q refs/remotes/local/master || git-fetch local) && - git-branch --track my5 local/master && - ! test "$(git-config branch.my5.remote)" = local && - ! test "$(git-config branch.my5.merge)" = refs/heads/master' + 'git config remote.local.url . && + git config remote.local.fetch refs/heads/s:refs/remotes/local/s && + (git show-ref -q refs/remotes/local/master || git-fetch local) && + git branch --track my5 local/master && + ! test "$(git config branch.my5.remote)" = local && + ! test "$(git config branch.my5.merge)" = refs/heads/master' test_expect_success 'test tracking setup via config' \ - 'git-config branch.autosetupmerge true && - git-config remote.local.url . && - git-config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git-show-ref -q refs/remotes/local/master || git-fetch local) && - git-branch my3 local/master && - test $(git-config branch.my3.remote) = local && - test $(git-config branch.my3.merge) = refs/heads/master' + 'git config branch.autosetupmerge true && + git config remote.local.url . && + git config remote.local.fetch refs/heads/*:refs/remotes/local/* && + (git show-ref -q refs/remotes/local/master || git-fetch local) && + git branch my3 local/master && + test $(git config branch.my3.remote) = local && + test $(git config branch.my3.merge) = refs/heads/master' test_expect_success 'test overriding tracking setup via --no-track' \ - 'git-config branch.autosetupmerge true && - git-config remote.local.url . && - git-config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git-show-ref -q refs/remotes/local/master || git-fetch local) && - git-branch --no-track my2 local/master && - git-config branch.autosetupmerge false && - ! test "$(git-config branch.my2.remote)" = local && - ! test "$(git-config branch.my2.merge)" = refs/heads/master' + 'git config branch.autosetupmerge true && + git config remote.local.url . && + git config remote.local.fetch refs/heads/*:refs/remotes/local/* && + (git show-ref -q refs/remotes/local/master || git-fetch local) && + git branch --no-track my2 local/master && + git config branch.autosetupmerge false && + ! test "$(git config branch.my2.remote)" = local && + ! test "$(git config branch.my2.merge)" = refs/heads/master' test_expect_success 'test local tracking setup' \ 'git branch --track my6 s && - test $(git-config branch.my6.remote) = . && - test $(git-config branch.my6.merge) = refs/heads/s' + test $(git config branch.my6.remote) = . && + test $(git config branch.my6.merge) = refs/heads/s' test_expect_success 'test tracking setup via --track but deeper' \ - 'git-config remote.local.url . && - git-config remote.local.fetch refs/heads/*:refs/remotes/local/* && - (git-show-ref -q refs/remotes/local/o/o || git-fetch local) && - git-branch --track my7 local/o/o && - test "$(git-config branch.my7.remote)" = local && - test "$(git-config branch.my7.merge)" = refs/heads/o/o' + 'git config remote.local.url . && + git config remote.local.fetch refs/heads/*:refs/remotes/local/* && + (git show-ref -q refs/remotes/local/o/o || git-fetch local) && + git branch --track my7 local/o/o && + test "$(git config branch.my7.remote)" = local && + test "$(git config branch.my7.merge)" = refs/heads/o/o' test_expect_success 'test deleting branch deletes branch config' \ - 'git-branch -d my7 && - test "$(git-config branch.my7.remote)" = "" && - test "$(git-config branch.my7.merge)" = ""' + 'git branch -d my7 && + test "$(git config branch.my7.remote)" = "" && + test "$(git config branch.my7.merge)" = ""' test_expect_success 'test deleting branch without config' \ - 'git-branch my7 s && - test "$(git-branch -d my7 2>&1)" = "Deleted branch my7."' + 'git branch my7 s && + test "$(git branch -d my7 2>&1)" = "Deleted branch my7."' # Keep this test last, as it changes the current branch cat >expect <>.git/config test_expect_success \ 'prepare a trivial repository' \ 'echo Hello > A && - git-update-index --add A && + git update-index --add A && git-commit -m "Initial commit." && - HEAD=$(git-rev-parse --verify HEAD)' + HEAD=$(git rev-parse --verify HEAD)' SHA1= test_expect_success \ 'see if git show-ref works as expected' \ - 'git-branch a && + 'git branch a && SHA1=`cat .git/refs/heads/a` && echo "$SHA1 refs/heads/a" >expect && - git-show-ref a >result && + git show-ref a >result && diff expect result' test_expect_success \ 'see if a branch still exists when packed' \ - 'git-branch b && - git-pack-refs --all && + 'git branch b && + git pack-refs --all && rm -f .git/refs/heads/b && echo "$SHA1 refs/heads/b" >expect && - git-show-ref b >result && + git show-ref b >result && diff expect result' test_expect_failure \ 'git branch c/d should barf if branch c exists' \ - 'git-branch c && - git-pack-refs --all && + 'git branch c && + git pack-refs --all && rm .git/refs/heads/c && - git-branch c/d' + git branch c/d' test_expect_success \ 'see if a branch still exists after git pack-refs --prune' \ - 'git-branch e && - git-pack-refs --all --prune && + 'git branch e && + git pack-refs --all --prune && echo "$SHA1 refs/heads/e" >expect && - git-show-ref e >result && + git show-ref e >result && diff expect result' test_expect_failure \ 'see if git pack-refs --prune remove ref files' \ - 'git-branch f && - git-pack-refs --all --prune && + 'git branch f && + git pack-refs --all --prune && ls .git/refs/heads/f' test_expect_success \ 'git branch g should work when git branch g/h has been deleted' \ - 'git-branch g/h && - git-pack-refs --all --prune && - git-branch -d g/h && - git-branch g && - git-pack-refs --all && - git-branch -d g' + 'git branch g/h && + git pack-refs --all --prune && + git branch -d g/h && + git branch g && + git pack-refs --all && + git branch -d g' test_expect_failure \ 'git branch i/j/k should barf if branch i exists' \ - 'git-branch i && - git-pack-refs --all --prune && - git-branch i/j/k' + 'git branch i && + git pack-refs --all --prune && + git branch i/j/k' test_expect_success \ 'test git branch k after branch k/l/m and k/lm have been deleted' \ - 'git-branch k/l && - git-branch k/lm && - git-branch -d k/l && - git-branch k/l/m && - git-branch -d k/l/m && - git-branch -d k/lm && - git-branch k' + 'git branch k/l && + git branch k/lm && + git branch -d k/l && + git branch k/l/m && + git branch -d k/l/m && + git branch -d k/lm && + git branch k' test_expect_success \ 'test git branch n after some branch deletion and pruning' \ - 'git-branch n/o && - git-branch n/op && - git-branch -d n/o && - git-branch n/o/p && - git-branch -d n/op && - git-pack-refs --all --prune && - git-branch -d n/o/p && - git-branch n' + 'git branch n/o && + git branch n/op && + git branch -d n/o && + git branch n/o/p && + git branch -d n/op && + git pack-refs --all --prune && + git branch -d n/o/p && + git branch n' test_expect_success 'pack, prune and repack' ' git-tag foo && - git-pack-refs --all --prune && - git-show-ref >all-of-them && - git-pack-refs && - git-show-ref >again && + git pack-refs --all --prune && + git show-ref >all-of-them && + git pack-refs && + git show-ref >again && diff all-of-them again ' diff --git a/t/t3300-funny-names.sh b/t/t3300-funny-names.sh index b5a1400e18..dc8c369310 100755 --- a/t/t3300-funny-names.sh +++ b/t/t3300-funny-names.sh @@ -32,12 +32,12 @@ test -f "$p1" && cmp "$p0" "$p1" || { echo 'just space no-funny' >expected -test_expect_success 'git-ls-files no-funny' \ - 'git-update-index --add "$p0" "$p2" && - git-ls-files >current && +test_expect_success 'git ls-files no-funny' \ + 'git update-index --add "$p0" "$p2" && + git ls-files >current && git diff expected current' -t0=`git-write-tree` +t0=`git write-tree` echo "$t0" >t0 cat > expected <<\EOF @@ -45,19 +45,19 @@ just space no-funny "tabs\t,\" (dq) and spaces" EOF -test_expect_success 'git-ls-files with-funny' \ - 'git-update-index --add "$p1" && - git-ls-files >current && +test_expect_success 'git ls-files with-funny' \ + 'git update-index --add "$p1" && + git ls-files >current && git diff expected current' echo 'just space no-funny tabs ," (dq) and spaces' >expected -test_expect_success 'git-ls-files -z with-funny' \ - 'git-ls-files -z | tr \\0 \\012 >current && +test_expect_success 'git ls-files -z with-funny' \ + 'git ls-files -z | tr \\0 \\012 >current && git diff expected current' -t1=`git-write-tree` +t1=`git write-tree` echo "$t1" >t1 cat > expected <<\EOF @@ -65,45 +65,45 @@ just space no-funny "tabs\t,\" (dq) and spaces" EOF -test_expect_success 'git-ls-tree with funny' \ - 'git-ls-tree -r $t1 | sed -e "s/^[^ ]* //" >current && +test_expect_success 'git ls-tree with funny' \ + 'git ls-tree -r $t1 | sed -e "s/^[^ ]* //" >current && git diff expected current' cat > expected <<\EOF A "tabs\t,\" (dq) and spaces" EOF -test_expect_success 'git-diff-index with-funny' \ - 'git-diff-index --name-status $t0 >current && +test_expect_success 'git diff-index with-funny' \ + 'git diff-index --name-status $t0 >current && git diff expected current' -test_expect_success 'git-diff-tree with-funny' \ - 'git-diff-tree --name-status $t0 $t1 >current && +test_expect_success 'git diff-tree with-funny' \ + 'git diff-tree --name-status $t0 $t1 >current && git diff expected current' echo 'A tabs ," (dq) and spaces' >expected -test_expect_success 'git-diff-index -z with-funny' \ - 'git-diff-index -z --name-status $t0 | tr \\0 \\012 >current && +test_expect_success 'git diff-index -z with-funny' \ + 'git diff-index -z --name-status $t0 | tr \\0 \\012 >current && git diff expected current' -test_expect_success 'git-diff-tree -z with-funny' \ - 'git-diff-tree -z --name-status $t0 $t1 | tr \\0 \\012 >current && +test_expect_success 'git diff-tree -z with-funny' \ + 'git diff-tree -z --name-status $t0 $t1 | tr \\0 \\012 >current && git diff expected current' cat > expected <<\EOF CNUM no-funny "tabs\t,\" (dq) and spaces" EOF -test_expect_success 'git-diff-tree -C with-funny' \ - 'git-diff-tree -C --find-copies-harder --name-status \ +test_expect_success 'git diff-tree -C with-funny' \ + 'git diff-tree -C --find-copies-harder --name-status \ $t0 $t1 | sed -e 's/^C[0-9]*/CNUM/' >current && git diff expected current' cat > expected <<\EOF RNUM no-funny "tabs\t,\" (dq) and spaces" EOF -test_expect_success 'git-diff-tree delete with-funny' \ - 'git-update-index --force-remove "$p0" && - git-diff-index -M --name-status \ +test_expect_success 'git diff-tree delete with-funny' \ + 'git update-index --force-remove "$p0" && + git diff-index -M --name-status \ $t0 | sed -e 's/^R[0-9]*/RNUM/' >current && git diff expected current' @@ -113,8 +113,8 @@ similarity index NUM% rename from no-funny rename to "tabs\t,\" (dq) and spaces" EOF -test_expect_success 'git-diff-tree delete with-funny' \ - 'git-diff-index -M -p $t0 | +test_expect_success 'git diff-tree delete with-funny' \ + 'git diff-index -M -p $t0 | sed -e "s/index [0-9]*%/index NUM%/" >current && git diff expected current' @@ -127,8 +127,8 @@ similarity index NUM% rename from no-funny rename to "tabs\t,\" (dq) and spaces" EOF -test_expect_success 'git-diff-tree delete with-funny' \ - 'git-diff-index -M -p $t0 | +test_expect_success 'git diff-tree delete with-funny' \ + 'git diff-index -M -p $t0 | sed -e "s/index [0-9]*%/index NUM%/" >current && git diff expected current' @@ -136,9 +136,9 @@ cat >expected <<\EOF "tabs\t,\" (dq) and spaces" 1 files changed, 0 insertions(+), 0 deletions(-) EOF -test_expect_success 'git-diff-tree rename with-funny applied' \ - 'git-diff-index -M -p $t0 | - git-apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current && +test_expect_success 'git diff-tree rename with-funny applied' \ + 'git diff-index -M -p $t0 | + git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current && git diff expected current' cat > expected <<\EOF @@ -146,15 +146,15 @@ cat > expected <<\EOF "tabs\t,\" (dq) and spaces" 2 files changed, 3 insertions(+), 3 deletions(-) EOF -test_expect_success 'git-diff-tree delete with-funny applied' \ - 'git-diff-index -p $t0 | - git-apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current && +test_expect_success 'git diff-tree delete with-funny applied' \ + 'git diff-index -p $t0 | + git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current && git diff expected current' -test_expect_success 'git-apply non-git diff' \ - 'git-diff-index -p $t0 | +test_expect_success 'git apply non-git diff' \ + 'git diff-index -p $t0 | sed -ne "/^[-+@]/p" | - git-apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current && + git apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current && git diff expected current' test_done diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index b9d3131cc2..95f3a2a556 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -14,15 +14,15 @@ export GIT_AUTHOR_EMAIL=bogus_email_address test_expect_success \ 'prepare repository with topic branch, then rebase against master' \ 'echo First > A && - git-update-index --add A && + git update-index --add A && git-commit -m "Add A." && git checkout -b my-topic-branch && echo Second > B && - git-update-index --add B && + git update-index --add B && git-commit -m "Add B." && git checkout -f master && echo Third >> A && - git-update-index A && + git update-index A && git-commit -m "Modify A." && git checkout -f my-topic-branch && git rebase master' diff --git a/t/t3401-rebase-partial.sh b/t/t3401-rebase-partial.sh index 8b19d3ccea..4934a4e010 100755 --- a/t/t3401-rebase-partial.sh +++ b/t/t3401-rebase-partial.sh @@ -14,37 +14,37 @@ local branch. test_expect_success \ 'prepare repository with topic branch' \ 'echo First > A && - git-update-index --add A && + git update-index --add A && git-commit -m "Add A." && git-checkout -b my-topic-branch && echo Second > B && - git-update-index --add B && + git update-index --add B && git-commit -m "Add B." && echo AnotherSecond > C && - git-update-index --add C && + git update-index --add C && git-commit -m "Add C." && git-checkout -f master && echo Third >> A && - git-update-index A && + git update-index A && git-commit -m "Modify A." ' test_expect_success \ 'pick top patch from topic branch into master' \ - 'git-cherry-pick my-topic-branch^0 && + 'git cherry-pick my-topic-branch^0 && git-checkout -f my-topic-branch && - git-branch master-merge master && - git-branch my-topic-branch-merge my-topic-branch + git branch master-merge master && + git branch my-topic-branch-merge my-topic-branch ' test_debug \ - 'git-cherry master && - git-format-patch -k --stdout --full-index master >/dev/null && + 'git cherry master && + git format-patch -k --stdout --full-index master >/dev/null && gitk --all & sleep 1 ' diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh index 9e11ed295d..eab053c3e0 100755 --- a/t/t3403-rebase-skip.sh +++ b/t/t3403-rebase-skip.sh @@ -49,7 +49,7 @@ test_expect_success 'rebase --skip with --merge' ' ' test_expect_success 'merge and reference trees equal' \ - 'test -z "`git-diff-tree skip-merge skip-reference`"' + 'test -z "`git diff-tree skip-merge skip-reference`"' test_debug 'gitk --all & sleep 1' diff --git a/t/t3500-cherry.sh b/t/t3500-cherry.sh index e83bbee074..d0a440feba 100755 --- a/t/t3500-cherry.sh +++ b/t/t3500-cherry.sh @@ -3,10 +3,10 @@ # Copyright (c) 2006 Yann Dirson, based on t3400 by Amos Waterland # -test_description='git-cherry should detect patches integrated upstream +test_description='git cherry should detect patches integrated upstream This test cherry-picks one local change of two into master branch, and -checks that git-cherry only returns the second patch in the local branch +checks that git cherry only returns the second patch in the local branch ' . ./test-lib.sh @@ -15,40 +15,40 @@ export GIT_AUTHOR_EMAIL=bogus_email_address test_expect_success \ 'prepare repository with topic branch, and check cherry finds the 2 patches from there' \ 'echo First > A && - git-update-index --add A && + git update-index --add A && git-commit -m "Add A." && git-checkout -b my-topic-branch && echo Second > B && - git-update-index --add B && + git update-index --add B && git-commit -m "Add B." && sleep 2 && echo AnotherSecond > C && - git-update-index --add C && + git update-index --add C && git-commit -m "Add C." && git-checkout -f master && rm -f B C && echo Third >> A && - git-update-index A && + git update-index A && git-commit -m "Modify A." && - expr "$(echo $(git-cherry master my-topic-branch) )" : "+ [^ ]* + .*" + expr "$(echo $(git cherry master my-topic-branch) )" : "+ [^ ]* + .*" ' test_expect_success \ 'check that cherry with limit returns only the top patch'\ - 'expr "$(echo $(git-cherry master my-topic-branch my-topic-branch^1) )" : "+ [^ ]*" + 'expr "$(echo $(git cherry master my-topic-branch my-topic-branch^1) )" : "+ [^ ]*" ' test_expect_success \ 'cherry-pick one of the 2 patches, and check cherry recognized one and only one as new' \ - 'git-cherry-pick my-topic-branch^0 && - echo $(git-cherry master my-topic-branch) && - expr "$(echo $(git-cherry master my-topic-branch) )" : "+ [^ ]* - .*" + 'git cherry-pick my-topic-branch^0 && + echo $(git cherry master my-topic-branch) && + expr "$(echo $(git cherry master my-topic-branch) )" : "+ [^ ]* - .*" ' test_done diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index 0a97b75288..13a461f31b 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Carl D. Worth # -test_description='Test of the various options to git-rm.' +test_description='Test of the various options to git rm.' . ./test-lib.sh @@ -11,13 +11,13 @@ test_description='Test of the various options to git-rm.' test_expect_success \ 'Initialize test directory' \ "touch -- foo bar baz 'space embedded' -q && - git-add -- foo bar baz 'space embedded' -q && + git add -- foo bar baz 'space embedded' -q && git-commit -m 'add normal files' && test_tabs=y && if touch -- 'tab embedded' 'newline embedded' then - git-add -- 'tab embedded' 'newline + git add -- 'tab embedded' 'newline embedded' && git-commit -m 'add files with tabs and newlines' else @@ -26,7 +26,7 @@ embedded' && fi" # Later we will try removing an unremovable path to make sure -# git-rm barfs, but if the test is run as root that cannot be +# git rm barfs, but if the test is run as root that cannot be # arranged. test_expect_success \ 'Determine rm behavior' \ @@ -38,51 +38,51 @@ test_expect_success \ rm -f test-file' test_expect_success \ - 'Pre-check that foo exists and is in index before git-rm foo' \ - '[ -f foo ] && git-ls-files --error-unmatch foo' + 'Pre-check that foo exists and is in index before git rm foo' \ + '[ -f foo ] && git ls-files --error-unmatch foo' test_expect_success \ - 'Test that git-rm foo succeeds' \ - 'git-rm --cached foo' + 'Test that git rm foo succeeds' \ + 'git rm --cached foo' test_expect_success \ - 'Post-check that foo exists but is not in index after git-rm foo' \ - '[ -f foo ] && ! git-ls-files --error-unmatch foo' + 'Post-check that foo exists but is not in index after git rm foo' \ + '[ -f foo ] && ! git ls-files --error-unmatch foo' test_expect_success \ - 'Pre-check that bar exists and is in index before "git-rm bar"' \ - '[ -f bar ] && git-ls-files --error-unmatch bar' + 'Pre-check that bar exists and is in index before "git rm bar"' \ + '[ -f bar ] && git ls-files --error-unmatch bar' test_expect_success \ - 'Test that "git-rm bar" succeeds' \ - 'git-rm bar' + 'Test that "git rm bar" succeeds' \ + 'git rm bar' test_expect_success \ - 'Post-check that bar does not exist and is not in index after "git-rm -f bar"' \ - '! [ -f bar ] && ! git-ls-files --error-unmatch bar' + 'Post-check that bar does not exist and is not in index after "git rm -f bar"' \ + '! [ -f bar ] && ! git ls-files --error-unmatch bar' test_expect_success \ - 'Test that "git-rm -- -q" succeeds (remove a file that looks like an option)' \ - 'git-rm -- -q' + 'Test that "git rm -- -q" succeeds (remove a file that looks like an option)' \ + 'git rm -- -q' test "$test_tabs" = y && test_expect_success \ - "Test that \"git-rm -f\" succeeds with embedded space, tab, or newline characters." \ - "git-rm -f 'space embedded' 'tab embedded' 'newline + "Test that \"git rm -f\" succeeds with embedded space, tab, or newline characters." \ + "git rm -f 'space embedded' 'tab embedded' 'newline embedded'" if test "$test_failed_remove" = y; then chmod a-w . test_expect_failure \ - 'Test that "git-rm -f" fails if its rm fails' \ - 'git-rm -f baz' + 'Test that "git rm -f" fails if its rm fails' \ + 'git rm -f baz' chmod 775 . else test_expect_success 'skipping removal failure (perhaps running as root?)' : fi test_expect_success \ - 'When the rm in "git-rm -f" fails, it should not remove the file from the index' \ - 'git-ls-files --error-unmatch baz' + 'When the rm in "git rm -f" fails, it should not remove the file from the index' \ + 'git ls-files --error-unmatch baz' test_expect_success 'Remove nonexistent file with --ignore-unmatch' ' git rm --ignore-unmatch nonexistent diff --git a/t/t3700-add.sh b/t/t3700-add.sh index e6466d74a0..b52fde8577 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -3,72 +3,72 @@ # Copyright (c) 2006 Carl D. Worth # -test_description='Test of git-add, including the -- option.' +test_description='Test of git add, including the -- option.' . ./test-lib.sh test_expect_success \ - 'Test of git-add' \ - 'touch foo && git-add foo' + 'Test of git add' \ + 'touch foo && git add foo' test_expect_success \ 'Post-check that foo is in the index' \ - 'git-ls-files foo | grep foo' + 'git ls-files foo | grep foo' test_expect_success \ - 'Test that "git-add -- -q" works' \ - 'touch -- -q && git-add -- -q' + 'Test that "git add -- -q" works' \ + 'touch -- -q && git add -- -q' test_expect_success \ - 'git-add: Test that executable bit is not used if core.filemode=0' \ + 'git add: Test that executable bit is not used if core.filemode=0' \ 'git config core.filemode 0 && echo foo >xfoo1 && chmod 755 xfoo1 && - git-add xfoo1 && - case "`git-ls-files --stage xfoo1`" in + git add xfoo1 && + case "`git ls-files --stage xfoo1`" in 100644" "*xfoo1) echo ok;; - *) echo fail; git-ls-files --stage xfoo1; (exit 1);; + *) echo fail; git ls-files --stage xfoo1; (exit 1);; esac' -test_expect_success 'git-add: filemode=0 should not get confused by symlink' ' +test_expect_success 'git add: filemode=0 should not get confused by symlink' ' rm -f xfoo1 && ln -s foo xfoo1 && - git-add xfoo1 && - case "`git-ls-files --stage xfoo1`" in + git add xfoo1 && + case "`git ls-files --stage xfoo1`" in 120000" "*xfoo1) echo ok;; - *) echo fail; git-ls-files --stage xfoo1; (exit 1);; + *) echo fail; git ls-files --stage xfoo1; (exit 1);; esac ' test_expect_success \ - 'git-update-index --add: Test that executable bit is not used...' \ + 'git update-index --add: Test that executable bit is not used...' \ 'git config core.filemode 0 && echo foo >xfoo2 && chmod 755 xfoo2 && - git-update-index --add xfoo2 && - case "`git-ls-files --stage xfoo2`" in + git update-index --add xfoo2 && + case "`git ls-files --stage xfoo2`" in 100644" "*xfoo2) echo ok;; - *) echo fail; git-ls-files --stage xfoo2; (exit 1);; + *) echo fail; git ls-files --stage xfoo2; (exit 1);; esac' -test_expect_success 'git-add: filemode=0 should not get confused by symlink' ' +test_expect_success 'git add: filemode=0 should not get confused by symlink' ' rm -f xfoo2 && ln -s foo xfoo2 && git update-index --add xfoo2 && - case "`git-ls-files --stage xfoo2`" in + case "`git ls-files --stage xfoo2`" in 120000" "*xfoo2) echo ok;; - *) echo fail; git-ls-files --stage xfoo2; (exit 1);; + *) echo fail; git ls-files --stage xfoo2; (exit 1);; esac ' test_expect_success \ - 'git-update-index --add: Test that executable bit is not used...' \ + 'git update-index --add: Test that executable bit is not used...' \ 'git config core.filemode 0 && ln -s xfoo2 xfoo3 && - git-update-index --add xfoo3 && - case "`git-ls-files --stage xfoo3`" in + git update-index --add xfoo3 && + case "`git ls-files --stage xfoo3`" in 120000" "*xfoo3) echo ok;; - *) echo fail; git-ls-files --stage xfoo3; (exit 1);; + *) echo fail; git ls-files --stage xfoo3; (exit 1);; esac' test_expect_success '.gitignore test setup' ' @@ -80,28 +80,28 @@ test_expect_success '.gitignore test setup' ' ' test_expect_success '.gitignore is honored' ' - git-add . && - ! git-ls-files | grep "\\.ig" + git add . && + ! git ls-files | grep "\\.ig" ' test_expect_success 'error out when attempting to add ignored ones without -f' ' - ! git-add a.?? && - ! git-ls-files | grep "\\.ig" + ! git add a.?? && + ! git ls-files | grep "\\.ig" ' test_expect_success 'error out when attempting to add ignored ones without -f' ' - ! git-add d.?? && - ! git-ls-files | grep "\\.ig" + ! git add d.?? && + ! git ls-files | grep "\\.ig" ' test_expect_success 'add ignored ones with -f' ' - git-add -f a.?? && - git-ls-files --error-unmatch a.ig + git add -f a.?? && + git ls-files --error-unmatch a.ig ' test_expect_success 'add ignored ones with -f' ' - git-add -f d.??/* && - git-ls-files --error-unmatch d.ig/d.if d.ig/d.ig + git add -f d.??/* && + git ls-files --error-unmatch d.ig/d.if d.ig/d.ig ' mkdir 1 1/2 1/3 diff --git a/t/t3800-mktag.sh b/t/t3800-mktag.sh index 7c7e4335d6..261f199a0c 100755 --- a/t/t3800-mktag.sh +++ b/t/t3800-mktag.sh @@ -22,9 +22,9 @@ check_verify_failure () { # first create a commit, so we have a valid object/type # for the tag. echo Hello >A -git-update-index --add A +git update-index --add A git-commit -m "Initial commit" -head=$(git-rev-parse --verify HEAD) +head=$(git rev-parse --verify HEAD) ############################################################ # 1. length check diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh index ffddb68db3..fcbabe8ec3 100755 --- a/t/t3900-i18n-commit.sh +++ b/t/t3900-i18n-commit.sh @@ -8,28 +8,28 @@ test_description='commit and log output encodings' . ./test-lib.sh compare_with () { - git-show -s $1 | sed -e '1,/^$/d' -e 's/^ //' -e '$d' >current && + git show -s $1 | sed -e '1,/^$/d' -e 's/^ //' -e '$d' >current && git diff current "$2" } test_expect_success setup ' : >F && - git-add F && - T=$(git-write-tree) && - C=$(git-commit-tree $T <../t3900/1-UTF-8.txt) && - git-update-ref HEAD $C && + git add F && + T=$(git write-tree) && + C=$(git commit-tree $T <../t3900/1-UTF-8.txt) && + git update-ref HEAD $C && git-tag C0 ' test_expect_success 'no encoding header for base case' ' - E=$(git-cat-file commit C0 | sed -ne "s/^encoding //p") && + E=$(git cat-file commit C0 | sed -ne "s/^encoding //p") && test z = "z$E" ' for H in ISO-8859-1 EUCJP ISO-2022-JP do test_expect_success "$H setup" ' - git-config i18n.commitencoding $H && + git config i18n.commitencoding $H && git-checkout -b $H C0 && echo $H >F && git-commit -a -F ../t3900/$H.txt @@ -39,21 +39,21 @@ done for H in ISO-8859-1 EUCJP ISO-2022-JP do test_expect_success "check encoding header for $H" ' - E=$(git-cat-file commit '$H' | sed -ne "s/^encoding //p") && + E=$(git cat-file commit '$H' | sed -ne "s/^encoding //p") && test "z$E" = "z'$H'" ' done test_expect_success 'config to remove customization' ' - git-config --unset-all i18n.commitencoding && - if Z=$(git-config --get-all i18n.commitencoding) + git config --unset-all i18n.commitencoding && + if Z=$(git config --get-all i18n.commitencoding) then echo Oops, should have failed. false else test z = "z$Z" fi && - git-config i18n.commitencoding utf-8 + git config i18n.commitencoding utf-8 ' test_expect_success 'ISO-8859-1 should be shown in UTF-8 now' ' @@ -68,8 +68,8 @@ do done test_expect_success 'config to add customization' ' - git-config --unset-all i18n.commitencoding && - if Z=$(git-config --get-all i18n.commitencoding) + git config --unset-all i18n.commitencoding && + if Z=$(git config --get-all i18n.commitencoding) then echo Oops, should have failed. false @@ -81,13 +81,13 @@ test_expect_success 'config to add customization' ' for H in ISO-8859-1 EUCJP ISO-2022-JP do test_expect_success "$H should be shown in itself now" ' - git-config i18n.commitencoding '$H' && + git config i18n.commitencoding '$H' && compare_with '$H' ../t3900/'$H'.txt ' done test_expect_success 'config to tweak customization' ' - git-config i18n.logoutputencoding utf-8 + git config i18n.logoutputencoding utf-8 ' test_expect_success 'ISO-8859-1 should be shown in UTF-8 now' ' @@ -103,7 +103,7 @@ done for J in EUCJP ISO-2022-JP do - git-config i18n.logoutputencoding $J + git config i18n.logoutputencoding $J for H in EUCJP ISO-2022-JP do test_expect_success "$H should be shown in $J now" ' diff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh index 24bf0ee018..28e9e372f3 100755 --- a/t/t3901-i18n-patch.sh +++ b/t/t3901-i18n-patch.sh @@ -14,7 +14,7 @@ check_encoding () { do git format-patch --encoding=UTF-8 --stdout HEAD~$i..HEAD~$j | grep "^From: =?UTF-8?q?=C3=81=C3=A9=C3=AD=20=C3=B3=C3=BA?=" && - git-cat-file commit HEAD~$j | + git cat-file commit HEAD~$j | case "$header" in 8859) grep "^encoding ISO-8859-1" ;; @@ -31,7 +31,7 @@ check_encoding () { } test_expect_success setup ' - git-config i18n.commitencoding UTF-8 && + git config i18n.commitencoding UTF-8 && # use UTF-8 in author and committer name to match the # i18n.commitencoding settings @@ -55,7 +55,7 @@ test_expect_success setup ' git commit -s -m "Second on side" && # the second one on the side branch is ISO-8859-1 - git-config i18n.commitencoding ISO-8859-1 && + git config i18n.commitencoding ISO-8859-1 && # use author and committer name in ISO-8859-1 to match it. . ../t3901-8859-1.txt && test_tick && @@ -64,11 +64,11 @@ test_expect_success setup ' git commit -s -m "Third on side" && # Back to default - git-config i18n.commitencoding UTF-8 + git config i18n.commitencoding UTF-8 ' test_expect_success 'format-patch output (ISO-8859-1)' ' - git-config i18n.logoutputencoding ISO-8859-1 && + git config i18n.logoutputencoding ISO-8859-1 && git format-patch --stdout master..HEAD^ >out-l1 && git format-patch --stdout HEAD^ >out-l2 && @@ -91,7 +91,7 @@ test_expect_success 'format-patch output (UTF-8)' ' test_expect_success 'rebase (U/U)' ' # We want the result of rebase in UTF-8 - git-config i18n.commitencoding UTF-8 && + git config i18n.commitencoding UTF-8 && # The test is about logoutputencoding not affecting the # final outcome -- it is used internally to generate the @@ -109,7 +109,7 @@ test_expect_success 'rebase (U/U)' ' ' test_expect_success 'rebase (U/L)' ' - git-config i18n.commitencoding UTF-8 && + git config i18n.commitencoding UTF-8 && git config i18n.logoutputencoding ISO-8859-1 && . ../t3901-utf8.txt && @@ -121,7 +121,7 @@ test_expect_success 'rebase (U/L)' ' test_expect_success 'rebase (L/L)' ' # In this test we want ISO-8859-1 encoded commits as the result - git-config i18n.commitencoding ISO-8859-1 && + git config i18n.commitencoding ISO-8859-1 && git config i18n.logoutputencoding ISO-8859-1 && . ../t3901-8859-1.txt && @@ -134,7 +134,7 @@ test_expect_success 'rebase (L/L)' ' test_expect_success 'rebase (L/U)' ' # This is pathological -- use UTF-8 as intermediate form # to get ISO-8859-1 results. - git-config i18n.commitencoding ISO-8859-1 && + git config i18n.commitencoding ISO-8859-1 && git config i18n.logoutputencoding UTF-8 && . ../t3901-8859-1.txt && @@ -147,7 +147,7 @@ test_expect_success 'rebase (L/U)' ' test_expect_success 'cherry-pick(U/U)' ' # Both the commitencoding and logoutputencoding is set to UTF-8. - git-config i18n.commitencoding UTF-8 && + git config i18n.commitencoding UTF-8 && git config i18n.logoutputencoding UTF-8 && . ../t3901-utf8.txt && @@ -162,7 +162,7 @@ test_expect_success 'cherry-pick(U/U)' ' test_expect_success 'cherry-pick(L/L)' ' # Both the commitencoding and logoutputencoding is set to ISO-8859-1 - git-config i18n.commitencoding ISO-8859-1 && + git config i18n.commitencoding ISO-8859-1 && git config i18n.logoutputencoding ISO-8859-1 && . ../t3901-8859-1.txt && @@ -177,7 +177,7 @@ test_expect_success 'cherry-pick(L/L)' ' test_expect_success 'cherry-pick(U/L)' ' # Commitencoding is set to UTF-8 but logoutputencoding is ISO-8859-1 - git-config i18n.commitencoding UTF-8 && + git config i18n.commitencoding UTF-8 && git config i18n.logoutputencoding ISO-8859-1 && . ../t3901-utf8.txt && @@ -193,7 +193,7 @@ test_expect_success 'cherry-pick(L/U)' ' # Again, the commitencoding is set to ISO-8859-1 but # logoutputencoding is set to UTF-8. - git-config i18n.commitencoding ISO-8859-1 && + git config i18n.commitencoding ISO-8859-1 && git config i18n.logoutputencoding UTF-8 && . ../t3901-8859-1.txt && @@ -206,7 +206,7 @@ test_expect_success 'cherry-pick(L/U)' ' ' test_expect_success 'rebase --merge (U/U)' ' - git-config i18n.commitencoding UTF-8 && + git config i18n.commitencoding UTF-8 && git config i18n.logoutputencoding UTF-8 && . ../t3901-utf8.txt && @@ -217,7 +217,7 @@ test_expect_success 'rebase --merge (U/U)' ' ' test_expect_success 'rebase --merge (U/L)' ' - git-config i18n.commitencoding UTF-8 && + git config i18n.commitencoding UTF-8 && git config i18n.logoutputencoding ISO-8859-1 && . ../t3901-utf8.txt && @@ -229,7 +229,7 @@ test_expect_success 'rebase --merge (U/L)' ' test_expect_success 'rebase --merge (L/L)' ' # In this test we want ISO-8859-1 encoded commits as the result - git-config i18n.commitencoding ISO-8859-1 && + git config i18n.commitencoding ISO-8859-1 && git config i18n.logoutputencoding ISO-8859-1 && . ../t3901-8859-1.txt && @@ -242,7 +242,7 @@ test_expect_success 'rebase --merge (L/L)' ' test_expect_success 'rebase --merge (L/U)' ' # This is pathological -- use UTF-8 as intermediate form # to get ISO-8859-1 results. - git-config i18n.commitencoding ISO-8859-1 && + git config i18n.commitencoding ISO-8859-1 && git config i18n.logoutputencoding UTF-8 && . ../t3901-8859-1.txt && diff --git a/t/t4000-diff-format.sh b/t/t4000-diff-format.sh index 9c58d77cc2..7d92ae3e99 100755 --- a/t/t4000-diff-format.sh +++ b/t/t4000-diff-format.sh @@ -17,15 +17,15 @@ chmod +x path1 test_expect_success \ 'update-cache --add two files with and without +x.' \ - 'git-update-index --add path0 path1' + 'git update-index --add path0 path1' mv path0 path0- sed -e 's/line/Line/' path0 chmod +x path0 rm -f path1 test_expect_success \ - 'git-diff-files -p after editing work tree.' \ - 'git-diff-files -p >current' + 'git diff-files -p after editing work tree.' \ + 'git diff-files -p >current' # that's as far as it comes if [ "$(git config --get core.filemode)" = false ] @@ -56,7 +56,7 @@ deleted file mode 100755 EOF test_expect_success \ - 'validate git-diff-files -p output.' \ + 'validate git diff-files -p output.' \ 'compare_diff_patch current expected' test_done diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh index 90c085f828..063e79257a 100755 --- a/t/t4001-diff-rename.sh +++ b/t/t4001-diff-rename.sh @@ -28,21 +28,21 @@ Line 15 test_expect_success \ 'update-cache --add a file.' \ - 'git-update-index --add path0' + 'git update-index --add path0' test_expect_success \ 'write that tree.' \ - 'tree=$(git-write-tree) && echo $tree' + 'tree=$(git write-tree) && echo $tree' sed -e 's/line/Line/' path1 rm -f path0 test_expect_success \ 'renamed and edited the file.' \ - 'git-update-index --add --remove path0 path1' + 'git update-index --add --remove path0 path1' test_expect_success \ - 'git-diff-index -p -M after rename and editing.' \ - 'git-diff-index -p -M $tree >current' + 'git diff-index -p -M after rename and editing.' \ + 'git diff-index -p -M $tree >current' cat >expected <<\EOF diff --git a/path0 b/path1 rename from path0 diff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh index 56eda63fc2..a4cfde6b29 100755 --- a/t/t4002-diff-basic.sh +++ b/t/t4002-diff-basic.sh @@ -140,80 +140,80 @@ cmp_diff_files_output () { test_expect_success \ 'diff-tree of known trees.' \ - 'git-diff-tree $tree_O $tree_A >.test-a && + 'git diff-tree $tree_O $tree_A >.test-a && cmp -s .test-a .test-plain-OA' test_expect_success \ 'diff-tree of known trees.' \ - 'git-diff-tree -r $tree_O $tree_A >.test-a && + 'git diff-tree -r $tree_O $tree_A >.test-a && cmp -s .test-a .test-recursive-OA' test_expect_success \ 'diff-tree of known trees.' \ - 'git-diff-tree $tree_O $tree_B >.test-a && + 'git diff-tree $tree_O $tree_B >.test-a && cmp -s .test-a .test-plain-OB' test_expect_success \ 'diff-tree of known trees.' \ - 'git-diff-tree -r $tree_O $tree_B >.test-a && + 'git diff-tree -r $tree_O $tree_B >.test-a && cmp -s .test-a .test-recursive-OB' test_expect_success \ 'diff-tree of known trees.' \ - 'git-diff-tree $tree_A $tree_B >.test-a && + 'git diff-tree $tree_A $tree_B >.test-a && cmp -s .test-a .test-plain-AB' test_expect_success \ 'diff-tree of known trees.' \ - 'git-diff-tree -r $tree_A $tree_B >.test-a && + 'git diff-tree -r $tree_A $tree_B >.test-a && cmp -s .test-a .test-recursive-AB' test_expect_success \ 'diff-cache O with A in cache' \ - 'git-read-tree $tree_A && - git-diff-index --cached $tree_O >.test-a && + 'git read-tree $tree_A && + git diff-index --cached $tree_O >.test-a && cmp -s .test-a .test-recursive-OA' test_expect_success \ 'diff-cache O with B in cache' \ - 'git-read-tree $tree_B && - git-diff-index --cached $tree_O >.test-a && + 'git read-tree $tree_B && + git diff-index --cached $tree_O >.test-a && cmp -s .test-a .test-recursive-OB' test_expect_success \ 'diff-cache A with B in cache' \ - 'git-read-tree $tree_B && - git-diff-index --cached $tree_A >.test-a && + 'git read-tree $tree_B && + git diff-index --cached $tree_A >.test-a && cmp -s .test-a .test-recursive-AB' test_expect_success \ 'diff-files with O in cache and A checked out' \ 'rm -fr Z [A-Z][A-Z] && - git-read-tree $tree_A && - git-checkout-index -f -a && - git-read-tree --reset $tree_O || return 1 - git-update-index --refresh >/dev/null ;# this can exit non-zero - git-diff-files >.test-a && + git read-tree $tree_A && + git checkout-index -f -a && + git read-tree --reset $tree_O || return 1 + git update-index --refresh >/dev/null ;# this can exit non-zero + git diff-files >.test-a && cmp_diff_files_output .test-a .test-recursive-OA' test_expect_success \ 'diff-files with O in cache and B checked out' \ 'rm -fr Z [A-Z][A-Z] && - git-read-tree $tree_B && - git-checkout-index -f -a && - git-read-tree --reset $tree_O || return 1 - git-update-index --refresh >/dev/null ;# this can exit non-zero - git-diff-files >.test-a && + git read-tree $tree_B && + git checkout-index -f -a && + git read-tree --reset $tree_O || return 1 + git update-index --refresh >/dev/null ;# this can exit non-zero + git diff-files >.test-a && cmp_diff_files_output .test-a .test-recursive-OB' test_expect_success \ 'diff-files with A in cache and B checked out' \ 'rm -fr Z [A-Z][A-Z] && - git-read-tree $tree_B && - git-checkout-index -f -a && - git-read-tree --reset $tree_A || return 1 - git-update-index --refresh >/dev/null ;# this can exit non-zero - git-diff-files >.test-a && + git read-tree $tree_B && + git checkout-index -f -a && + git read-tree --reset $tree_A || return 1 + git update-index --refresh >/dev/null ;# this can exit non-zero + git diff-files >.test-a && cmp_diff_files_output .test-a .test-recursive-AB' ################################################################ @@ -222,26 +222,26 @@ test_expect_success \ test_expect_success \ 'diff-tree O A == diff-tree -R A O' \ - 'git-diff-tree $tree_O $tree_A >.test-a && - git-diff-tree -R $tree_A $tree_O >.test-b && + 'git diff-tree $tree_O $tree_A >.test-a && + git diff-tree -R $tree_A $tree_O >.test-b && cmp -s .test-a .test-b' test_expect_success \ 'diff-tree -r O A == diff-tree -r -R A O' \ - 'git-diff-tree -r $tree_O $tree_A >.test-a && - git-diff-tree -r -R $tree_A $tree_O >.test-b && + 'git diff-tree -r $tree_O $tree_A >.test-a && + git diff-tree -r -R $tree_A $tree_O >.test-b && cmp -s .test-a .test-b' test_expect_success \ 'diff-tree B A == diff-tree -R A B' \ - 'git-diff-tree $tree_B $tree_A >.test-a && - git-diff-tree -R $tree_A $tree_B >.test-b && + 'git diff-tree $tree_B $tree_A >.test-a && + git diff-tree -R $tree_A $tree_B >.test-b && cmp -s .test-a .test-b' test_expect_success \ 'diff-tree -r B A == diff-tree -r -R A B' \ - 'git-diff-tree -r $tree_B $tree_A >.test-a && - git-diff-tree -r -R $tree_A $tree_B >.test-b && + 'git diff-tree -r $tree_B $tree_A >.test-a && + git diff-tree -r -R $tree_A $tree_B >.test-b && cmp -s .test-a .test-b' test_done diff --git a/t/t4003-diff-rename-1.sh b/t/t4003-diff-rename-1.sh index 27519704d4..8b1f875286 100755 --- a/t/t4003-diff-rename-1.sh +++ b/t/t4003-diff-rename-1.sh @@ -13,8 +13,8 @@ test_expect_success \ 'prepare reference tree' \ 'cat ../../COPYING >COPYING && echo frotz >rezrov && - git-update-index --add COPYING rezrov && - tree=$(git-write-tree) && + git update-index --add COPYING rezrov && + tree=$(git write-tree) && echo $tree' test_expect_success \ @@ -22,14 +22,14 @@ test_expect_success \ 'sed -e 's/HOWEVER/However/' COPYING.1 && sed -e 's/GPL/G.P.L/g' COPYING.2 && rm -f COPYING && - git-update-index --add --remove COPYING COPYING.?' + git update-index --add --remove COPYING COPYING.?' # tree has COPYING and rezrov. work tree has COPYING.1 and COPYING.2, # both are slightly edited, and unchanged rezrov. So we say you # copy-and-edit one, and rename-and-edit the other. We do not say # anything about rezrov. -GIT_DIFF_OPTS=--unified=0 git-diff-index -M -p $tree >current +GIT_DIFF_OPTS=--unified=0 git diff-index -M -p $tree >current cat >expected <<\EOF diff --git a/COPYING b/COPYING.1 copy from COPYING @@ -62,14 +62,14 @@ test_expect_success \ test_expect_success \ 'prepare work tree again' \ 'mv COPYING.2 COPYING && - git-update-index --add --remove COPYING COPYING.1 COPYING.2' + git update-index --add --remove COPYING COPYING.1 COPYING.2' # tree has COPYING and rezrov. work tree has COPYING and COPYING.1, # both are slightly edited, and unchanged rezrov. So we say you # edited one, and copy-and-edit the other. We do not say # anything about rezrov. -GIT_DIFF_OPTS=--unified=0 git-diff-index -C -p $tree >current +GIT_DIFF_OPTS=--unified=0 git diff-index -C -p $tree >current cat >expected <<\EOF diff --git a/COPYING b/COPYING --- a/COPYING @@ -100,16 +100,16 @@ test_expect_success \ test_expect_success \ 'prepare work tree once again' \ 'cat ../../COPYING >COPYING && - git-update-index --add --remove COPYING COPYING.1' + git update-index --add --remove COPYING COPYING.1' # tree has COPYING and rezrov. work tree has COPYING and COPYING.1, # but COPYING is not edited. We say you copy-and-edit COPYING.1; this # is only possible because -C mode now reports the unmodified file to # the diff-core. Unchanged rezrov, although being fed to -# git-diff-index as well, should not be mentioned. +# git diff-index as well, should not be mentioned. GIT_DIFF_OPTS=--unified=0 \ - git-diff-index -C --find-copies-harder -p $tree >current + git diff-index -C --find-copies-harder -p $tree >current cat >expected <<\EOF diff --git a/COPYING b/COPYING.1 copy from COPYING diff --git a/t/t4004-diff-rename-symlink.sh b/t/t4004-diff-rename-symlink.sh index a23aaa0a94..3d25be7a67 100755 --- a/t/t4004-diff-rename-symlink.sh +++ b/t/t4004-diff-rename-symlink.sh @@ -16,8 +16,8 @@ test_expect_success \ 'prepare reference tree' \ 'echo xyzzy | tr -d '\\\\'012 >yomin && ln -s xyzzy frotz && - git-update-index --add frotz yomin && - tree=$(git-write-tree) && + git update-index --add frotz yomin && + tree=$(git write-tree) && echo $tree' test_expect_success \ @@ -26,7 +26,7 @@ test_expect_success \ rm -f yomin && ln -s xyzzy nitfol && ln -s xzzzy bozbar && - git-update-index --add --remove frotz rezrov nitfol bozbar yomin' + git update-index --add --remove frotz rezrov nitfol bozbar yomin' # tree has frotz pointing at xyzzy, and yomin that contains xyzzy to # confuse things. work tree has rezrov (xyzzy) nitfol (xyzzy) and @@ -34,7 +34,7 @@ test_expect_success \ # rezrov and nitfol are rename/copy of frotz and bozbar should be # a new creation. -GIT_DIFF_OPTS=--unified=0 git-diff-index -M -p $tree >current +GIT_DIFF_OPTS=--unified=0 git diff-index -M -p $tree >current cat >expected <<\EOF diff --git a/bozbar b/bozbar new file mode 120000 diff --git a/t/t4005-diff-rename-2.sh b/t/t4005-diff-rename-2.sh index 684fd23a41..6630017312 100755 --- a/t/t4005-diff-rename-2.sh +++ b/t/t4005-diff-rename-2.sh @@ -13,8 +13,8 @@ test_expect_success \ 'prepare reference tree' \ 'cat ../../COPYING >COPYING && echo frotz >rezrov && - git-update-index --add COPYING rezrov && - tree=$(git-write-tree) && + git update-index --add COPYING rezrov && + tree=$(git write-tree) && echo $tree' test_expect_success \ @@ -22,14 +22,14 @@ test_expect_success \ 'sed -e 's/HOWEVER/However/' COPYING.1 && sed -e 's/GPL/G.P.L/g' COPYING.2 && rm -f COPYING && - git-update-index --add --remove COPYING COPYING.?' + git update-index --add --remove COPYING COPYING.?' # tree has COPYING and rezrov. work tree has COPYING.1 and COPYING.2, # both are slightly edited, and unchanged rezrov. We say COPYING.1 # and COPYING.2 are based on COPYING, and do not say anything about # rezrov. -git-diff-index -M $tree >current +git diff-index -M $tree >current cat >expected <<\EOF :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234 COPYING COPYING.1 @@ -45,14 +45,14 @@ test_expect_success \ test_expect_success \ 'prepare work tree again' \ 'mv COPYING.2 COPYING && - git-update-index --add --remove COPYING COPYING.1 COPYING.2' + git update-index --add --remove COPYING COPYING.1 COPYING.2' # tree has COPYING and rezrov. work tree has COPYING and COPYING.1, # both are slightly edited, and unchanged rezrov. We say COPYING.1 # is based on COPYING and COPYING is still there, and do not say anything # about rezrov. -git-diff-index -C $tree >current +git diff-index -C $tree >current cat >expected <<\EOF :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 06c67961bbaed34a127f76d261f4c0bf73eda471 M COPYING :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234 COPYING COPYING.1 @@ -72,9 +72,9 @@ test_expect_success \ test_expect_success \ 'prepare work tree once again' \ 'cat ../../COPYING >COPYING && - git-update-index --add --remove COPYING COPYING.1' + git update-index --add --remove COPYING COPYING.1' -git-diff-index -C --find-copies-harder $tree >current +git diff-index -C --find-copies-harder $tree >current cat >expected <<\EOF :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234 COPYING COPYING.1 EOF diff --git a/t/t4006-diff-mode.sh b/t/t4006-diff-mode.sh index b8acca1813..ab5406dd9f 100755 --- a/t/t4006-diff-mode.sh +++ b/t/t4006-diff-mode.sh @@ -11,24 +11,24 @@ test_description='Test mode change diffs. test_expect_success \ 'setup' \ 'echo frotz >rezrov && - git-update-index --add rezrov && - tree=`git-write-tree` && + git update-index --add rezrov && + tree=`git write-tree` && echo $tree' if [ "$(git config --get core.filemode)" = false ] then say 'filemode disabled on the filesystem, using update-index --chmod=+x' test_expect_success \ - 'git-update-index --chmod=+x' \ - 'git-update-index rezrov && - git-update-index --chmod=+x rezrov && - git-diff-index $tree >current' + 'git update-index --chmod=+x' \ + 'git update-index rezrov && + git update-index --chmod=+x rezrov && + git diff-index $tree >current' else test_expect_success \ 'chmod' \ 'chmod +x rezrov && - git-update-index rezrov && - git-diff-index $tree >current' + git update-index rezrov && + git diff-index $tree >current' fi _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]' diff --git a/t/t4007-rename-3.sh b/t/t4007-rename-3.sh index bb6ba69258..104a4e1492 100755 --- a/t/t4007-rename-3.sh +++ b/t/t4007-rename-3.sh @@ -13,20 +13,20 @@ test_expect_success \ 'prepare reference tree' \ 'mkdir path0 path1 && cp ../../COPYING path0/COPYING && - git-update-index --add path0/COPYING && - tree=$(git-write-tree) && + git update-index --add path0/COPYING && + tree=$(git write-tree) && echo $tree' test_expect_success \ 'prepare work tree' \ 'cp path0/COPYING path1/COPYING && - git-update-index --add --remove path0/COPYING path1/COPYING' + git update-index --add --remove path0/COPYING path1/COPYING' # In the tree, there is only path0/COPYING. In the cache, path0 and # path1 both have COPYING and the latter is a copy of path0/COPYING. # Comparing the full tree with cache should tell us so. -git-diff-index -C --find-copies-harder $tree >current +git diff-index -C --find-copies-harder $tree >current cat >expected <<\EOF :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 C100 path0/COPYING path1/COPYING @@ -42,7 +42,7 @@ test_expect_success \ # path1/COPYING suddenly appearing from nowhere, not detected as # a copy from path0/COPYING. -git-diff-index -C $tree path1 >current +git diff-index -C $tree path1 >current cat >expected <<\EOF :000000 100644 0000000000000000000000000000000000000000 6ff87c4664981e4397625791c8ea3bbb5f2279a3 A path1/COPYING @@ -55,14 +55,14 @@ test_expect_success \ test_expect_success \ 'tweak work tree' \ 'rm -f path0/COPYING && - git-update-index --remove path0/COPYING' + git update-index --remove path0/COPYING' # In the tree, there is only path0/COPYING. In the cache, path0 does # not have COPYING anymore and path1 has COPYING which is a copy of # path0/COPYING. Showing the full tree with cache should tell us about # the rename. -git-diff-index -C $tree >current +git diff-index -C $tree >current cat >expected <<\EOF :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 R100 path0/COPYING path1/COPYING @@ -77,7 +77,7 @@ test_expect_success \ # path0/COPYING. When we say we care only about path1, we should just # see path1/COPYING appearing from nowhere. -git-diff-index -C $tree path1 >current +git diff-index -C $tree path1 >current cat >expected <<\EOF :000000 100644 0000000000000000000000000000000000000000 6ff87c4664981e4397625791c8ea3bbb5f2279a3 A path1/COPYING diff --git a/t/t4008-diff-break-rewrite.sh b/t/t4008-diff-break-rewrite.sh index 263ac1ebf7..5836e3a899 100755 --- a/t/t4008-diff-break-rewrite.sh +++ b/t/t4008-diff-break-rewrite.sh @@ -28,19 +28,19 @@ test_expect_success \ setup \ 'cat ../../README >file0 && cat ../../COPYING >file1 && - git-update-index --add file0 file1 && - tree=$(git-write-tree) && + git update-index --add file0 file1 && + tree=$(git write-tree) && echo "$tree"' test_expect_success \ 'change file1 with copy-edit of file0 and remove file0' \ 'sed -e "s/git/GIT/" file0 >file1 && rm -f file0 && - git-update-index --remove file0 file1' + git update-index --remove file0 file1' test_expect_success \ 'run diff with -B' \ - 'git-diff-index -B --cached "$tree" >current' + 'git diff-index -B --cached "$tree" >current' cat >expected <<\EOF :100644 000000 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 0000000000000000000000000000000000000000 D file0 @@ -53,7 +53,7 @@ test_expect_success \ test_expect_success \ 'run diff with -B and -M' \ - 'git-diff-index -B -M "$tree" >current' + 'git diff-index -B -M "$tree" >current' cat >expected <<\EOF :100644 100644 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 08bb2fb671deff4c03a4d4a0a1315dff98d5732c R100 file0 file1 @@ -66,16 +66,16 @@ test_expect_success \ test_expect_success \ 'swap file0 and file1' \ 'rm -f file0 file1 && - git-read-tree -m $tree && - git-checkout-index -f -u -a && + git read-tree -m $tree && + git checkout-index -f -u -a && mv file0 tmp && mv file1 file0 && mv tmp file1 && - git-update-index file0 file1' + git update-index file0 file1' test_expect_success \ 'run diff with -B' \ - 'git-diff-index -B "$tree" >current' + 'git diff-index -B "$tree" >current' cat >expected <<\EOF :100644 100644 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 6ff87c4664981e4397625791c8ea3bbb5f2279a3 M100 file0 @@ -88,7 +88,7 @@ test_expect_success \ test_expect_success \ 'run diff with -B and -M' \ - 'git-diff-index -B -M "$tree" >current' + 'git diff-index -B -M "$tree" >current' cat >expected <<\EOF :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 6ff87c4664981e4397625791c8ea3bbb5f2279a3 R100 file1 file0 @@ -103,11 +103,11 @@ test_expect_success \ 'make file0 into something completely different' \ 'rm -f file0 && ln -s frotz file0 && - git-update-index file0 file1' + git update-index file0 file1' test_expect_success \ 'run diff with -B' \ - 'git-diff-index -B "$tree" >current' + 'git diff-index -B "$tree" >current' cat >expected <<\EOF :100644 120000 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 67be421f88824578857624f7b3dc75e99a8a1481 T file0 @@ -120,7 +120,7 @@ test_expect_success \ test_expect_success \ 'run diff with -B' \ - 'git-diff-index -B -M "$tree" >current' + 'git diff-index -B -M "$tree" >current' # This should not mistake file0 as the copy source of new file1 # due to type differences. @@ -135,7 +135,7 @@ test_expect_success \ test_expect_success \ 'run diff with -M' \ - 'git-diff-index -M "$tree" >current' + 'git diff-index -M "$tree" >current' # This should not mistake file0 as the copy source of new file1 # due to type differences. @@ -151,16 +151,16 @@ test_expect_success \ test_expect_success \ 'file1 edited to look like file0 and file0 rename-edited to file2' \ 'rm -f file0 file1 && - git-read-tree -m $tree && - git-checkout-index -f -u -a && + git read-tree -m $tree && + git checkout-index -f -u -a && sed -e "s/git/GIT/" file0 >file1 && sed -e "s/git/GET/" file0 >file2 && rm -f file0 - git-update-index --add --remove file0 file1 file2' + git update-index --add --remove file0 file1 file2' test_expect_success \ 'run diff with -B' \ - 'git-diff-index -B "$tree" >current' + 'git diff-index -B "$tree" >current' cat >expected <<\EOF :100644 000000 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 0000000000000000000000000000000000000000 D file0 @@ -174,7 +174,7 @@ test_expect_success \ test_expect_success \ 'run diff with -B -M' \ - 'git-diff-index -B -M "$tree" >current' + 'git diff-index -B -M "$tree" >current' cat >expected <<\EOF :100644 100644 f5deac7be59e7eeab8657fd9ae706fd6a57daed2 08bb2fb671deff4c03a4d4a0a1315dff98d5732c C095 file0 file1 diff --git a/t/t4009-diff-rename-4.sh b/t/t4009-diff-rename-4.sh index 2f2f8b1216..d2b45e7b8f 100755 --- a/t/t4009-diff-rename-4.sh +++ b/t/t4009-diff-rename-4.sh @@ -13,8 +13,8 @@ test_expect_success \ 'prepare reference tree' \ 'cat ../../COPYING >COPYING && echo frotz >rezrov && - git-update-index --add COPYING rezrov && - tree=$(git-write-tree) && + git update-index --add COPYING rezrov && + tree=$(git write-tree) && echo $tree' test_expect_success \ @@ -22,14 +22,14 @@ test_expect_success \ 'sed -e 's/HOWEVER/However/' COPYING.1 && sed -e 's/GPL/G.P.L/g' COPYING.2 && rm -f COPYING && - git-update-index --add --remove COPYING COPYING.?' + git update-index --add --remove COPYING COPYING.?' # tree has COPYING and rezrov. work tree has COPYING.1 and COPYING.2, # both are slightly edited, and unchanged rezrov. We say COPYING.1 # and COPYING.2 are based on COPYING, and do not say anything about # rezrov. -git-diff-index -z -M $tree >current +git diff-index -z -M $tree >current cat >expected <<\EOF :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234 @@ -49,14 +49,14 @@ test_expect_success \ test_expect_success \ 'prepare work tree again' \ 'mv COPYING.2 COPYING && - git-update-index --add --remove COPYING COPYING.1 COPYING.2' + git update-index --add --remove COPYING COPYING.1 COPYING.2' # tree has COPYING and rezrov. work tree has COPYING and COPYING.1, # both are slightly edited, and unchanged rezrov. We say COPYING.1 # is based on COPYING and COPYING is still there, and do not say anything # about rezrov. -git-diff-index -z -C $tree >current +git diff-index -z -C $tree >current cat >expected <<\EOF :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 06c67961bbaed34a127f76d261f4c0bf73eda471 M COPYING @@ -79,9 +79,9 @@ test_expect_success \ test_expect_success \ 'prepare work tree once again' \ 'cat ../../COPYING >COPYING && - git-update-index --add --remove COPYING COPYING.1' + git update-index --add --remove COPYING COPYING.1' -git-diff-index -z -C --find-copies-harder $tree >current +git diff-index -z -C --find-copies-harder $tree >current cat >expected <<\EOF :100644 100644 6ff87c4664981e4397625791c8ea3bbb5f2279a3 0603b3238a076dc6c8022aedc6648fa523a17178 C1234 COPYING diff --git a/t/t4010-diff-pathspec.sh b/t/t4010-diff-pathspec.sh index 9e1544df9d..ad3d9e4845 100755 --- a/t/t4010-diff-pathspec.sh +++ b/t/t4010-diff-pathspec.sh @@ -17,18 +17,18 @@ test_expect_success \ 'echo frotz >file0 && mkdir path1 && echo rezrov >path1/file1 && - git-update-index --add file0 path1/file1 && - tree=`git-write-tree` && + git update-index --add file0 path1/file1 && + tree=`git write-tree` && echo "$tree" && echo nitfol >file0 && echo yomin >path1/file1 && - git-update-index file0 path1/file1' + git update-index file0 path1/file1' cat >expected <<\EOF EOF test_expect_success \ 'limit to path should show nothing' \ - 'git-diff-index --cached $tree -- path >current && + 'git diff-index --cached $tree -- path >current && compare_diff_raw current expected' cat >expected <<\EOF @@ -36,7 +36,7 @@ cat >expected <<\EOF EOF test_expect_success \ 'limit to path1 should show path1/file1' \ - 'git-diff-index --cached $tree -- path1 >current && + 'git diff-index --cached $tree -- path1 >current && compare_diff_raw current expected' cat >expected <<\EOF @@ -44,7 +44,7 @@ cat >expected <<\EOF EOF test_expect_success \ 'limit to path1/ should show path1/file1' \ - 'git-diff-index --cached $tree -- path1/ >current && + 'git diff-index --cached $tree -- path1/ >current && compare_diff_raw current expected' cat >expected <<\EOF @@ -52,14 +52,14 @@ cat >expected <<\EOF EOF test_expect_success \ 'limit to file0 should show file0' \ - 'git-diff-index --cached $tree -- file0 >current && + 'git diff-index --cached $tree -- file0 >current && compare_diff_raw current expected' cat >expected <<\EOF EOF test_expect_success \ 'limit to file0/ should emit nothing.' \ - 'git-diff-index --cached $tree -- file0/ >current && + 'git diff-index --cached $tree -- file0/ >current && compare_diff_raw current expected' test_done diff --git a/t/t4011-diff-symlink.sh b/t/t4011-diff-symlink.sh index 379a831f0b..c6d13693ba 100755 --- a/t/t4011-diff-symlink.sh +++ b/t/t4011-diff-symlink.sh @@ -23,17 +23,17 @@ EOF test_expect_success \ 'diff new symlink' \ 'ln -s xyzzy frotz && - git-update-index && - tree=$(git-write-tree) && - git-update-index --add frotz && - GIT_DIFF_OPTS=--unified=0 git-diff-index -M -p $tree > current && + git update-index && + tree=$(git write-tree) && + git update-index --add frotz && + GIT_DIFF_OPTS=--unified=0 git diff-index -M -p $tree > current && compare_diff_patch current expected' test_expect_success \ 'diff unchanged symlink' \ - 'tree=$(git-write-tree) && - git-update-index frotz && - test -z "$(git-diff-index --name-only $tree)"' + 'tree=$(git write-tree) && + git update-index frotz && + test -z "$(git diff-index --name-only $tree)"' cat > expected << EOF diff --git a/frotz b/frotz @@ -49,7 +49,7 @@ EOF test_expect_success \ 'diff removed symlink' \ 'rm frotz && - git-diff-index -M -p $tree > current && + git diff-index -M -p $tree > current && compare_diff_patch current expected' cat > expected << EOF @@ -60,7 +60,7 @@ test_expect_success \ 'diff identical, but newly created symlink' \ 'sleep 3 && ln -s xyzzy frotz && - git-diff-index -M -p $tree > current && + git diff-index -M -p $tree > current && compare_diff_patch current expected' cat > expected << EOF @@ -79,7 +79,7 @@ test_expect_success \ 'diff different symlink' \ 'rm frotz && ln -s yxyyz frotz && - git-diff-index -M -p $tree > current && + git diff-index -M -p $tree > current && compare_diff_patch current expected' test_done diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binary.sh index 323606c65c..eced1f30fb 100755 --- a/t/t4012-diff-binary.sh +++ b/t/t4012-diff-binary.sh @@ -10,7 +10,7 @@ test_description='Binary diff and apply test_expect_success 'prepare repository' \ 'echo AIT >a && echo BIT >b && echo CIT >c && echo DIT >d && - git-update-index --add a b c d && + git update-index --add a b c d && echo git >a && cat ../test4012.png >b && echo git >c && @@ -24,18 +24,18 @@ cat > expected <<\EOF 4 files changed, 2 insertions(+), 2 deletions(-) EOF test_expect_success 'diff without --binary' \ - 'git-diff | git-apply --stat --summary >current && + 'git diff | git apply --stat --summary >current && cmp current expected' test_expect_success 'diff with --binary' \ - 'git-diff --binary | git-apply --stat --summary >current && + 'git diff --binary | git apply --stat --summary >current && cmp current expected' # apply needs to be able to skip the binary material correctly # in order to report the line number of a corrupt patch. test_expect_success 'apply detecting corrupt patch correctly' \ - 'git-diff | sed -e 's/-CIT/xCIT/' >broken && - if git-apply --stat --summary broken 2>detected + 'git diff | sed -e 's/-CIT/xCIT/' >broken && + if git apply --stat --summary broken 2>detected then echo unhappy - should have detected an error (exit 1) @@ -48,8 +48,8 @@ test_expect_success 'apply detecting corrupt patch correctly' \ test "$detected" = xCIT' test_expect_success 'apply detecting corrupt patch correctly' \ - 'git-diff --binary | sed -e 's/-CIT/xCIT/' >broken && - if git-apply --stat --summary broken 2>detected + 'git diff --binary | sed -e 's/-CIT/xCIT/' >broken && + if git apply --stat --summary broken 2>detected then echo unhappy - should have detected an error (exit 1) @@ -66,15 +66,15 @@ test_expect_success 'initial commit' 'git-commit -a -m initial' # Try removal (b), modification (d), and creation (e). test_expect_success 'diff-index with --binary' \ 'echo AIT >a && mv b e && echo CIT >c && cat e >d && - git-update-index --add --remove a b c d e && - tree0=`git-write-tree` && - git-diff --cached --binary >current && - git-apply --stat --summary current' + git update-index --add --remove a b c d e && + tree0=`git write-tree` && + git diff --cached --binary >current && + git apply --stat --summary current' test_expect_success 'apply binary patch' \ 'git-reset --hard && - git-apply --binary --index x do @@ -42,13 +42,13 @@ index adf3937..6edc172 100644 +while (0); EOF -git-diff > out +git diff > out test_expect_success "Ray's example without options" 'git diff expect out' -git-diff -w > out +git diff -w > out test_expect_success "Ray's example with -w" 'git diff expect out' -git-diff -b > out +git diff -b > out test_expect_success "Ray's example with -b" 'git diff expect out' tr 'Q' '\015' << EOF > x @@ -60,7 +60,7 @@ unchanged line CR at endQ EOF -git-update-index x +git update-index x cat << EOF > x whitespace at beginning @@ -89,14 +89,14 @@ index d99af23..8b32fb5 100644 -CR at endQ +CR at end EOF -git-diff > out +git diff > out test_expect_success 'another test, without options' 'git diff expect out' cat << EOF > expect diff --git a/x b/x index d99af23..8b32fb5 100644 EOF -git-diff -w > out +git diff -w > out test_expect_success 'another test, with -w' 'git diff expect out' tr 'Q' '\015' << EOF > expect @@ -114,7 +114,7 @@ index d99af23..8b32fb5 100644 unchanged line CR at endQ EOF -git-diff -b > out +git diff -b > out test_expect_success 'another test, with -b' 'git diff expect out' test_done diff --git a/t/t4100-apply-stat.sh b/t/t4100-apply-stat.sh index c23341feb5..435f65b370 100755 --- a/t/t4100-apply-stat.sh +++ b/t/t4100-apply-stat.sh @@ -3,44 +3,44 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-apply --stat --summary test. +test_description='git apply --stat --summary test. ' . ./test-lib.sh test_expect_success \ 'rename' \ - 'git-apply --stat --summary <../t4100/t-apply-1.patch >current && + 'git apply --stat --summary <../t4100/t-apply-1.patch >current && git diff ../t4100/t-apply-1.expect current' test_expect_success \ 'copy' \ - 'git-apply --stat --summary <../t4100/t-apply-2.patch >current && + 'git apply --stat --summary <../t4100/t-apply-2.patch >current && git diff ../t4100/t-apply-2.expect current' test_expect_success \ 'rewrite' \ - 'git-apply --stat --summary <../t4100/t-apply-3.patch >current && + 'git apply --stat --summary <../t4100/t-apply-3.patch >current && git diff ../t4100/t-apply-3.expect current' test_expect_success \ 'mode' \ - 'git-apply --stat --summary <../t4100/t-apply-4.patch >current && + 'git apply --stat --summary <../t4100/t-apply-4.patch >current && git diff ../t4100/t-apply-4.expect current' test_expect_success \ 'non git' \ - 'git-apply --stat --summary <../t4100/t-apply-5.patch >current && + 'git apply --stat --summary <../t4100/t-apply-5.patch >current && git diff ../t4100/t-apply-5.expect current' test_expect_success \ 'non git' \ - 'git-apply --stat --summary <../t4100/t-apply-6.patch >current && + 'git apply --stat --summary <../t4100/t-apply-6.patch >current && git diff ../t4100/t-apply-6.expect current' test_expect_success \ 'non git' \ - 'git-apply --stat --summary <../t4100/t-apply-7.patch >current && + 'git apply --stat --summary <../t4100/t-apply-7.patch >current && git diff ../t4100/t-apply-7.expect current' test_done diff --git a/t/t4101-apply-nonl.sh b/t/t4101-apply-nonl.sh index 026fac8c55..da8abcf364 100755 --- a/t/t4101-apply-nonl.sh +++ b/t/t4101-apply-nonl.sh @@ -3,7 +3,7 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-apply should handle files with incomplete lines. +test_description='git apply should handle files with incomplete lines. ' . ./test-lib.sh @@ -23,7 +23,7 @@ do cat frotz.$i >frotz test_expect_success \ "apply diff between $i and $j" \ - "git-apply <../t4101/diff.$i-$j && diff frotz.$j frotz" + "git apply <../t4101/diff.$i-$j && diff frotz.$j frotz" done done diff --git a/t/t4102-apply-rename.sh b/t/t4102-apply-rename.sh index b4662b0364..d42abff1ad 100755 --- a/t/t4102-apply-rename.sh +++ b/t/t4102-apply-rename.sh @@ -3,7 +3,7 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-apply handling copy/rename patch. +test_description='git apply handling copy/rename patch. ' . ./test-lib.sh @@ -26,10 +26,10 @@ echo 'This is foo' >foo chmod +x foo test_expect_success setup \ - 'git-update-index --add foo' + 'git update-index --add foo' test_expect_success apply \ - 'git-apply --index --stat --summary --apply test-patch' + 'git apply --index --stat --summary --apply test-patch' if [ "$(git config --get core.filemode)" = false ] then @@ -40,7 +40,7 @@ else fi test_expect_success 'apply reverse' \ - 'git-apply -R --index --stat --summary --apply test-patch && + 'git apply -R --index --stat --summary --apply test-patch && test "$(cat foo)" = "This is foo"' cat >test-patch <<\EOF @@ -56,7 +56,7 @@ copy to bar EOF test_expect_success 'apply copy' \ - 'git-apply --index --stat --summary --apply test-patch && + 'git apply --index --stat --summary --apply test-patch && test "$(cat bar)" = "This is bar" -a "$(cat foo)" = "This is foo"' test_done diff --git a/t/t4103-apply-binary.sh b/t/t4103-apply-binary.sh index e2b1124c78..011126f336 100755 --- a/t/t4103-apply-binary.sh +++ b/t/t4103-apply-binary.sh @@ -3,7 +3,7 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-apply handling binary patches +test_description='git apply handling binary patches ' . ./test-lib.sh @@ -20,55 +20,55 @@ EOF cat file1 >file2 cat file1 >file4 -git-update-index --add --remove file1 file2 file4 +git update-index --add --remove file1 file2 file4 git-commit -m 'Initial Version' 2>/dev/null git-checkout -b binary tr 'x' '\0' file3 cat file3 >file4 -git-add file2 +git add file2 tr '\0' 'v' file1 rm -f file2 -git-update-index --add --remove file1 file2 file3 file4 +git update-index --add --remove file1 file2 file3 file4 git-commit -m 'Second Version' -git-diff-tree -p master binary >B.diff -git-diff-tree -p -C master binary >C.diff +git diff-tree -p master binary >B.diff +git diff-tree -p -C master binary >C.diff -git-diff-tree -p --binary master binary >BF.diff -git-diff-tree -p --binary -C master binary >CF.diff +git diff-tree -p --binary master binary >BF.diff +git diff-tree -p --binary -C master binary >CF.diff test_expect_success 'stat binary diff -- should not fail.' \ 'git-checkout master - git-apply --stat --summary B.diff' + git apply --stat --summary B.diff' test_expect_success 'stat binary diff (copy) -- should not fail.' \ 'git-checkout master - git-apply --stat --summary C.diff' + git apply --stat --summary C.diff' test_expect_failure 'check binary diff -- should fail.' \ 'git-checkout master - git-apply --check B.diff' + git apply --check B.diff' test_expect_failure 'check binary diff (copy) -- should fail.' \ 'git-checkout master - git-apply --check C.diff' + git apply --check C.diff' test_expect_failure 'check incomplete binary diff with replacement -- should fail.' \ 'git-checkout master - git-apply --check --allow-binary-replacement B.diff' + git apply --check --allow-binary-replacement B.diff' test_expect_failure 'check incomplete binary diff with replacement (copy) -- should fail.' \ 'git-checkout master - git-apply --check --allow-binary-replacement C.diff' + git apply --check --allow-binary-replacement C.diff' test_expect_success 'check binary diff with replacement.' \ 'git-checkout master - git-apply --check --allow-binary-replacement BF.diff' + git apply --check --allow-binary-replacement BF.diff' test_expect_success 'check binary diff with replacement (copy).' \ 'git-checkout master - git-apply --check --allow-binary-replacement CF.diff' + git apply --check --allow-binary-replacement CF.diff' # Now we start applying them. @@ -80,36 +80,36 @@ do_reset () { test_expect_failure 'apply binary diff -- should fail.' \ 'do_reset - git-apply B.diff' + git apply B.diff' test_expect_failure 'apply binary diff -- should fail.' \ 'do_reset - git-apply --index B.diff' + git apply --index B.diff' test_expect_failure 'apply binary diff (copy) -- should fail.' \ 'do_reset - git-apply C.diff' + git apply C.diff' test_expect_failure 'apply binary diff (copy) -- should fail.' \ 'do_reset - git-apply --index C.diff' + git apply --index C.diff' test_expect_success 'apply binary diff without replacement.' \ 'do_reset - git-apply BF.diff' + git apply BF.diff' test_expect_success 'apply binary diff without replacement (copy).' \ 'do_reset - git-apply CF.diff' + git apply CF.diff' test_expect_success 'apply binary diff.' \ 'do_reset - git-apply --allow-binary-replacement --index BF.diff && - test -z "$(git-diff --name-status binary)"' + git apply --allow-binary-replacement --index BF.diff && + test -z "$(git diff --name-status binary)"' test_expect_success 'apply binary diff (copy).' \ 'do_reset - git-apply --allow-binary-replacement --index CF.diff && - test -z "$(git-diff --name-status binary)"' + git apply --allow-binary-replacement --index CF.diff && + test -z "$(git diff --name-status binary)"' test_done diff --git a/t/t4104-apply-boundary.sh b/t/t4104-apply-boundary.sh index a5fb3ea40e..64f34e3298 100755 --- a/t/t4104-apply-boundary.sh +++ b/t/t4104-apply-boundary.sh @@ -3,7 +3,7 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-apply boundary tests +test_description='git apply boundary tests ' . ./test-lib.sh diff --git a/t/t4109-apply-multifrag.sh b/t/t4109-apply-multifrag.sh index 5988e1ae4c..bd40a218cd 100755 --- a/t/t4109-apply-multifrag.sh +++ b/t/t4109-apply-multifrag.sh @@ -4,7 +4,7 @@ # Copyright (c) 2005 Robert Fitzsimons # -test_description='git-apply test patches with multiple fragments. +test_description='git apply test patches with multiple fragments. ' . ./test-lib.sh @@ -138,8 +138,8 @@ diff --git a/main.c b/main.c EOF -test_expect_success "S = git-apply (1)" \ - 'git-apply patch1.patch patch2.patch' +test_expect_success "S = git apply (1)" \ + 'git apply patch1.patch patch2.patch' mv main.c main.c.git test_expect_success "S = patch (1)" \ @@ -150,8 +150,8 @@ test_expect_success "S = cmp (1)" \ rm -f main.c main.c.git -test_expect_success "S = git-apply (2)" \ - 'git-apply patch1.patch patch2.patch patch3.patch' +test_expect_success "S = git apply (2)" \ + 'git apply patch1.patch patch2.patch patch3.patch' mv main.c main.c.git test_expect_success "S = patch (2)" \ @@ -162,8 +162,8 @@ test_expect_success "S = cmp (2)" \ rm -f main.c main.c.git -test_expect_success "S = git-apply (3)" \ - 'git-apply patch1.patch patch4.patch' +test_expect_success "S = git apply (3)" \ + 'git apply patch1.patch patch4.patch' mv main.c main.c.git test_expect_success "S = patch (3)" \ diff --git a/t/t4110-apply-scan.sh b/t/t4110-apply-scan.sh index 9faef0d66e..db60652a37 100755 --- a/t/t4110-apply-scan.sh +++ b/t/t4110-apply-scan.sh @@ -4,7 +4,7 @@ # Copyright (c) 2005 Robert Fitzsimons # -test_description='git-apply test for patches which require scanning forwards and backwards. +test_description='git apply test for patches which require scanning forwards and backwards. ' . ./test-lib.sh @@ -86,8 +86,8 @@ diff --git a/new.txt b/new.txt +c2222 EOF -test_expect_success "S = git-apply scan" \ - 'git-apply patch1.patch patch2.patch patch3.patch patch4.patch patch5.patch' +test_expect_success "S = git apply scan" \ + 'git apply patch1.patch patch2.patch patch3.patch patch4.patch patch5.patch' mv new.txt apply.txt test_expect_success "S = patch scan" \ diff --git a/t/t4112-apply-renames.sh b/t/t4112-apply-renames.sh index 9baf810bee..70a1859503 100755 --- a/t/t4112-apply-renames.sh +++ b/t/t4112-apply-renames.sh @@ -3,7 +3,7 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-apply should not get confused with rename/copy. +test_description='git apply should not get confused with rename/copy. ' @@ -115,10 +115,10 @@ rename to include/arch/m32r/klibc/archsetjmp.h +#endif /* _KLIBC_ARCHSETJMP_H */ EOF -find klibc -type f -print | xargs git-update-index --add -- +find klibc -type f -print | xargs git update-index --add -- -test_expect_success 'check rename/copy patch' 'git-apply --check patch' +test_expect_success 'check rename/copy patch' 'git apply --check patch' -test_expect_success 'apply rename/copy patch' 'git-apply --index patch' +test_expect_success 'apply rename/copy patch' 'git apply --index patch' test_done diff --git a/t/t4113-apply-ending.sh b/t/t4113-apply-ending.sh index 7fd0cf62ec..1c6bec044a 100755 --- a/t/t4113-apply-ending.sh +++ b/t/t4113-apply-ending.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Catalin Marinas # -test_description='git-apply trying to add an ending line. +test_description='git apply trying to add an ending line. ' . ./test-lib.sh @@ -25,12 +25,12 @@ echo 'b' >>file echo 'c' >>file test_expect_success setup \ - 'git-update-index --add file' + 'git update-index --add file' # test test_expect_failure 'apply at the end' \ - 'git-apply --index test-patch' + 'git apply --index test-patch' cat >test-patch <<\EOF diff a/file b/file @@ -45,9 +45,9 @@ EOF echo >file 'a b c' -git-update-index file +git update-index file test_expect_failure 'apply at the beginning' \ - 'git-apply --index test-patch' + 'git apply --index test-patch' test_done diff --git a/t/t4114-apply-typechange.sh b/t/t4114-apply-typechange.sh index ca81d72157..55334927ab 100755 --- a/t/t4114-apply-typechange.sh +++ b/t/t4114-apply-typechange.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Eric Wong # -test_description='git-apply should not get confused with type changes. +test_description='git apply should not get confused with type changes. ' diff --git a/t/t4115-apply-symlink.sh b/t/t4115-apply-symlink.sh index b947ed83bb..a07ff42c2f 100755 --- a/t/t4115-apply-symlink.sh +++ b/t/t4115-apply-symlink.sh @@ -3,7 +3,7 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-apply symlinks and partial files +test_description='git apply symlinks and partial files ' diff --git a/t/t4116-apply-reverse.sh b/t/t4116-apply-reverse.sh index 2685b22630..a7f5905f1e 100755 --- a/t/t4116-apply-reverse.sh +++ b/t/t4116-apply-reverse.sh @@ -3,7 +3,7 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-apply in reverse +test_description='git apply in reverse ' diff --git a/t/t4117-apply-reject.sh b/t/t4117-apply-reject.sh index 91931f0e3f..659e17c92e 100755 --- a/t/t4117-apply-reject.sh +++ b/t/t4117-apply-reject.sh @@ -3,7 +3,7 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-apply with rejects +test_description='git apply with rejects ' diff --git a/t/t4118-apply-empty-context.sh b/t/t4118-apply-empty-context.sh index dd88e81e04..1d531caf79 100755 --- a/t/t4118-apply-empty-context.sh +++ b/t/t4118-apply-empty-context.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Junio C Hamano # -test_description='git-apply with new style GNU diff with empty context +test_description='git apply with new style GNU diff with empty context ' diff --git a/t/t4119-apply-config.sh b/t/t4119-apply-config.sh index edae7056e4..65571e0549 100755 --- a/t/t4119-apply-config.sh +++ b/t/t4119-apply-config.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Junio C Hamano # -test_description='git-apply --whitespace=strip and configuration file. +test_description='git apply --whitespace=strip and configuration file. ' diff --git a/t/t4120-apply-popt.sh b/t/t4120-apply-popt.sh index 2f672f30d4..83d4ba6798 100755 --- a/t/t4120-apply-popt.sh +++ b/t/t4120-apply-popt.sh @@ -3,7 +3,7 @@ # Copyright (c) 2007 Shawn O. Pearce # -test_description='git-apply -p handling.' +test_description='git apply -p handling.' . ./test-lib.sh diff --git a/t/t4121-apply-diffs.sh b/t/t4121-apply-diffs.sh index b95b89c341..aff551a1d7 100755 --- a/t/t4121-apply-diffs.sh +++ b/t/t4121-apply-diffs.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-apply for contextually independent diffs' +test_description='git apply for contextually independent diffs' . ./test-lib.sh echo '1 diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh index a46d7f74be..71d364ab79 100755 --- a/t/t4200-rerere.sh +++ b/t/t4200-rerere.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Johannes E. Schindelin # -test_description='git-rerere +test_description='git rerere ' . ./test-lib.sh diff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh index a48733cee0..10a5fa9a3a 100755 --- a/t/t4201-shortlog.sh +++ b/t/t4201-shortlog.sh @@ -3,7 +3,7 @@ # Copyright (c) 2006 Johannes E. Schindelin # -test_description='git-shortlog +test_description='git shortlog ' . ./test-lib.sh diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index a6c5bf6ab4..1a4c53a031 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -3,7 +3,7 @@ # Copyright (C) 2005 Rene Scharfe # -test_description='git-tar-tree and git-get-tar-commit-id test +test_description='git tar-tree and git get-tar-commit-id test This test covers the topics of file contents, commit date handling and commit id embedding: @@ -13,13 +13,13 @@ commit id embedding: binary file (/bin/sh). Only paths shorter than 99 characters are used. - git-tar-tree applies the commit date to every file in the archive it + git tar-tree applies the commit date to every file in the archive it creates. The test sets the commit date to a specific value and checks if the tar archive contains that value. - When giving git-tar-tree a commit id (in contrast to a tree id) it + When giving git tar-tree a commit id (in contrast to a tree id) it embeds this commit id into the tar archive as a comment. The test - checks the ability of git-get-tar-commit-id to figure it out from the + checks the ability of git get-tar-commit-id to figure it out from the tar file. ' @@ -42,23 +42,23 @@ test_expect_success \ test_expect_success \ 'add files to repository' \ - 'find a -type f | xargs git-update-index --add && - find a -type l | xargs git-update-index --add && - treeid=`git-write-tree` && + 'find a -type f | xargs git update-index --add && + find a -type l | xargs git update-index --add && + treeid=`git write-tree` && echo $treeid >treeid && - git-update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \ - git-commit-tree $treeid b.tar' + 'git archive' \ + 'git archive HEAD >b.tar' test_expect_success \ - 'git-tar-tree' \ - 'git-tar-tree HEAD >b2.tar' + 'git tar-tree' \ + 'git tar-tree HEAD >b2.tar' test_expect_success \ - 'git-archive vs. git-tar-tree' \ + 'git archive vs. git tar-tree' \ 'diff b.tar b2.tar' test_expect_success \ @@ -70,9 +70,9 @@ test_expect_success \ diff expected.mtime b.mtime' test_expect_success \ - 'git-get-tar-commit-id' \ - 'git-get-tar-commit-id b.commitid && - diff .git/$(git-symbolic-ref HEAD) b.commitid' + 'git get-tar-commit-id' \ + 'git get-tar-commit-id b.commitid && + diff .git/$(git symbolic-ref HEAD) b.commitid' test_expect_success \ 'extract tar archive' \ @@ -88,8 +88,8 @@ test_expect_success \ 'diff -r a b/a' test_expect_success \ - 'git-tar-tree with prefix' \ - 'git-tar-tree HEAD prefix >c.tar' + 'git tar-tree with prefix' \ + 'git tar-tree HEAD prefix >c.tar' test_expect_success \ 'extract tar archive with prefix' \ @@ -105,8 +105,8 @@ test_expect_success \ 'diff -r a c/prefix/a' test_expect_success \ - 'git-archive --format=zip' \ - 'git-archive --format=zip HEAD >d.zip' + 'git archive --format=zip' \ + 'git archive --format=zip HEAD >d.zip' $UNZIP -v >/dev/null 2>&1 if [ $? -eq 127 ]; then @@ -129,8 +129,8 @@ test_expect_success \ 'diff -r a d/a' test_expect_success \ - 'git-archive --format=zip with prefix' \ - 'git-archive --format=zip --prefix=prefix/ HEAD >e.zip' + 'git archive --format=zip with prefix' \ + 'git archive --format=zip --prefix=prefix/ HEAD >e.zip' test_expect_success \ 'extract ZIP archive with prefix' \ @@ -146,7 +146,7 @@ test_expect_success \ 'diff -r a e/prefix/a' test_expect_success \ - 'git-archive --list outside of a git repo' \ - 'GIT_DIR=some/non-existing/directory git-archive --list' + 'git archive --list outside of a git repo' \ + 'GIT_DIR=some/non-existing/directory git archive --list' test_done diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh index ca96918da2..9b1a74542a 100755 --- a/t/t5100-mailinfo.sh +++ b/t/t5100-mailinfo.sh @@ -3,12 +3,12 @@ # Copyright (c) 2005 Junio C Hamano # -test_description='git-mailinfo and git-mailsplit test' +test_description='git mailinfo and git mailsplit test' . ./test-lib.sh test_expect_success 'split sample box' \ - 'git-mailsplit -o. ../t5100/sample.mbox >last && + 'git mailsplit -o. ../t5100/sample.mbox >last && last=`cat last` && echo total is $last && test `cat last` = 8' @@ -16,7 +16,7 @@ test_expect_success 'split sample box' \ for mail in `echo 00*` do test_expect_success "mailinfo $mail" \ - "git-mailinfo -u msg$mail patch$mail <$mail >info$mail && + "git mailinfo -u msg$mail patch$mail <$mail >info$mail && echo msg && diff ../t5100/msg$mail msg$mail && echo patch && diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index f336769836..ba7579c251 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -16,26 +16,26 @@ test_expect_success \ for i in a b c do dd if=/dev/zero bs=4k count=1 | tr "\\0" $i >$i && - git-update-index --add $i || return 1 + git update-index --add $i || return 1 done && - cat c >d && echo foo >>d && git-update-index --add d && - tree=`git-write-tree` && - commit=`git-commit-tree $tree d && echo foo >>d && git update-index --add d && + tree=`git write-tree` && + commit=`git commit-tree $tree obj-list && { - git-diff-tree --root -p $commit && + git diff-tree --root -p $commit && while read object do - t=`git-cat-file -t $object` && - git-cat-file $t $object || return 1 + t=`git cat-file -t $object` && + git cat-file $t $object || return 1 done expect' test_expect_success \ 'pack without delta' \ - 'packname_1=$(git-pack-objects --window=0 test-1 current && diff expect current' @@ -154,11 +154,11 @@ test_expect_success \ export GIT_OBJECT_DIRECTORY && rm -f .git2/objects/pack/test-* && cp test-2-${packname_2}.pack test-2-${packname_2}.idx .git2/objects/pack && { - git-diff-tree --root -p $commit && + git diff-tree --root -p $commit && while read object do - t=`git-cat-file -t $object` && - git-cat-file $t $object || return 1 + t=`git cat-file -t $object` && + git cat-file $t $object || return 1 done current && diff expect current' @@ -169,11 +169,11 @@ test_expect_success \ export GIT_OBJECT_DIRECTORY && rm -f .git2/objects/pack/test-* && cp test-3-${packname_3}.pack test-3-${packname_3}.idx .git2/objects/pack && { - git-diff-tree --root -p $commit && + git diff-tree --root -p $commit && while read object do - t=`git-cat-file -t $object` && - git-cat-file $t $object || return 1 + t=`git cat-file -t $object` && + git cat-file $t $object || return 1 done current && diff expect current' @@ -182,7 +182,7 @@ unset GIT_OBJECT_DIRECTORY test_expect_success \ 'verify pack' \ - 'git-verify-pack test-1-${packname_1}.idx \ + 'git verify-pack test-1-${packname_1}.idx \ test-2-${packname_2}.idx \ test-3-${packname_3}.idx' @@ -190,7 +190,7 @@ test_expect_success \ 'corrupt a pack and see if verify catches' \ 'cat test-1-${packname_1}.idx >test-3.idx && cat test-2-${packname_2}.pack >test-3.pack && - if git-verify-pack test-3.idx + if git verify-pack test-3.idx then false else :; fi && @@ -198,7 +198,7 @@ test_expect_success \ : PACK_SIGNATURE && cat test-1-${packname_1}.pack >test-3.pack && dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=2 && - if git-verify-pack test-3.idx + if git verify-pack test-3.idx then false else :; fi && @@ -206,7 +206,7 @@ test_expect_success \ : PACK_VERSION && cat test-1-${packname_1}.pack >test-3.pack && dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=7 && - if git-verify-pack test-3.idx + if git verify-pack test-3.idx then false else :; fi && @@ -214,7 +214,7 @@ test_expect_success \ : TYPE/SIZE byte of the first packed object data && cat test-1-${packname_1}.pack >test-3.pack && dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=12 && - if git-verify-pack test-3.idx + if git verify-pack test-3.idx then false else :; fi && @@ -224,7 +224,7 @@ test_expect_success \ l=`expr $l - 20` && cat test-1-${packname_1}.pack >test-3.pack && dd if=/dev/zero of=test-3.idx count=20 bs=1 conv=notrunc seek=$l && - if git-verify-pack test-3.pack + if git verify-pack test-3.pack then false else :; fi && diff --git a/t/t5301-sliding-window.sh b/t/t5301-sliding-window.sh index fce77f1255..073ac0c6f9 100755 --- a/t/t5301-sliding-window.sh +++ b/t/t5301-sliding-window.sh @@ -13,48 +13,48 @@ test_expect_success \ do echo $i >$i && test-genrandom "$i" 32768 >>$i && - git-update-index --add $i || return 1 + git update-index --add $i || return 1 done && - echo d >d && cat c >>d && git-update-index --add d && - tree=`git-write-tree` && - commit1=`git-commit-tree $tree d && cat c >>d && git update-index --add d && + tree=`git write-tree` && + commit1=`git commit-tree $tree file_$i && test-genrandom "$i" 8192 >>file_$i && - git-update-index --add file_$i && + git update-index --add file_$i && i=`expr $i + 1` || return 1 done && { echo 101 && test-genrandom 100 8192; } >file_101 && - git-update-index --add file_101 && - tree=`git-write-tree` && - commit=`git-commit-tree $tree obj-list && - git-update-ref HEAD $commit' + git update-ref HEAD $commit' test_expect_success \ 'pack-objects with index version 1' \ - 'pack1=$(git-pack-objects --index-version=1 test-1 blob_1 && + git cat-file blob "$delta_sha1" > blob_1 && chmod +w ".git/objects/pack/pack-${pack1}.pack" && dd of=".git/objects/pack/pack-${pack1}.pack" seek=$(($delta_offs + 1)) \ if=".git/objects/pack/pack-${pack1}.idx" skip=$((256 * 4 + 4)) \ bs=1 count=20 conv=notrunc && - git-cat-file blob "$delta_sha1" > blob_2 )' + git cat-file blob "$delta_sha1" > blob_2 )' test_expect_failure \ '[index v1] 3) corrupted delta happily returned wrong data' \ @@ -102,37 +102,37 @@ test_expect_failure \ test_expect_failure \ '[index v1] 4) confirm that the pack is actually corrupted' \ - 'git-fsck --full $commit' + 'git fsck --full $commit' test_expect_success \ '[index v1] 5) pack-objects happily reuses corrupted data' \ - 'pack4=$(git-pack-objects test-4 blob_3 && + git cat-file blob "$delta_sha1" > blob_3 && chmod +w ".git/objects/pack/pack-${pack1}.pack" && dd of=".git/objects/pack/pack-${pack1}.pack" seek=$(($delta_offs + 1)) \ if=".git/objects/pack/pack-${pack1}.idx" skip=$((8 + 256 * 4)) \ bs=1 count=20 conv=notrunc && - git-cat-file blob "$delta_sha1" > blob_4 )' + git cat-file blob "$delta_sha1" > blob_4 )' test_expect_failure \ '[index v2] 3) corrupted delta happily returned wrong data' \ @@ -140,10 +140,10 @@ test_expect_failure \ test_expect_failure \ '[index v2] 4) confirm that the pack is actually corrupted' \ - 'git-fsck --full $commit' + 'git fsck --full $commit' test_expect_failure \ '[index v2] 5) pack-objects refuses to reuse corrupted data' \ - 'git-pack-objects test-5 mozart/is/pink && - git-update-index --add mozart/is/pink && - tree=$(git-write-tree) && - commit=$(echo "Commit #0" | git-commit-tree $tree) && + git update-index --add mozart/is/pink && + tree=$(git write-tree) && + commit=$(echo "Commit #0" | git commit-tree $tree) && zero=$commit && parent=$zero && i=0 && @@ -24,18 +24,18 @@ test_expect_success setup ' i=$(($i+1)) && test_tick && echo "Commit #$i" >mozart/is/pink && - git-update-index --add mozart/is/pink && - tree=$(git-write-tree) && - commit=$(echo "Commit #$i" | git-commit-tree $tree -p $parent) && - git-update-ref refs/tags/commit$i $commit && + git update-index --add mozart/is/pink && + tree=$(git write-tree) && + commit=$(echo "Commit #$i" | git commit-tree $tree -p $parent) && + git update-ref refs/tags/commit$i $commit && parent=$commit || return 1 done && - git-update-ref HEAD "$commit" && + git update-ref HEAD "$commit" && git-clone ./. victim && cd victim && - git-log && + git log && cd .. && - git-update-ref HEAD "$zero" && + git update-ref HEAD "$zero" && parent=$zero && i=0 && while test $i -le $cnt @@ -43,15 +43,15 @@ test_expect_success setup ' i=$(($i+1)) && test_tick && echo "Rebase #$i" >mozart/is/pink && - git-update-index --add mozart/is/pink && - tree=$(git-write-tree) && - commit=$(echo "Rebase #$i" | git-commit-tree $tree -p $parent) && - git-update-ref refs/tags/rebase$i $commit && + git update-index --add mozart/is/pink && + tree=$(git write-tree) && + commit=$(echo "Rebase #$i" | git commit-tree $tree -p $parent) && + git update-ref refs/tags/rebase$i $commit && parent=$commit || return 1 done && - git-update-ref HEAD "$commit" && + git update-ref HEAD "$commit" && echo Rebase && - git-log' + git log' test_expect_success 'pack the source repository' ' git repack -a -d && @@ -106,9 +106,9 @@ export HOME ;# this way we force the victim/.git/config to be used. test_expect_success \ 'pushing with --force should be denied with denyNonFastforwards' ' cd victim && - git-config receive.denyNonFastforwards true && + git config receive.denyNonFastforwards true && cd .. && - git-update-ref refs/heads/master master^ || return 1 + git update-ref refs/heads/master master^ || return 1 git-send-pack --force ./victim/.git/ master && return 1 ! git diff .git/refs/heads/master victim/.git/refs/heads/master ' diff --git a/t/t5401-update-hooks.sh b/t/t5401-update-hooks.sh index f1c7ff0c0a..c5dd30d0a4 100755 --- a/t/t5401-update-hooks.sh +++ b/t/t5401-update-hooks.sh @@ -8,19 +8,19 @@ test_description='Test the update hook infrastructure.' test_expect_success setup ' echo This is a test. >a && - git-update-index --add a && - tree0=$(git-write-tree) && - commit0=$(echo setup | git-commit-tree $tree0) && + git update-index --add a && + tree0=$(git write-tree) && + commit0=$(echo setup | git commit-tree $tree0) && echo We hope it works. >a && - git-update-index a && - tree1=$(git-write-tree) && - commit1=$(echo modify | git-commit-tree $tree1 -p $commit0) && - git-update-ref refs/heads/master $commit0 && - git-update-ref refs/heads/tofail $commit1 && + git update-index a && + tree1=$(git write-tree) && + commit1=$(echo modify | git commit-tree $tree1 -p $commit0) && + git update-ref refs/heads/master $commit0 && + git update-ref refs/heads/tofail $commit1 && git-clone ./. victim && - GIT_DIR=victim/.git git-update-ref refs/heads/tofail $commit1 && - git-update-ref refs/heads/master $commit1 && - git-update-ref refs/heads/tofail $commit0 + GIT_DIR=victim/.git git update-ref refs/heads/tofail $commit1 && + git update-ref refs/heads/master $commit1 && + git update-ref refs/heads/tofail $commit0 ' cat >victim/.git/hooks/pre-receive <<'EOF' @@ -65,8 +65,8 @@ test_expect_failure push ' ' test_expect_success 'updated as expected' ' - test $(GIT_DIR=victim/.git git-rev-parse master) = $commit1 && - test $(GIT_DIR=victim/.git git-rev-parse tofail) = $commit1 + test $(GIT_DIR=victim/.git git rev-parse master) = $commit1 && + test $(GIT_DIR=victim/.git git rev-parse tofail) = $commit1 ' test_expect_success 'hooks ran' ' diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index 48e3d1705f..7da515361a 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -25,12 +25,12 @@ add () { done echo "$text" > test.txt - git-update-index --add test.txt - tree=$(git-write-tree) + git update-index --add test.txt + tree=$(git write-tree) # make sure timestamps are in correct order sec=$(($sec+1)) commit=$(echo "$text" | GIT_AUTHOR_DATE=$sec \ - git-commit-tree $tree $parents 2>>log2.txt) + git commit-tree $tree $parents 2>>log2.txt) export $name=$commit echo $commit > .git/refs/heads/$branch eval ${branch}TIP=$commit @@ -61,19 +61,19 @@ pull_to_client () { "git-fetch-pack -k -v .. $heads" case "$heads" in *A*) echo $ATIP > .git/refs/heads/A;; esac case "$heads" in *B*) echo $BTIP > .git/refs/heads/B;; esac - git-symbolic-ref HEAD refs/heads/`echo $heads | sed -e 's/^\(.\).*$/\1/'` + git symbolic-ref HEAD refs/heads/`echo $heads | sed -e 's/^\(.\).*$/\1/'` - test_expect_success "fsck" 'git-fsck --full > fsck.txt 2>&1' + test_expect_success "fsck" 'git fsck --full > fsck.txt 2>&1' test_expect_success 'check downloaded results' \ 'mv .git/objects/pack/pack-* . && p=`ls -1 pack-*.pack` && - git-unpack-objects <$p && - git-fsck --full' + git unpack-objects <$p && + git fsck --full' test_expect_success "new object count after $number pull" \ 'idx=`echo pack-*.idx` && - pack_count=`git-show-index <$idx | wc -l` && + pack_count=`git show-index <$idx | wc -l` && test $pack_count = $count' test -z "$pack_count" && pack_count=0 if [ -z "$no_strict_count_check" ]; then @@ -97,7 +97,7 @@ pull_to_client () { ( mkdir client && cd client && - git-init 2>> log2.txt && + git init 2>> log2.txt && git config transfer.unpacklimit 0 ) @@ -113,7 +113,7 @@ add B1 $A1 echo $ATIP > .git/refs/heads/A echo $BTIP > .git/refs/heads/B -git-symbolic-ref HEAD refs/heads/B +git symbolic-ref HEAD refs/heads/B pull_to_client 1st "B A" $((11*3)) @@ -131,7 +131,7 @@ pull_to_client 3rd "A" $((1*3)) # old fails test_expect_success "clone shallow" "git-clone --depth 2 . shallow" -(cd shallow; git-count-objects -v) > count.shallow +(cd shallow; git count-objects -v) > count.shallow test_expect_success "clone shallow object count" \ "test \"in-pack: 18\" = \"$(grep in-pack count.shallow)\"" @@ -145,7 +145,7 @@ test_expect_success "clone shallow object count (part 2)" ' ' test_expect_success "fsck in shallow repo" \ - "(cd shallow; git-fsck --full)" + "(cd shallow; git fsck --full)" #test_done; exit @@ -155,7 +155,7 @@ add B67 $B66 test_expect_success "pull in shallow repo" \ "(cd shallow; git pull .. B)" -(cd shallow; git-count-objects -v) > count.shallow +(cd shallow; git count-objects -v) > count.shallow test_expect_success "clone shallow object count" \ "test \"count: 6\" = \"$(grep count count.shallow)\"" @@ -165,14 +165,14 @@ add B69 $B68 test_expect_success "deepening pull in shallow repo" \ "(cd shallow; git pull --depth 4 .. B)" -(cd shallow; git-count-objects -v) > count.shallow +(cd shallow; git count-objects -v) > count.shallow test_expect_success "clone shallow object count" \ "test \"count: 12\" = \"$(grep count count.shallow)\"" test_expect_success "deepening fetch in shallow repo" \ "(cd shallow; git fetch --depth 4 .. A:A)" -(cd shallow; git-count-objects -v) > count.shallow +(cd shallow; git count-objects -v) > count.shallow test_expect_success "clone shallow object count" \ "test \"count: 18\" = \"$(grep count count.shallow)\"" diff --git a/t/t6000lib.sh b/t/t6000lib.sh index d548bf8026..180633e1e0 100755 --- a/t/t6000lib.sh +++ b/t/t6000lib.sh @@ -17,7 +17,7 @@ unique_commit() _text=$1 _tree=$2 shift 2 - echo $_text | git-commit-tree $(tag $_tree) "$@" + echo $_text | git commit-tree $(tag $_tree) "$@" } # Save the output of a command into the tag specified. Prepend @@ -62,7 +62,7 @@ as_author() commit_date() { _commit=$1 - git-cat-file commit $_commit | sed -n "s/^committer .*> \([0-9]*\) .*/\1/p" + git cat-file commit $_commit | sed -n "s/^committer .*> \([0-9]*\) .*/\1/p" } on_committer_date() diff --git a/t/t6002-rev-list-bisect.sh b/t/t6002-rev-list-bisect.sh index 71cbb72e1b..8f5de097ec 100755 --- a/t/t6002-rev-list-bisect.sh +++ b/t/t6002-rev-list-bisect.sh @@ -2,7 +2,7 @@ # # Copyright (c) 2005 Jon Seymour # -test_description='Tests git-rev-list --bisect functionality' +test_description='Tests git rev-list --bisect functionality' . ./test-lib.sh . ../t6000lib.sh # t6xxx specific functions @@ -16,11 +16,11 @@ test_bisection_diff() _max_diff=$1 _bisect_option=$2 shift 2 - _bisection=$(git-rev-list $_bisect_option "$@") - _list_size=$(git-rev-list "$@" | wc -l) + _bisection=$(git rev-list $_bisect_option "$@") + _list_size=$(git rev-list "$@" | wc -l) _head=$1 shift 1 - _bisection_size=$(git-rev-list $_bisection "$@" | wc -l) + _bisection_size=$(git rev-list $_bisection "$@" | wc -l) [ -n "$_list_size" -a -n "$_bisection_size" ] || error "test_bisection_diff failed" @@ -37,8 +37,8 @@ test_bisection_diff() } date >path0 -git-update-index --add path0 -save_tag tree git-write-tree +git update-index --add path0 +save_tag tree git write-tree on_committer_date "1971-08-16 00:00:00" hide_error save_tag root unique_commit root tree on_committer_date "1971-08-16 00:00:01" save_tag l0 unique_commit l0 tree -p root on_committer_date "1971-08-16 00:00:02" save_tag l1 unique_commit l1 tree -p l0 @@ -58,7 +58,7 @@ on_committer_date "1971-08-16 00:00:15" save_tag a4 unique_commit a4 tree -p a3 on_committer_date "1971-08-16 00:00:16" save_tag l3 unique_commit l3 tree -p a4 on_committer_date "1971-08-16 00:00:17" save_tag l4 unique_commit l4 tree -p l3 on_committer_date "1971-08-16 00:00:18" save_tag l5 unique_commit l5 tree -p l4 -git-update-ref HEAD $(tag l5) +git update-ref HEAD $(tag l5) # E @@ -163,23 +163,23 @@ test_sequence() # the bisection point is the head - this is the bad point. # -test_output_expect_success "$_bisect_option l5 ^root" 'git-rev-list $_bisect_option l5 ^root' <path0 -git-update-index --add path0 -save_tag tree git-write-tree +git update-index --add path0 +save_tag tree git write-tree on_committer_date "1971-08-16 00:00:00" hide_error save_tag root unique_commit root tree on_committer_date "1971-08-16 00:00:01" save_tag l0 unique_commit l0 tree -p root on_committer_date "1971-08-16 00:00:02" save_tag l1 unique_commit l1 tree -p l0 @@ -77,13 +77,13 @@ save_tag h2 unique_commit g4 tree -p g2 save_tag g3 unique_commit g5 tree -p g2 save_tag g4 unique_commit g6 tree -p g3 -p h2 -git-update-ref HEAD $(tag l5) +git update-ref HEAD $(tag l5) -test_output_expect_success 'rev-list has correct number of entries' 'git-rev-list HEAD | wc -l | tr -d \" \"' <foo && git-commit -a -m "changed foo" ' @@ -14,8 +14,8 @@ touch foo && git-add foo && git-commit -m "added foo" && test_format() { cat >expect.$1 test_expect_success "format $1" " -git-rev-list --pretty=format:$2 master >output.$1 && -git-diff expect.$1 output.$1 +git rev-list --pretty=format:$2 master >output.$1 && +git diff expect.$1 output.$1 " } @@ -113,7 +113,7 @@ and it will be encoded in iso8859-1. We should therefore include an iso8859 character: ¡bueno! EOF test_expect_success 'setup complex body' ' -git-config i18n.commitencoding iso8859-1 && +git config i18n.commitencoding iso8859-1 && echo change2 >foo && git-commit -a -F commit-msg ' diff --git a/t/t6010-merge-base.sh b/t/t6010-merge-base.sh index 22e0893056..96f3d35530 100755 --- a/t/t6010-merge-base.sh +++ b/t/t6010-merge-base.sh @@ -8,7 +8,7 @@ test_description='Merge base computation. . ./test-lib.sh -T=$(git-write-tree) +T=$(git write-tree) M=1130000000 Z=+0000 @@ -29,7 +29,7 @@ doit() { GIT_COMMITTER_DATE="$(($M + $OFFSET)) $Z" GIT_AUTHOR_DATE=$GIT_COMMITTER_DATE export GIT_COMMITTER_DATE GIT_AUTHOR_DATE - commit=$(echo $NAME | git-commit-tree $T $PARENTS) + commit=$(echo $NAME | git commit-tree $T $PARENTS) echo $commit >.git/refs/tags/$NAME echo $commit } @@ -51,16 +51,16 @@ G=$(doit 7 G $B $E) H=$(doit 8 H $A $F) test_expect_success 'compute merge-base (single)' \ - 'MB=$(git-merge-base G H) && - expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"' + 'MB=$(git merge-base G H) && + expr "$(git name-rev "$MB")" : "[0-9a-f]* tags/B"' test_expect_success 'compute merge-base (all)' \ - 'MB=$(git-merge-base --all G H) && - expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"' + 'MB=$(git merge-base --all G H) && + expr "$(git name-rev "$MB")" : "[0-9a-f]* tags/B"' test_expect_success 'compute merge-base with show-branch' \ - 'MB=$(git-show-branch --merge-base G H) && - expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/B"' + 'MB=$(git show-branch --merge-base G H) && + expr "$(git name-rev "$MB")" : "[0-9a-f]* tags/B"' # Setup for second test to demonstrate that relying on timestamps in a # distributed SCM to provide a _consistent_ partial ordering of commits @@ -100,11 +100,11 @@ PL=$(doit 4 PL $L2 $C2) PR=$(doit 4 PR $C2 $R2) test_expect_success 'compute merge-base (single)' \ - 'MB=$(git-merge-base PL PR) && - expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/C2"' + 'MB=$(git merge-base PL PR) && + expr "$(git name-rev "$MB")" : "[0-9a-f]* tags/C2"' test_expect_success 'compute merge-base (all)' \ - 'MB=$(git-merge-base --all PL PR) && - expr "$(git-name-rev "$MB")" : "[0-9a-f]* tags/C2"' + 'MB=$(git merge-base --all PL PR) && + expr "$(git name-rev "$MB")" : "[0-9a-f]* tags/C2"' test_done diff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh index ecc11c1a84..ae3b6f2831 100755 --- a/t/t6023-merge-file.sh +++ b/t/t6023-merge-file.sh @@ -56,18 +56,18 @@ printf "propter nomen suum." >> new4.txt cp new1.txt test.txt test_expect_success "merge without conflict" \ - "git-merge-file test.txt orig.txt new2.txt" + "git merge-file test.txt orig.txt new2.txt" cp new1.txt test2.txt test_expect_success "merge without conflict (missing LF at EOF)" \ - "git-merge-file test2.txt orig.txt new2.txt" + "git merge-file test2.txt orig.txt new2.txt" test_expect_success "merge result added missing LF" \ "git diff test.txt test2.txt" cp test.txt backup.txt test_expect_failure "merge with conflicts" \ - "git-merge-file test.txt orig.txt new3.txt" + "git merge-file test.txt orig.txt new3.txt" cat > expect.txt << EOF <<<<<<< test.txt @@ -90,7 +90,7 @@ test_expect_success "expected conflict markers" "git diff test.txt expect.txt" cp backup.txt test.txt test_expect_failure "merge with conflicts, using -L" \ - "git-merge-file -L 1 -L 2 test.txt orig.txt new3.txt" + "git merge-file -L 1 -L 2 test.txt orig.txt new3.txt" cat > expect.txt << EOF <<<<<<< 1 @@ -114,7 +114,7 @@ test_expect_success "expected conflict markers, with -L" \ sed "s/ tu / TU /" < new1.txt > new5.txt test_expect_failure "conflict in removed tail" \ - "git-merge-file -p orig.txt new1.txt new5.txt > out" + "git merge-file -p orig.txt new1.txt new5.txt > out" cat > expect << EOF Dominus regit me, diff --git a/t/t6024-recursive-merge.sh b/t/t6024-recursive-merge.sh index 058db9cc52..c154f03cf5 100755 --- a/t/t6024-recursive-merge.sh +++ b/t/t6024-recursive-merge.sh @@ -28,7 +28,7 @@ echo B > a1 && GIT_AUTHOR_DATE="2006-12-12 23:00:02" git commit -m B a1 && git checkout -b D A && -git-rev-parse B > .git/MERGE_HEAD && +git rev-parse B > .git/MERGE_HEAD && echo D > a1 && git update-index a1 && GIT_AUTHOR_DATE="2006-12-12 23:00:03" git commit -m D && @@ -42,19 +42,19 @@ echo C > a1 && GIT_AUTHOR_DATE="2006-12-12 23:00:05" git commit -m C a1 && git checkout -b E C && -git-rev-parse B > .git/MERGE_HEAD && +git rev-parse B > .git/MERGE_HEAD && echo E > a1 && git update-index a1 && GIT_AUTHOR_DATE="2006-12-12 23:00:06" git commit -m E && git checkout -b G E && -git-rev-parse A > .git/MERGE_HEAD && +git rev-parse A > .git/MERGE_HEAD && echo G > a1 && git update-index a1 && GIT_AUTHOR_DATE="2006-12-12 23:00:07" git commit -m G && git checkout -b F D && -git-rev-parse C > .git/MERGE_HEAD && +git rev-parse C > .git/MERGE_HEAD && echo F > a1 && git update-index a1 && GIT_AUTHOR_DATE="2006-12-12 23:00:08" git commit -m F diff --git a/t/t6025-merge-symlinks.sh b/t/t6025-merge-symlinks.sh index 3c1a6972bd..950c2e9b63 100755 --- a/t/t6025-merge-symlinks.sh +++ b/t/t6025-merge-symlinks.sh @@ -12,22 +12,22 @@ if core.symlinks is false.' test_expect_success \ 'setup' ' -git-config core.symlinks false && +git config core.symlinks false && > file && -git-add file && +git add file && git-commit -m initial && -git-branch b-symlink && -git-branch b-file && +git branch b-symlink && +git branch b-file && l=$(echo -n file | git-hash-object -t blob -w --stdin) && -echo "120000 $l symlink" | git-update-index --index-info && +echo "120000 $l symlink" | git update-index --index-info && git-commit -m master && git-checkout b-symlink && l=$(echo -n file-different | git-hash-object -t blob -w --stdin) && -echo "120000 $l symlink" | git-update-index --index-info && +echo "120000 $l symlink" | git update-index --index-info && git-commit -m b-symlink && git-checkout b-file && echo plain-file > symlink && -git-add symlink && +git add symlink && git-commit -m b-file' test_expect_failure \ diff --git a/t/t6101-rev-parse-parents.sh b/t/t6101-rev-parse-parents.sh index dd6cc3a55c..0724864e56 100755 --- a/t/t6101-rev-parse-parents.sh +++ b/t/t6101-rev-parse-parents.sh @@ -3,31 +3,31 @@ # Copyright (c) 2005 Johannes Schindelin # -test_description='Test git-rev-parse with different parent options' +test_description='Test git rev-parse with different parent options' . ./test-lib.sh . ../t6000lib.sh # t6xxx specific functions date >path0 -git-update-index --add path0 -save_tag tree git-write-tree +git update-index --add path0 +save_tag tree git write-tree hide_error save_tag start unique_commit "start" tree save_tag second unique_commit "second" tree -p start hide_error save_tag start2 unique_commit "start2" tree save_tag two_parents unique_commit "next" tree -p second -p start2 save_tag final unique_commit "final" tree -p two_parents -test_expect_success 'start is valid' 'git-rev-parse start | grep "^[0-9a-f]\{40\}$"' -test_expect_success 'start^0' "test $(cat .git/refs/tags/start) = $(git-rev-parse start^0)" -test_expect_success 'start^1 not valid' "if git-rev-parse --verify start^1; then false; else :; fi" -test_expect_success 'second^1 = second^' "test $(git-rev-parse second^1) = $(git-rev-parse second^)" -test_expect_success 'final^1^1^1' "test $(git-rev-parse start) = $(git-rev-parse final^1^1^1)" -test_expect_success 'final^1^1^1 = final^^^' "test $(git-rev-parse final^1^1^1) = $(git-rev-parse final^^^)" -test_expect_success 'final^1^2' "test $(git-rev-parse start2) = $(git-rev-parse final^1^2)" -test_expect_success 'final^1^2 != final^1^1' "test $(git-rev-parse final^1^2) != $(git-rev-parse final^1^1)" -test_expect_success 'final^1^3 not valid' "if git-rev-parse --verify final^1^3; then false; else :; fi" -test_expect_failure '--verify start2^1' 'git-rev-parse --verify start2^1' -test_expect_success '--verify start2^0' 'git-rev-parse --verify start2^0' +test_expect_success 'start is valid' 'git rev-parse start | grep "^[0-9a-f]\{40\}$"' +test_expect_success 'start^0' "test $(cat .git/refs/tags/start) = $(git rev-parse start^0)" +test_expect_success 'start^1 not valid' "if git rev-parse --verify start^1; then false; else :; fi" +test_expect_success 'second^1 = second^' "test $(git rev-parse second^1) = $(git rev-parse second^)" +test_expect_success 'final^1^1^1' "test $(git rev-parse start) = $(git rev-parse final^1^1^1)" +test_expect_success 'final^1^1^1 = final^^^' "test $(git rev-parse final^1^1^1) = $(git rev-parse final^^^)" +test_expect_success 'final^1^2' "test $(git rev-parse start2) = $(git rev-parse final^1^2)" +test_expect_success 'final^1^2 != final^1^1' "test $(git rev-parse final^1^2) != $(git rev-parse final^1^1)" +test_expect_success 'final^1^3 not valid' "if git rev-parse --verify final^1^3; then false; else :; fi" +test_expect_failure '--verify start2^1' 'git rev-parse --verify start2^1' +test_expect_success '--verify start2^0' 'git rev-parse --verify start2^0' test_expect_success 'repack for next test' 'git repack -a -d' test_expect_success 'short SHA-1 works' ' diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index 3e9edda1ca..ae8ee11183 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -28,39 +28,39 @@ check_describe () { test_expect_success setup ' test_tick && - echo one >file && git-add file && git-commit -m initial && - one=$(git-rev-parse HEAD) && + echo one >file && git add file && git-commit -m initial && + one=$(git rev-parse HEAD) && test_tick && - echo two >file && git-add file && git-commit -m second && - two=$(git-rev-parse HEAD) && + echo two >file && git add file && git-commit -m second && + two=$(git rev-parse HEAD) && test_tick && - echo three >file && git-add file && git-commit -m third && + echo three >file && git add file && git-commit -m third && test_tick && - echo A >file && git-add file && git-commit -m A && + echo A >file && git add file && git-commit -m A && test_tick && git-tag -a -m A A && test_tick && - echo c >file && git-add file && git-commit -m c && + echo c >file && git add file && git-commit -m c && test_tick && git-tag c && git reset --hard $two && test_tick && - echo B >side && git-add side && git-commit -m B && + echo B >side && git add side && git-commit -m B && test_tick && git-tag -a -m B B && test_tick && git-merge -m Merged c && - merged=$(git-rev-parse HEAD) && + merged=$(git rev-parse HEAD) && git reset --hard $two && test_tick && - echo D >another && git-add another && git-commit -m D && + echo D >another && git add another && git-commit -m D && test_tick && git-tag -a -m D D && @@ -77,7 +77,7 @@ test_expect_success setup ' git-merge -m Merged $merged && test_tick && - echo X >file && echo X >side && git-add file side && + echo X >file && echo X >side && git add file side && git-commit -m x ' diff --git a/t/t7001-mv.sh b/t/t7001-mv.sh index 344033249c..8b43fb5a27 100755 --- a/t/t7001-mv.sh +++ b/t/t7001-mv.sh @@ -1,18 +1,18 @@ #!/bin/sh -test_description='git-mv in subdirs' +test_description='git mv in subdirs' . ./test-lib.sh test_expect_success \ 'prepare reference tree' \ 'mkdir path0 path1 && cp ../../COPYING path0/COPYING && - git-add path0/COPYING && + git add path0/COPYING && git-commit -m add -a' test_expect_success \ 'moving the file out of subdirectory' \ - 'cd path0 && git-mv COPYING ../path1/COPYING' + 'cd path0 && git mv COPYING ../path1/COPYING' # in path0 currently test_expect_success \ @@ -21,12 +21,12 @@ test_expect_success \ test_expect_success \ 'checking the commit' \ - 'git-diff-tree -r -M --name-status HEAD^ HEAD | \ + 'git diff-tree -r -M --name-status HEAD^ HEAD | \ grep -E "^R100.+path0/COPYING.+path1/COPYING"' test_expect_success \ 'moving the file back into subdirectory' \ - 'cd path0 && git-mv ../path1/COPYING COPYING' + 'cd path0 && git mv ../path1/COPYING COPYING' # in path0 currently test_expect_success \ @@ -35,18 +35,18 @@ test_expect_success \ test_expect_success \ 'checking the commit' \ - 'git-diff-tree -r -M --name-status HEAD^ HEAD | \ + 'git diff-tree -r -M --name-status HEAD^ HEAD | \ grep -E "^R100.+path1/COPYING.+path0/COPYING"' test_expect_success \ 'adding another file' \ 'cp ../../README path0/README && - git-add path0/README && + git add path0/README && git-commit -m add2 -a' test_expect_success \ 'moving whole subdirectory' \ - 'git-mv path0 path2' + 'git mv path0 path2' test_expect_success \ 'commiting the change' \ @@ -54,18 +54,18 @@ test_expect_success \ test_expect_success \ 'checking the commit' \ - 'git-diff-tree -r -M --name-status HEAD^ HEAD | \ + 'git diff-tree -r -M --name-status HEAD^ HEAD | \ grep -E "^R100.+path0/COPYING.+path2/COPYING" && - git-diff-tree -r -M --name-status HEAD^ HEAD | \ + git diff-tree -r -M --name-status HEAD^ HEAD | \ grep -E "^R100.+path0/README.+path2/README"' test_expect_success \ 'succeed when source is a prefix of destination' \ - 'git-mv path2/COPYING path2/COPYING-renamed' + 'git mv path2/COPYING path2/COPYING-renamed' test_expect_success \ 'moving whole subdirectory into subdirectory' \ - 'git-mv path2 path1' + 'git mv path2 path1' test_expect_success \ 'commiting the change' \ @@ -73,18 +73,18 @@ test_expect_success \ test_expect_success \ 'checking the commit' \ - 'git-diff-tree -r -M --name-status HEAD^ HEAD | \ + 'git diff-tree -r -M --name-status HEAD^ HEAD | \ grep -E "^R100.+path2/COPYING.+path1/path2/COPYING" && - git-diff-tree -r -M --name-status HEAD^ HEAD | \ + git diff-tree -r -M --name-status HEAD^ HEAD | \ grep -E "^R100.+path2/README.+path1/path2/README"' test_expect_failure \ 'do not move directory over existing directory' \ - 'mkdir path0 && mkdir path0/path2 && git-mv path2 path0' + 'mkdir path0 && mkdir path0/path2 && git mv path2 path0' test_expect_success \ 'move into "."' \ - 'git-mv path1/path2/ .' + 'git mv path1/path2/ .' test_expect_success "Michael Cassar's test case" ' rm -fr .git papers partA && diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index f00c262e45..21f9bc5dd6 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -27,14 +27,14 @@ test_expect_success 'setup' ' make_commit H ' -H=$(git-rev-parse H) +H=$(git rev-parse H) test_expect_success 'rewrite identically' ' git-filter-branch H2 ' test_expect_success 'result is really identical' ' - test $H = $(git-rev-parse H2) + test $H = $(git rev-parse H2) ' test_expect_success 'rewrite, renaming a specific file' ' @@ -51,7 +51,7 @@ test_expect_success 'rewrite one branch, keeping a side branch' ' ' test_expect_success 'common ancestor is still common (unchanged)' ' - test "$(git-merge-base modD D)" = "$(git-rev-parse B)" + test "$(git merge-base modD D)" = "$(git rev-parse B)" ' test_expect_success 'filter subdirectory only' ' @@ -73,7 +73,7 @@ test_expect_success 'filter subdirectory only' ' ' test_expect_success 'subdirectory filter result looks okay' ' - test 2 = $(git-rev-list sub | wc -l) && + test 2 = $(git rev-list sub | wc -l) && git show sub:new && ! git show sub:subdir ' @@ -93,7 +93,7 @@ test_expect_success 'setup and filter history that requires --full-history' ' ' test_expect_success 'subdirectory filter result looks okay' ' - test 3 = $(git-rev-list -1 --parents sub-master | wc -w) && + test 3 = $(git rev-list -1 --parents sub-master | wc -w) && git show sub-master^:new && git show sub-master^2:new && ! git show sub:subdir @@ -101,9 +101,9 @@ test_expect_success 'subdirectory filter result looks okay' ' test_expect_success 'use index-filter to move into a subdirectory' ' git-filter-branch --index-filter \ - "git-ls-files -s | sed \"s-\\t-&newsubdir/-\" | + "git ls-files -s | sed \"s-\\t-&newsubdir/-\" | GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \ - git-update-index --index-info && + git update-index --index-info && mv \$GIT_INDEX_FILE.new \$GIT_INDEX_FILE" directorymoved && test -z "$(git diff HEAD directorymoved:newsubdir)"' diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 5d15449be5..a845930404 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -176,7 +176,7 @@ EOF test_expect_success \ 'listing tags with substring as pattern must print those matching' ' git-tag -l a > actual && - git-diff expect actual + git diff expect actual ' cat >expect < actual && - git-diff expect actual + git diff expect actual ' cat >expect < actual && - git-diff expect actual + git diff expect actual ' cat >expect < actual && - git-diff expect actual + git diff expect actual ' cat >expect < actual && - git-diff expect actual + git diff expect actual ' cat >expect < actual && - git-diff expect actual + git diff expect actual ' >expect test_expect_success \ 'listing tags using v.* should print nothing because none have v.' ' git-tag -l "v.*" > actual && - git-diff expect actual + git diff expect actual ' cat >expect < actual && - git-diff expect actual + git diff expect actual ' # creating and verifying lightweight tags: @@ -253,8 +253,8 @@ test_expect_success \ test_expect_success \ 'a non-annotated tag created without parameters should point to HEAD' ' git-tag non-annotated-tag && - test $(git-cat-file -t non-annotated-tag) = commit && - test $(git-rev-parse non-annotated-tag) = $(git-rev-parse HEAD) + test $(git cat-file -t non-annotated-tag) = commit && + test $(git rev-parse non-annotated-tag) = $(git rev-parse HEAD) ' test_expect_failure 'trying to verify an unknown tag should fail' \ @@ -475,7 +475,7 @@ echo '-----BEGIN PGP SIGNATURE-----' >>expect test_expect_success 'creating a signed tag with -m message should succeed' ' git-tag -s -m "A signed tag message" signed-tag && get_tag_msg signed-tag >actual && - git-diff expect actual + git diff expect actual ' test_expect_success 'verifying a signed tag should succeed' \ diff --git a/t/t7101-reset.sh b/t/t7101-reset.sh index a9191407f2..66d40430b2 100755 --- a/t/t7101-reset.sh +++ b/t/t7101-reset.sh @@ -10,7 +10,7 @@ test_expect_success \ 'creating initial files' \ 'mkdir path0 && cp ../../COPYING path0/COPYING && - git-add path0/COPYING && + git add path0/COPYING && git-commit -m add -a' test_expect_success \ @@ -21,10 +21,10 @@ test_expect_success \ cp ../../COPYING path1/COPYING && cp ../../COPYING COPYING && cp ../../COPYING path0/COPYING-TOO && - git-add path1/path2/COPYING && - git-add path1/COPYING && - git-add COPYING && - git-add path0/COPYING-TOO && + git add path1/path2/COPYING && + git add path1/COPYING && + git add COPYING && + git add path0/COPYING-TOO && git-commit -m change -a' test_expect_success \ diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index de70b38d1c..eb0847afe9 100755 --- a/t/t7300-clean.sh +++ b/t/t7300-clean.sh @@ -13,10 +13,10 @@ test_expect_success 'setup' ' touch src/part1.c Makefile && echo build >.gitignore && echo \*.o >>.gitignore && - git-add . && + git add . && git-commit -m setup && touch src/part2.c README && - git-add . + git add . ' @@ -141,7 +141,7 @@ test_expect_success 'git-clean -d -X' ' test_expect_success 'clean.requireForce' ' - git-config clean.requireForce true && + git config clean.requireForce true && ! git-clean ' diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 7a9b505b13..5e91db64e9 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -23,24 +23,24 @@ subcommands of git-submodule. test_expect_success 'Prepare submodule testing' ' mkdir lib && cd lib && - git-init && + git init && echo a >a && - git-add a && + git add a && git-commit -m "submodule commit 1" && git-tag -a -m "rev-1" rev-1 && - rev1=$(git-rev-parse HEAD) && + rev1=$(git rev-parse HEAD) && if test -z "$rev1" then - echo "[OOPS] submodule git-rev-parse returned nothing" + echo "[OOPS] submodule git rev-parse returned nothing" false fi && cd .. && echo a >a && echo z >z && - git-add a lib z && + git add a lib z && git-commit -m "super commit 1" && mv lib .subrepo && - GIT_CONFIG=.gitmodules git-config submodule.example.url git://example.com/lib.git + GIT_CONFIG=.gitmodules git config submodule.example.url git://example.com/lib.git ' test_expect_success 'status should fail for unmapped paths' ' @@ -48,9 +48,9 @@ test_expect_success 'status should fail for unmapped paths' ' then echo "[OOPS] submodule status succeeded" false - elif ! GIT_CONFIG=.gitmodules git-config submodule.example.path lib + elif ! GIT_CONFIG=.gitmodules git config submodule.example.path lib then - echo "[OOPS] git-config failed to update .gitmodules" + echo "[OOPS] git config failed to update .gitmodules" false fi ' @@ -66,12 +66,12 @@ test_expect_success 'status should initially be "missing"' ' test_expect_success 'init should register submodule url in .git/config' ' git-submodule init && - url=$(git-config submodule.example.url) && + url=$(git config submodule.example.url) && if test "$url" != "git://example.com/lib.git" then echo "[OOPS] init succeeded but submodule url is wrong" false - elif ! git-config submodule.example.url ./.subrepo + elif ! git config submodule.example.url ./.subrepo then echo "[OOPS] init succeeded but update of url failed" false @@ -113,7 +113,7 @@ test_expect_success 'update should work when path is an empty dir' ' rm -rf lib && mkdir lib && git-submodule update && - head=$(cd lib && git-rev-parse HEAD) && + head=$(cd lib && git rev-parse HEAD) && if test -z "$head" then echo "[OOPS] Failed to obtain submodule head" @@ -132,13 +132,13 @@ test_expect_success 'status should be "up-to-date" after update' ' test_expect_success 'status should be "modified" after submodule commit' ' cd lib && echo b >b && - git-add b && + git add b && git-commit -m "submodule commit 2" && - rev2=$(git-rev-parse HEAD) && + rev2=$(git rev-parse HEAD) && cd .. && if test -z "$rev2" then - echo "[OOPS] submodule git-rev-parse returned nothing" + echo "[OOPS] submodule git rev-parse returned nothing" false fi && git-submodule status | grep "^+$rev2" @@ -150,10 +150,10 @@ test_expect_success 'the --cached sha1 should be rev1' ' test_expect_success 'update should checkout rev1' ' git-submodule update && - head=$(cd lib && git-rev-parse HEAD) && + head=$(cd lib && git rev-parse HEAD) && if test -z "$head" then - echo "[OOPS] submodule git-rev-parse returned nothing" + echo "[OOPS] submodule git rev-parse returned nothing" false elif test "$head" != "$rev1" then diff --git a/t/t8001-annotate.sh b/t/t8001-annotate.sh index 3a6490e8f8..eabec2e06e 100755 --- a/t/t8001-annotate.sh +++ b/t/t8001-annotate.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-annotate' +test_description='git annotate' . ./test-lib.sh PROG='git annotate' diff --git a/t/t8002-blame.sh b/t/t8002-blame.sh index 9777393996..92ece30fa9 100755 --- a/t/t8002-blame.sh +++ b/t/t8002-blame.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git-blame' +test_description='git blame' . ./test-lib.sh PROG='git blame -c' diff --git a/t/t9100-git-svn-basic.sh b/t/t9100-git-svn-basic.sh index 70c3669ee8..614cf50d19 100755 --- a/t/t9100-git-svn-basic.sh +++ b/t/t9100-git-svn-basic.sh @@ -86,10 +86,10 @@ test_expect_failure "$name" " rm -f '$GIT_DIR'/index && git checkout -f -b mybranch3 remotes/git-svn && rm bar/zzz && - git-update-index --remove bar/zzz && + git update-index --remove bar/zzz && mkdir bar/zzz && echo yyy > bar/zzz/yyy && - git-update-index --add bar/zzz/yyy && + git update-index --add bar/zzz/yyy && git commit -m '$name' && git-svn set-tree --find-copies-harder --rmdir \ remotes/git-svn..mybranch3" || true @@ -191,8 +191,8 @@ GIT_SVN_ID=alt export GIT_SVN_ID test_expect_success "$name" \ "git-svn init $svnrepo && git-svn fetch && - git-rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a && - git-rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b && + git rev-list --pretty=raw remotes/git-svn | grep ^tree | uniq > a && + git rev-list --pretty=raw remotes/alt | grep ^tree | uniq > b && git diff a b" name='check imported tree checksums expected tree checksums' @@ -214,7 +214,7 @@ EOF test_expect_success "$name" "git diff a expected" test_expect_failure 'exit if remote refs are ambigious' " - git-config --add svn-remote.svn.fetch \ + git config --add svn-remote.svn.fetch \ bar:refs/remotes/git-svn && git-svn migrate " @@ -222,7 +222,7 @@ test_expect_failure 'exit if remote refs are ambigious' " test_expect_failure 'exit if init-ing a would clobber a URL' " svnadmin create ${PWD}/svnrepo2 && svn mkdir -m 'mkdir bar' ${svnrepo}2/bar && - git-config --unset svn-remote.svn.fetch \ + git config --unset svn-remote.svn.fetch \ '^bar:refs/remotes/git-svn$' && git-svn init ${svnrepo}2/bar " diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh index 35aa45cb9a..d8f9cab35d 100755 --- a/t/t9104-git-svn-follow-parent.sh +++ b/t/t9104-git-svn-follow-parent.sh @@ -30,31 +30,31 @@ test_expect_success 'initialize repo' " test_expect_success 'init and fetch a moved directory' " git-svn init --minimize-url -i thunk $svnrepo/thunk && git-svn fetch -i thunk && - test \"\`git-rev-parse --verify refs/remotes/thunk@2\`\" \ - = \"\`git-rev-parse --verify refs/remotes/thunk~1\`\" && - test \"\`git-cat-file blob refs/remotes/thunk:readme |\ + test \"\`git rev-parse --verify refs/remotes/thunk@2\`\" \ + = \"\`git rev-parse --verify refs/remotes/thunk~1\`\" && + test \"\`git cat-file blob refs/remotes/thunk:readme |\ sed -n -e '3p'\`\" = goodbye && - test -z \"\`git-config --get svn-remote.svn.fetch \ + test -z \"\`git config --get svn-remote.svn.fetch \ '^trunk:refs/remotes/thunk@2$'\`\" " test_expect_success 'init and fetch from one svn-remote' " - git-config svn-remote.svn.url $svnrepo && - git-config --add svn-remote.svn.fetch \ + git config svn-remote.svn.url $svnrepo && + git config --add svn-remote.svn.fetch \ trunk:refs/remotes/svn/trunk && - git-config --add svn-remote.svn.fetch \ + git config --add svn-remote.svn.fetch \ thunk:refs/remotes/svn/thunk && git-svn fetch -i svn/thunk && - test \"\`git-rev-parse --verify refs/remotes/svn/trunk\`\" \ - = \"\`git-rev-parse --verify refs/remotes/svn/thunk~1\`\" && - test \"\`git-cat-file blob refs/remotes/svn/thunk:readme |\ + test \"\`git rev-parse --verify refs/remotes/svn/trunk\`\" \ + = \"\`git rev-parse --verify refs/remotes/svn/thunk~1\`\" && + test \"\`git cat-file blob refs/remotes/svn/thunk:readme |\ sed -n -e '3p'\`\" = goodbye " test_expect_success 'follow deleted parent' " svn cp -m 'resurrecting trunk as junk' \ -r2 $svnrepo/trunk $svnrepo/junk && - git-config --add svn-remote.svn.fetch \ + git config --add svn-remote.svn.fetch \ junk:refs/remotes/svn/junk && git-svn fetch -i svn/thunk && git-svn fetch -i svn/junk && @@ -71,13 +71,13 @@ test_expect_success 'follow larger parent' " git-svn init --minimize-url -i larger \ $svnrepo/another-larger/trunk/thunk/bump/thud && git-svn fetch -i larger && - git-rev-parse --verify refs/remotes/larger && - git-rev-parse --verify \ + git rev-parse --verify refs/remotes/larger && + git rev-parse --verify \ refs/remotes/larger-parent/trunk/thunk/bump/thud && - test \"\`git-merge-base \ + test \"\`git merge-base \ refs/remotes/larger-parent/trunk/thunk/bump/thud \ refs/remotes/larger\`\" = \ - \"\`git-rev-parse refs/remotes/larger\`\" + \"\`git rev-parse refs/remotes/larger\`\" true " diff --git a/t/t9107-git-svn-migrate.sh b/t/t9107-git-svn-migrate.sh index d549665400..67fdf7023f 100755 --- a/t/t9107-git-svn-migrate.sh +++ b/t/t9107-git-svn-migrate.sh @@ -19,9 +19,9 @@ test_expect_success 'setup old-looking metadata' " mv $GIT_DIR/svn/* $GIT_DIR/ && mv $GIT_DIR/svn/.metadata $GIT_DIR/ && rmdir $GIT_DIR/svn && - git-update-ref refs/heads/git-svn-HEAD refs/remotes/git-svn && - git-update-ref refs/heads/svn-HEAD refs/remotes/git-svn && - git-update-ref -d refs/remotes/git-svn refs/remotes/git-svn + git update-ref refs/heads/git-svn-HEAD refs/remotes/git-svn && + git update-ref refs/heads/svn-HEAD refs/remotes/git-svn && + git update-ref -d refs/remotes/git-svn refs/remotes/git-svn " head=`git rev-parse --verify refs/heads/git-svn-HEAD^0` @@ -33,8 +33,8 @@ test_expect_success 'initialize old-style (v0) git-svn layout' " echo $svnrepo > $GIT_DIR/svn/info/url && git-svn migrate && ! test -d $GIT_DIR/git-svn && - git-rev-parse --verify refs/remotes/git-svn^0 && - git-rev-parse --verify refs/remotes/svn^0 && + git rev-parse --verify refs/remotes/git-svn^0 && + git rev-parse --verify refs/remotes/svn^0 && test \`git config --get svn-remote.svn.url\` = '$svnrepo' && test \`git config --get svn-remote.svn.fetch\` = \ ':refs/remotes/git-svn' @@ -42,20 +42,20 @@ test_expect_success 'initialize old-style (v0) git-svn layout' " test_expect_success 'initialize a multi-repository repo' " git-svn init $svnrepo -T trunk -t tags -b branches && - git-config --get-all svn-remote.svn.fetch > fetch.out && + git config --get-all svn-remote.svn.fetch > fetch.out && grep '^trunk:refs/remotes/trunk$' fetch.out && - test -n \"\`git-config --get svn-remote.svn.branches \ + test -n \"\`git config --get svn-remote.svn.branches \ '^branches/\*:refs/remotes/\*$'\`\" && - test -n \"\`git-config --get svn-remote.svn.tags \ + test -n \"\`git config --get svn-remote.svn.tags \ '^tags/\*:refs/remotes/tags/\*$'\`\" && git config --unset svn-remote.svn.branches \ '^branches/\*:refs/remotes/\*$' && git config --unset svn-remote.svn.tags \ '^tags/\*:refs/remotes/tags/\*$' && - git-config --add svn-remote.svn.fetch 'branches/a:refs/remotes/a' && - git-config --add svn-remote.svn.fetch 'branches/b:refs/remotes/b' && + git config --add svn-remote.svn.fetch 'branches/a:refs/remotes/a' && + git config --add svn-remote.svn.fetch 'branches/b:refs/remotes/b' && for i in tags/0.1 tags/0.2 tags/0.3; do - git-config --add svn-remote.svn.fetch \ + git config --add svn-remote.svn.fetch \ \$i:refs/remotes/\$i || exit 1; done " @@ -86,8 +86,8 @@ test_expect_success 'migrate --minimize on old inited layout' " echo $svnrepo\$path > $GIT_DIR/svn/\$ref/info/url ) || exit 1; done && git-svn migrate --minimize && - test -z \"\`git-config -l |grep -v '^svn-remote\.git-svn\.'\`\" && - git-config --get-all svn-remote.svn.fetch > fetch.out && + test -z \"\`git config -l |grep -v '^svn-remote\.git-svn\.'\`\" && + git config --get-all svn-remote.svn.fetch > fetch.out && grep '^trunk:refs/remotes/trunk$' fetch.out && grep '^branches/a:refs/remotes/a$' fetch.out && grep '^branches/b:refs/remotes/b$' fetch.out && diff --git a/t/t9110-git-svn-use-svm-props.sh b/t/t9110-git-svn-use-svm-props.sh index 59e17f2663..6235af4db8 100755 --- a/t/t9110-git-svn-use-svm-props.sh +++ b/t/t9110-git-svn-use-svm-props.sh @@ -13,7 +13,7 @@ test_expect_success 'load svm repo' " git-svn init --minimize-url -R argh -i dir $svnrepo/mirror/argh && git-svn init --minimize-url -R argh -i e \ $svnrepo/mirror/argh/a/b/c/d/e && - git-config svn.useSvmProps true && + git config svn.useSvmProps true && git-svn fetch --all " @@ -21,31 +21,31 @@ uuid=161ce429-a9dd-4828-af4a-52023f968c89 bar_url=http://mayonaise/svnrepo/bar test_expect_success 'verify metadata for /bar' " - git-cat-file commit refs/remotes/bar | \ + git cat-file commit refs/remotes/bar | \ grep '^git-svn-id: $bar_url@12 $uuid$' && - git-cat-file commit refs/remotes/bar~1 | \ + git cat-file commit refs/remotes/bar~1 | \ grep '^git-svn-id: $bar_url@11 $uuid$' && - git-cat-file commit refs/remotes/bar~2 | \ + git cat-file commit refs/remotes/bar~2 | \ grep '^git-svn-id: $bar_url@10 $uuid$' && - git-cat-file commit refs/remotes/bar~3 | \ + git cat-file commit refs/remotes/bar~3 | \ grep '^git-svn-id: $bar_url@9 $uuid$' && - git-cat-file commit refs/remotes/bar~4 | \ + git cat-file commit refs/remotes/bar~4 | \ grep '^git-svn-id: $bar_url@6 $uuid$' && - git-cat-file commit refs/remotes/bar~5 | \ + git cat-file commit refs/remotes/bar~5 | \ grep '^git-svn-id: $bar_url@1 $uuid$' " e_url=http://mayonaise/svnrepo/dir/a/b/c/d/e test_expect_success 'verify metadata for /dir/a/b/c/d/e' " - git-cat-file commit refs/remotes/e | \ + git cat-file commit refs/remotes/e | \ grep '^git-svn-id: $e_url@1 $uuid$' " dir_url=http://mayonaise/svnrepo/dir test_expect_success 'verify metadata for /dir' " - git-cat-file commit refs/remotes/dir | \ + git cat-file commit refs/remotes/dir | \ grep '^git-svn-id: $dir_url@2 $uuid$' && - git-cat-file commit refs/remotes/dir~1 | \ + git cat-file commit refs/remotes/dir~1 | \ grep '^git-svn-id: $dir_url@1 $uuid$' " diff --git a/t/t9111-git-svn-use-svnsync-props.sh b/t/t9111-git-svn-use-svnsync-props.sh index e52321471a..ec7dedd48b 100755 --- a/t/t9111-git-svn-use-svnsync-props.sh +++ b/t/t9111-git-svn-use-svnsync-props.sh @@ -12,7 +12,7 @@ test_expect_success 'load svnsync repo' " git-svn init --minimize-url -R arr -i bar $svnrepo/bar && git-svn init --minimize-url -R argh -i dir $svnrepo/dir && git-svn init --minimize-url -R argh -i e $svnrepo/dir/a/b/c/d/e && - git-config svn.useSvnsyncProps true && + git config svn.useSvnsyncProps true && git-svn fetch --all " @@ -20,31 +20,31 @@ uuid=161ce429-a9dd-4828-af4a-52023f968c89 bar_url=http://mayonaise/svnrepo/bar test_expect_success 'verify metadata for /bar' " - git-cat-file commit refs/remotes/bar | \ + git cat-file commit refs/remotes/bar | \ grep '^git-svn-id: $bar_url@12 $uuid$' && - git-cat-file commit refs/remotes/bar~1 | \ + git cat-file commit refs/remotes/bar~1 | \ grep '^git-svn-id: $bar_url@11 $uuid$' && - git-cat-file commit refs/remotes/bar~2 | \ + git cat-file commit refs/remotes/bar~2 | \ grep '^git-svn-id: $bar_url@10 $uuid$' && - git-cat-file commit refs/remotes/bar~3 | \ + git cat-file commit refs/remotes/bar~3 | \ grep '^git-svn-id: $bar_url@9 $uuid$' && - git-cat-file commit refs/remotes/bar~4 | \ + git cat-file commit refs/remotes/bar~4 | \ grep '^git-svn-id: $bar_url@6 $uuid$' && - git-cat-file commit refs/remotes/bar~5 | \ + git cat-file commit refs/remotes/bar~5 | \ grep '^git-svn-id: $bar_url@1 $uuid$' " e_url=http://mayonaise/svnrepo/dir/a/b/c/d/e test_expect_success 'verify metadata for /dir/a/b/c/d/e' " - git-cat-file commit refs/remotes/e | \ + git cat-file commit refs/remotes/e | \ grep '^git-svn-id: $e_url@1 $uuid$' " dir_url=http://mayonaise/svnrepo/dir test_expect_success 'verify metadata for /dir' " - git-cat-file commit refs/remotes/dir | \ + git cat-file commit refs/remotes/dir | \ grep '^git-svn-id: $dir_url@2 $uuid$' && - git-cat-file commit refs/remotes/dir~1 | \ + git cat-file commit refs/remotes/dir~1 | \ grep '^git-svn-id: $dir_url@1 $uuid$' " diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 72e49f5d3b..53774c8325 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -60,10 +60,10 @@ INPUT_END test_expect_success \ 'A: create pack from stdin' \ 'git-fast-import --export-marks=marks.out expect < $GIT_COMMITTER_DATE @@ -73,7 +73,7 @@ initial EOF test_expect_success \ 'A: verify commit' \ - 'git-cat-file commit master | sed 1d >actual && + 'git cat-file commit master | sed 1d >actual && git diff expect actual' cat >expect <expect <actual && + 'git cat-file -p master^{tree} | sed "s/ [0-9a-f]* / /" >actual && git diff expect actual' echo "$file2_data" >expect test_expect_success \ 'A: verify file2' \ - 'git-cat-file blob master:file2 >actual && git diff expect actual' + 'git cat-file blob master:file2 >actual && git diff expect actual' echo "$file3_data" >expect test_expect_success \ 'A: verify file3' \ - 'git-cat-file blob master:file3 >actual && git diff expect actual' + 'git cat-file blob master:file3 >actual && git diff expect actual' printf "$file4_data" >expect test_expect_success \ 'A: verify file4' \ - 'git-cat-file blob master:file4 >actual && git diff expect actual' + 'git cat-file blob master:file4 >actual && git diff expect actual' cat >expect <expect <actual +git diff-tree -M -r master verify--import-marks >actual test_expect_success \ 'A: verify diff' \ 'compare_diff_raw expect actual && - test `git-rev-parse --verify master:file2` \ - = `git-rev-parse --verify verify--import-marks:copy-of-file2`' + test `git rev-parse --verify master:file2` \ + = `git rev-parse --verify verify--import-marks:copy-of-file2`' ### ### series B @@ -175,7 +175,7 @@ rm -f .git/objects/pack_* .git/objects/index_* ### newf=`echo hi newf | git-hash-object -w --stdin` -oldf=`git-rev-parse --verify master:file2` +oldf=`git rev-parse --verify master:file2` test_tick cat >input <expect < $GIT_COMMITTER_DATE committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE @@ -211,7 +211,7 @@ second EOF test_expect_success \ 'C: verify commit' \ - 'git-cat-file commit branch | sed 1d >actual && + 'git cat-file commit branch | sed 1d >actual && git diff expect actual' cat >expect <expect <actual +git diff-tree -M -r master branch >actual test_expect_success \ 'C: validate rename result' \ 'compare_diff_raw expect actual' @@ -251,16 +251,16 @@ INPUT_END test_expect_success \ 'D: inline data in commit' \ 'git-fast-import expect <actual +git diff-tree -M -r branch^ branch >actual test_expect_success \ 'D: validate new files added' \ 'compare_diff_raw expect actual' @@ -268,13 +268,13 @@ test_expect_success \ echo "$file5_data" >expect test_expect_success \ 'D: verify file5' \ - 'git-cat-file blob branch:newdir/interesting >actual && + 'git cat-file blob branch:newdir/interesting >actual && git diff expect actual' echo "$file6_data" >expect test_expect_success \ 'D: verify file6' \ - 'git-cat-file blob branch:newdir/exec.sh >actual && + 'git cat-file blob branch:newdir/exec.sh >actual && git diff expect actual' ### @@ -300,7 +300,7 @@ test_expect_success \ 'git-fast-import --date-format=rfc2822 expect < 1170778938 -0500 @@ -310,14 +310,14 @@ RFC 2822 type date EOF test_expect_success \ 'E: verify commit' \ - 'git-cat-file commit branch | sed 1,2d >actual && + 'git cat-file commit branch | sed 1,2d >actual && git diff expect actual' ### ### series F ### -old_branch=`git-rev-parse --verify branch^0` +old_branch=`git rev-parse --verify branch^0` test_tick cat >input <expect < $GIT_COMMITTER_DATE committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE @@ -363,14 +363,14 @@ losing things already? EOF test_expect_success \ 'F: verify other commit' \ - 'git-cat-file commit other >actual && + 'git cat-file commit other >actual && git diff expect actual' ### ### series G ### -old_branch=`git-rev-parse --verify branch^0` +old_branch=`git rev-parse --verify branch^0` test_tick cat >input <expect <expect <actual +git diff-tree -M -r H^ H >actual test_expect_success \ 'H: validate old files removed, new files added' \ 'compare_diff_raw expect actual' @@ -441,7 +441,7 @@ test_expect_success \ echo "$file5_data" >expect test_expect_success \ 'H: verify file' \ - 'git-cat-file blob H:h/e/l/lo >actual && + 'git cat-file blob H:h/e/l/lo >actual && git diff expect actual' ### @@ -463,7 +463,7 @@ test_expect_success \ 'git-fast-import --export-pack-edges=edges.list expect <output && + git diff --raw L^ L >output && git diff expect output' test_done -- cgit v1.2.3 From 3cb567386d5d0349bfb5e3aaf85e973faf685dda Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 3 Jul 2007 16:01:06 +0100 Subject: diff --no-index: fix --name-status with added files Without this patch, an added file would be reported as /dev/null. Noticed by David Kastrup. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t4013-diff-various.sh | 2 ++ t/t4013/diff.diff_--name-status_dir2_dir | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 t/t4013/diff.diff_--name-status_dir2_dir (limited to 't') diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 8f4c29a6b5..4e7d68dda2 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -17,6 +17,7 @@ test_expect_success setup ' export GIT_AUTHOR_DATE GIT_COMMITTER_DATE && mkdir dir && + mkdir dir2 && for i in 1 2 3; do echo $i; done >file0 && for i in A B; do echo $i; done >dir/sub && cat file0 >file2 && @@ -252,6 +253,7 @@ diff --patch-with-stat initial..side diff --patch-with-raw initial..side diff --patch-with-stat -r initial..side diff --patch-with-raw -r initial..side +diff --name-status dir2 dir EOF test_done diff --git a/t/t4013/diff.diff_--name-status_dir2_dir b/t/t4013/diff.diff_--name-status_dir2_dir new file mode 100644 index 0000000000..ef7fdb7335 --- /dev/null +++ b/t/t4013/diff.diff_--name-status_dir2_dir @@ -0,0 +1,3 @@ +$ git diff --name-status dir2 dir +A dir/sub +$ -- cgit v1.2.3 From f6b78c6eb626d477b252d39ef2801d4670675a2b Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 3 Jul 2007 17:50:19 +0100 Subject: filter-branch: add a test for the commit removal example In the man page, there is an example which describes how to remove single commits (although it keeps the changes which were not reverted in the next non-removed commit). Better make sure that it works as expected. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7003-filter-branch.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 't') diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index 21f9bc5dd6..451ac861af 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -107,4 +107,39 @@ test_expect_success 'use index-filter to move into a subdirectory' ' mv \$GIT_INDEX_FILE.new \$GIT_INDEX_FILE" directorymoved && test -z "$(git diff HEAD directorymoved:newsubdir)"' +test_expect_success 'author information is preserved' ' + : > i && + git add i && + test_tick && + GIT_AUTHOR_NAME="B V Uips" git commit -m bvuips && + git-filter-branch --msg-filter "cat; \ + test \$GIT_COMMIT = $(git rev-parse master) && \ + echo Hallo" \ + preserved-author && + test 1 = $(git rev-list --author="B V Uips" preserved-author | wc -l) +' + +test_expect_success "remove a certain author's commits" ' + echo i > i && + test_tick && + git commit -m i i && + git-filter-branch --commit-filter "\ + if [ \"\$GIT_AUTHOR_NAME\" = \"B V Uips\" ];\ + then\ + shift;\ + while [ -n \"\$1\" ];\ + do\ + shift;\ + echo \"\$1\";\ + shift;\ + done;\ + else\ + git commit-tree \"\$@\";\ + fi" removed-author && + cnt1=$(git rev-list master | wc -l) && + cnt2=$(git rev-list removed-author | wc -l) && + test $cnt1 -eq $(($cnt2 + 1)) && + test 0 = $(git rev-list --author="B V Uips" removed-author | wc -l) +' + test_done -- cgit v1.2.3 From 586e4ce2487932b2ae770aad17d343b9021080e0 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Wed, 4 Jul 2007 14:06:04 +0200 Subject: Fix t5516 to create test repo without hooks Otherwise the hooks will be executed on cygwin and the test will fail because of the contributed hooks. Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- t/t5516-fetch-push.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index c0fa2ba404..ca46aafe72 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -11,7 +11,8 @@ mk_empty () { mkdir testrepo && ( cd testrepo && - git init + git init && + mv .git/hooks .git/hooks-disabled ) } -- cgit v1.2.3 From 1308c17b3e6bd3f5636f5b9bcadb2fbdf559009d Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Wed, 4 Jul 2007 22:09:10 +0200 Subject: Allow rebase to run if upstream is completely merged Consider this history: o--o-...-B <- origin \ \ x--x--M--x--x <- master In this situation, rebase considers master fully up-to-date and would not do anything. However, if there were additional commits on origin, the rebase would run and move the commits x on top of origin. Here we change rebase to short-circuit out only if the history since origin is strictly linear. Consequently, the above as well as a history like this would be linearized: o--o <- origin \ x--x \ \ x--M--x--x <- master Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t3400-rebase.sh | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index 95f3a2a556..62205b2531 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -12,7 +12,7 @@ This test runs git rebase and checks that the author information is not lost. export GIT_AUTHOR_EMAIL=bogus_email_address test_expect_success \ - 'prepare repository with topic branch, then rebase against master' \ + 'prepare repository with topic branches' \ 'echo First > A && git update-index --add A && git-commit -m "Add A." && @@ -24,11 +24,48 @@ test_expect_success \ echo Third >> A && git update-index A && git-commit -m "Modify A." && + git checkout -b side my-topic-branch && + echo Side >> C && + git add C && + git commit -m "Add C" && + git checkout -b nonlinear my-topic-branch && + echo Edit >> B && + git add B && + git commit -m "Modify B" && + git merge side && + git checkout -b upstream-merged-nonlinear && + git merge master && git checkout -f my-topic-branch && + git tag topic +' + +test_expect_success 'rebase against master' ' git rebase master' test_expect_failure \ 'the rebase operation should not have destroyed author information' \ 'git log | grep "Author:" | grep "<>"' +test_expect_success 'rebase after merge master' ' + git reset --hard topic && + git merge master && + git rebase master && + ! git show | grep "^Merge:" +' + +test_expect_success 'rebase of history with merges is linearized' ' + git checkout nonlinear && + test 4 = $(git rev-list master.. | wc -l) && + git rebase master && + test 3 = $(git rev-list master.. | wc -l) +' + +test_expect_success \ + 'rebase of history with merges after upstream merge is linearized' ' + git checkout upstream-merged-nonlinear && + test 5 = $(git rev-list master.. | wc -l) && + git rebase master && + test 3 = $(git rev-list master.. | wc -l) +' + test_done -- cgit v1.2.3 From 8c1ce0f46b85d40f215084eed7313896300082df Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 4 Jul 2007 15:36:01 +0100 Subject: filter-branch: fail gracefully when a filter fails A common mistake is to provide a filter which fails unwantedly. For example, this will stop in the middle: git filter-branch --env-filter ' test $GIT_COMMITTER_EMAIL = xyz && export GIT_COMMITTER_EMAIL = abc' rewritten When $GIT_COMMITTER_EMAIL is not "xyz", the test fails, and consequently the whole filter has a non-zero exit status. However, as demonstrated in this example, filter-branch would just stop, and the user would be none the wiser. Also, a failing msg-filter would not have been caught, as was the case with one of the tests. This patch fixes both issues, by paying attention to the exit status of msg-filter, and by saying what failed before exiting. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7003-filter-branch.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index 451ac861af..4ddd656e84 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -107,13 +107,19 @@ test_expect_success 'use index-filter to move into a subdirectory' ' mv \$GIT_INDEX_FILE.new \$GIT_INDEX_FILE" directorymoved && test -z "$(git diff HEAD directorymoved:newsubdir)"' +test_expect_success 'stops when msg filter fails' ' + ! git-filter-branch --msg-filter false nonono && + rm -rf .git-rewrite && + ! git rev-parse nonono +' + test_expect_success 'author information is preserved' ' : > i && git add i && test_tick && GIT_AUTHOR_NAME="B V Uips" git commit -m bvuips && git-filter-branch --msg-filter "cat; \ - test \$GIT_COMMIT = $(git rev-parse master) && \ + test \$GIT_COMMIT != $(git rev-parse master) || \ echo Hallo" \ preserved-author && test 1 = $(git rev-list --author="B V Uips" preserved-author | wc -l) -- cgit v1.2.3 From f258475a6ede3617ae768b69e33f78cbab8312de Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 6 Jul 2007 00:45:10 -0700 Subject: Per-path attribute based hunk header selection. This makes"diff -p" hunk headers customizable via gitattributes mechanism. It is based on Johannes's earlier patch that allowed to define a single regexp to be used for everything. The mechanism to arrive at the regexp that is used to define hunk header is the same as other use of gitattributes. You assign an attribute, funcname (because "diff -p" typically uses the name of the function the patch is about as the hunk header), a simple string value. This can be one of the names of built-in pattern (currently, "java" is defined) or a custom pattern name, to be looked up from the configuration file. (in .gitattributes) *.java funcname=java *.perl funcname=perl (in .git/config) [funcname] java = ... # ugly and complicated regexp to override the built-in one. perl = ... # another ugly and complicated regexp to define a new one. Signed-off-by: Junio C Hamano --- t/t4018-diff-funcname.sh | 60 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 t/t4018-diff-funcname.sh (limited to 't') diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh new file mode 100644 index 0000000000..dc7a47b3f1 --- /dev/null +++ b/t/t4018-diff-funcname.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# +# Copyright (c) 2007 Johannes E. Schindelin +# + +test_description='Test custom diff function name patterns' + +. ./test-lib.sh + +LF=' +' + +cat > Beer.java << EOF +public class Beer +{ + int special; + public static void main(String args[]) + { + String s=" "; + for(int x = 99; x > 0; x--) + { + System.out.print(x + " bottles of beer on the wall " + + x + " bottles of beer\n" + + "Take one down, pass it around, " + (x - 1) + + " bottles of beer on the wall.\n"); + } + System.out.print("Go to the store, buy some more,\n" + + "99 bottles of beer on the wall.\n"); + } +} +EOF + +sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java + +test_expect_success 'default behaviour' ' + git diff Beer.java Beer-correct.java | + grep "^@@.*@@ public class Beer" +' + +test_expect_success 'preset java pattern' ' + echo "*.java funcname=java" >.gitattributes && + git diff Beer.java Beer-correct.java | + grep "^@@.*@@ public static void main(" +' + +git config funcname.java '!static +!String +[^ ].*s.*' + +test_expect_success 'custom pattern' ' + git diff Beer.java Beer-correct.java | + grep "^@@.*@@ int special;$" +' + +test_expect_success 'last regexp must not be negated' ' + git config diff.functionnameregexp "!static" && + ! git diff Beer.java Beer-correct.java +' + +test_done -- cgit v1.2.3 From 150937c42591b0e9fb6c17f96c459d57b5f3bfdb Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 2 Jul 2007 12:14:49 +0100 Subject: Teach git-stash to "apply --index" When given this subcommand, git-stash will try to merge the stashed index into the current one. Only trivial merges are possible, since we have no index for the index ;-) If a trivial merge is not possible, git-stash will bail out with a hint to skip the --index option. For good measure, finally include a test case. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3903-stash.sh | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100755 t/t3903-stash.sh (limited to 't') diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh new file mode 100755 index 0000000000..392ac1c5c5 --- /dev/null +++ b/t/t3903-stash.sh @@ -0,0 +1,69 @@ +#!/bin/sh +# +# Copyright (c) 2007 Johannes E Schindelin +# + +test_description='Test git-stash' + +. ./test-lib.sh + +test_expect_success 'stash some dirty working directory' ' + echo 1 > file && + git add file && + test_tick && + git commit -m initial && + echo 2 > file && + git add file && + echo 3 > file && + test_tick && + git stash && + git diff-files --quiet && + git diff-index --cached --quiet HEAD +' + +cat > expect << EOF +diff --git a/file b/file +index 0cfbf08..00750ed 100644 +--- a/file ++++ b/file +@@ -1 +1 @@ +-2 ++3 +EOF + +test_expect_success 'parents of stash' ' + test $(git rev-parse stash^) = $(git rev-parse HEAD) && + git diff stash^2..stash > output && + diff -u output expect +' + +test_expect_success 'apply needs clean working directory' ' + echo 4 > other-file && + git add other-file && + echo 5 > other-file + ! git stash apply +' + +test_expect_success 'apply stashed changes' ' + git add other-file && + test_tick && + git commit -m other-file && + git stash apply && + test 3 = $(cat file) && + test 1 = $(git show :file) && + test 1 = $(git show HEAD:file) +' + +test_expect_success 'apply stashed changes (including index)' ' + git reset --hard HEAD^ && + echo 6 > other-file && + git add other-file && + test_tick && + git commit -m other-file && + git stash apply --index && + test 3 = $(cat file) && + test 2 = $(git show :file) && + test 1 = $(git show HEAD:file) +' + +test_done -- cgit v1.2.3 From b4372ef136b0a5a2c1dbd88a11dd72b478d0e0a5 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 6 Jul 2007 13:05:59 +0100 Subject: Enable "git rerere" by the config variable rerere.enabled Earlier, "git rerere" was enabled by creating the directory .git/rr-cache. That is definitely not in line with most other features, which are enabled by a config variable. So, check the config variable "rerere.enabled". If it is set to "false" explicitely, do not activate rerere, even if .git/rr-cache exists. This should help when you want to disable rerere temporarily. If "rerere.enabled" is not set at all, fall back to detection of the directory .git/rr-cache. [jc: with minimum tweaks] Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t4200-rerere.sh | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 't') diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh index 71d364ab79..6f55ba03bd 100755 --- a/t/t4200-rerere.sh +++ b/t/t4200-rerere.sh @@ -39,15 +39,32 @@ sed -e 's/To die, t/To die! T/' > a1 echo "* END *" >>a1 git commit -q -a -m second -# activate rerere -mkdir .git/rr-cache +test_expect_success 'nothing recorded without rerere' ' + (rm -rf .git/rr-cache; git config rerere.enabled false) && + ! git merge first && + ! test -d .git/rr-cache +' -test_expect_failure 'conflicting merge' 'git pull . first' +# activate rerere, old style +test_expect_success 'conflicting merge' ' + git reset --hard && + mkdir .git/rr-cache && + git config --unset rerere.enabled && + ! git merge first +' sha1=$(sed -e 's/ .*//' .git/rr-cache/MERGE_RR) rr=.git/rr-cache/$sha1 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 +' + test_expect_success 'no postimage or thisimage yet' \ "test ! -f $rr/postimage -a ! -f $rr/thisimage" -- cgit v1.2.3 From e0e324a4dc18a4341e1320a7cfac9733d81f8b0b Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 7 Jul 2007 01:49:58 -0700 Subject: Fix configuration syntax to specify customized hunk header patterns. This updates the hunk header customization syntax. The special case 'funcname' attribute is gone. You assign the name of the type of contents to path's "diff" attribute as a string value in .gitattributes like this: *.java diff=java *.perl diff=perl *.doc diff=doc If you supply "diff..funcname" variable via the configuration mechanism (e.g. in $HOME/.gitconfig), the value is used as the regexp set to find the line to use for the hunk header (the variable is called "funcname" because such a line typically is the one that has the name of the function in programming language source text). If there is no such configuration, built-in default is used, if any. Currently there are two default patterns: default and java. Signed-off-by: Junio C Hamano --- t/t4018-diff-funcname.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 't') diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh index dc7a47b3f1..f9db81d3ab 100644 --- a/t/t4018-diff-funcname.sh +++ b/t/t4018-diff-funcname.sh @@ -38,12 +38,12 @@ test_expect_success 'default behaviour' ' ' test_expect_success 'preset java pattern' ' - echo "*.java funcname=java" >.gitattributes && + echo "*.java diff=java" >.gitattributes && git diff Beer.java Beer-correct.java | grep "^@@.*@@ public static void main(" ' -git config funcname.java '!static +git config diff.java.funcname '!static !String [^ ].*s.*' @@ -53,7 +53,7 @@ test_expect_success 'custom pattern' ' ' test_expect_success 'last regexp must not be negated' ' - git config diff.functionnameregexp "!static" && + git config diff.java.funcname "!static" && ! git diff Beer.java Beer-correct.java ' -- cgit v1.2.3 From 5fda48d67c82e07950e0b0c21cd8c97daefd7be0 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 7 Jul 2007 18:50:39 +0100 Subject: Fix "apply --reverse" with regard to whitespace "git apply" used to take check the whitespace in the wrong direction. Noticed by Daniel Barkalow. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t4116-apply-reverse.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 't') diff --git a/t/t4116-apply-reverse.sh b/t/t4116-apply-reverse.sh index 2685b22630..11e02807a5 100755 --- a/t/t4116-apply-reverse.sh +++ b/t/t4116-apply-reverse.sh @@ -82,4 +82,10 @@ test_expect_success 'apply in reverse without postimage' ' ) ' +test_expect_success 'reversing a whitespace introduction' ' + sed "s/a/a /" < file1 > file1.new && + mv file1.new file1 && + git diff | git apply --reverse --whitespace=error +' + test_done -- cgit v1.2.3 From 2c3fa66f3577d1305fb0fac5a181261fb2597859 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 7 Jul 2007 12:25:11 -0700 Subject: diff: honor binariness specified in attributes The code shuffling mistakenly lost binariness specified with the attribute mecahnism and made it always guess from the data. Noticed by Johannes, with two test cases to t4020. Signed-off-by: Junio C Hamano --- t/t4020-diff-external.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 't') diff --git a/t/t4020-diff-external.sh b/t/t4020-diff-external.sh index f0045cd788..ed3bd5b3fe 100755 --- a/t/t4020-diff-external.sh +++ b/t/t4020-diff-external.sh @@ -94,4 +94,16 @@ test_expect_success 'diff attribute should apply only to diff' ' ' +test_expect_success 'no diff with -diff' ' + echo >.gitattributes "file -diff" && + git diff | grep Binary +' + +echo NULZbetweenZwords | tr Z '\0' > file + +test_expect_success 'force diff with "diff"' ' + echo >.gitattributes "file diff" && + git diff | grep -a second +' + test_done -- cgit v1.2.3 From 4017761fd89060f2b57d7799f6bbda8b3568d3d4 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sun, 8 Jul 2007 13:41:21 +0100 Subject: branch.autosetupmerge: allow boolean values, or "all" Junio noticed that switching on autosetupmerge unilaterally started cluttering the config for local branches. That is not the original intention of branch.autosetupmerge, which was meant purely for convenience when branching off of remote branches, but that semantics got lost somewhere. If you still want that "new" behavior, you can switch branch.autosetupmerge to the value "all". Otherwise, it is interpreted as a boolean, which triggers setting up defaults _only_ when branching off of a remote branch, i.e. the originally intended behavior. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3200-branch.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 't') diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index c6f472ac04..a19e961cb3 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -148,6 +148,15 @@ test_expect_success 'test tracking setup via config' \ test $(git config branch.my3.remote) = local && test $(git config branch.my3.merge) = refs/heads/master' +test_expect_success 'autosetupmerge = all' ' + git config branch.autosetupmerge true && + git branch all1 master && + test -z "$(git config branch.all1.merge)" && + git config branch.autosetupmerge all && + git branch all2 master && + test $(git config branch.all2.merge) = refs/heads/master +' + test_expect_success 'test overriding tracking setup via --no-track' \ 'git config branch.autosetupmerge true && git config remote.local.url . && -- cgit v1.2.3 From 797e99a27848a0f6da1f3c85cb3714652fde23ba Mon Sep 17 00:00:00 2001 From: Carlos Rica Date: Sun, 8 Jul 2007 21:36:34 +0200 Subject: t7004: Skip tests for signed tags in an old version of gpg. As said here: http://www.gnupg.org/documentation/faqs.html#q6.19 the gpg version 1.0.6 didn't parse trust packets correctly, so for that version, creation of signed tags using the generated key fails. Signed-off-by: Carlos Rica Acked-by: Sven Verdoolaege Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 't') diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index a845930404..b785080f9f 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -460,6 +460,17 @@ if [ $? -eq 127 ]; then exit fi +# As said here: http://www.gnupg.org/documentation/faqs.html#q6.19 +# the gpg version 1.0.6 didn't parse trust packets correctly, so for +# that version, creation of signed tags using the generated key fails. +case "$(gpg --version)" in +'gpg (GnuPG) 1.0.6'*) + echo "Skipping signed tag tests, because a bug in 1.0.6 version" + test_done + exit + ;; +esac + # key generation info: gpg --homedir t/t7004 --gen-key # Type DSA and Elgamal, size 2048 bits, no expiration date. # Name and email: C O Mitter -- cgit v1.2.3 From 18640d991bde7e081fb851cea5114c09472b188f Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sun, 8 Jul 2007 03:01:29 +0100 Subject: rebase -i: handle --continue more like non-interactive rebase Non-interactive rebase requires the working tree to be clean, but applies what is in the index without requiring the user to do it herself. Imitate that, but (since we are interactive, after all) fire up an editor with the commit message. It also fixes a subtle bug: a forgotten "continue" was removed, which led to an infinite loop when continuing without remaining patches. Both issues noticed by Frank Lichtenheld. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 883cf29595..c25133699a 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -63,7 +63,10 @@ test_expect_success 'setup' ' cat > fake-editor.sh << EOF #!/bin/sh -test "\$1" = .git/COMMIT_EDITMSG && exit +test "\$1" = .git/COMMIT_EDITMSG && { + test -z "\$FAKE_COMMIT_MESSAGE" || echo "\$FAKE_COMMIT_MESSAGE" > "\$1" + exit +} test -z "\$FAKE_LINES" && exit grep -v "^#" < "\$1" > "\$1".tmp rm "\$1" @@ -181,6 +184,7 @@ test_expect_success 'preserve merges with -p' ' echo C > file1 && test_tick && git commit -m K file1 && + test_tick && git rebase -i -p --onto branch1 master && test $(git rev-parse HEAD^^2) = $(git rev-parse to-be-preserved) && test $(git rev-parse HEAD~3) = $(git rev-parse branch1) && @@ -188,4 +192,14 @@ test_expect_success 'preserve merges with -p' ' test $(git show HEAD~2:file1) = B ' +test_expect_success '--continue tries to commit' ' + test_tick && + ! git rebase -i --onto new-branch1 HEAD^ && + echo resolved > file1 && + git add file1 && + FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue && + test $(git rev-parse HEAD^) = $(git rev-parse new-branch1) && + git show HEAD | grep chouette +' + test_done -- cgit v1.2.3 From 8e4a91bd780b89c7337f281a8601f2e0cae108fc Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sun, 8 Jul 2007 03:02:47 +0100 Subject: rebase -i: remember the settings of -v, -s and -p when interrupted After interruption, be that an edit, or a conflicting commit, reset the variables VERBOSE, STRATEGY and PRESERVE_MERGES, so that the user does not have to respecify them with "rebase --continue". Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index c25133699a..43a6675caa 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -202,4 +202,14 @@ test_expect_success '--continue tries to commit' ' git show HEAD | grep chouette ' +test_expect_success 'verbose flag is heeded, even after --continue' ' + git reset --hard HEAD@{1} && + test_tick && + ! git rebase -v -i --onto new-branch1 HEAD^ && + echo resolved > file1 && + git add file1 && + git rebase --continue > output && + grep "^ file1 | 2 +-$" output +' + test_done -- cgit v1.2.3 From f39a946a1fb0fa4856cd0027b9da3603a1b06fdc Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Mon, 9 Jul 2007 22:58:23 -0400 Subject: Support wholesale directory renames in fast-import Some source material (e.g. Subversion dump files) perform directory renames without telling us exactly which files in that subdirectory were moved. This makes it hard for a frontend to convert such data formats to a fast-import stream, as all the frontend has on hand is "Rename a/ to b/" with no details about what files are in a/, unless the frontend also kept track of all files. The new 'R' subcommand within a commit allows the frontend to rename either a file or an entire subdirectory, without needing to know the object's SHA-1 or the specific files contained within it. The rename is performed as efficiently as possible internally, making it cheaper than a 'D'/'M' pair for a file rename. Signed-off-by: Shawn O. Pearce --- t/t9300-fast-import.sh | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 't') diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 53774c8325..bf3720d762 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -580,4 +580,72 @@ test_expect_success \ git diff --raw L^ L >output && git diff expect output' +### +### series M +### + +test_tick +cat >input < $GIT_COMMITTER_DATE +data <expect <actual && + compare_diff_raw expect actual' + +cat >input < $GIT_COMMITTER_DATE +data <expect <actual && + compare_diff_raw expect actual' + +cat >input < $GIT_COMMITTER_DATE +data <expect <actual && + compare_diff_raw expect actual' + test_done -- cgit v1.2.3 From 52aaf649cb70134090c3e3a762bed730d5451c17 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 9 Jul 2007 14:47:24 +0100 Subject: rerere: record resolution even if file is not in merge base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two-file merges were rare enough that they were dropped outside of the radar. This fix is a trivial change to builtin-rerere.c::find_conflict(). It is still sane to insist that we do not do rerere for symlinks, and require to have stages #2 and #3, but we can drop the requirement to have stage #1. rerere does not use information from there anyway. This fix is from Junio, together with two tests to verify that it works as expected. Acked-by: Uwe Kleine-König Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t4200-rerere.sh | 44 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 't') diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh index 6f55ba03bd..cfcdb69dc8 100755 --- a/t/t4200-rerere.sh +++ b/t/t4200-rerere.sh @@ -116,11 +116,12 @@ test_expect_success 'commit succeeds' \ test_expect_success 'recorded postimage' "test -f $rr/postimage" -git checkout -b third master -git show second^:a1 | sed 's/To die: t/To die! T/' > a1 -git commit -q -a -m third - -test_expect_failure 'another conflicting merge' 'git pull . first' +test_expect_success 'another conflicting merge' ' + git checkout -b third master && + git show second^:a1 | sed "s/To die: t/To die! T/" > a1 && + git commit -q -a -m third && + ! git pull . first +' git show first:a1 | sed 's/To die: t/To die! T/' > expect test_expect_success 'rerere kicked in' "! grep ======= a1" @@ -164,4 +165,37 @@ test_expect_success 'garbage collection (part2)' 'git rerere gc' test_expect_success 'old records rest in peace' \ "test ! -f $rr/preimage && test ! -f $rr2/preimage" +test_expect_success 'file2 added differently in two branches' ' + git reset --hard && + git checkout -b fourth && + echo Hallo > file2 && + git add file2 && + git commit -m version1 && + git checkout third && + echo Bello > file2 && + git add file2 && + git commit -m version2 && + ! git merge fourth && + sha1=$(sed -e "s/ .*//" .git/rr-cache/MERGE_RR) && + rr=.git/rr-cache/$sha1 && + echo Cello > file2 && + git add file2 && + git commit -m resolution +' + +test_expect_success 'resolution was recorded properly' ' + git reset --hard HEAD~2 && + git checkout -b fifth && + echo Hallo > file3 && + git add file3 && + git commit -m version1 && + git checkout third && + echo Bello > file3 && + git add file3 && + git commit -m version2 && + ! git merge fifth && + git diff-files -q && + test Cello = "$(cat file3)" +' + test_done -- cgit v1.2.3 From 835252272e0192bd26983e22428480c5c89775fb Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 11 Jul 2007 15:18:17 +0100 Subject: Fix core.sharedRepository = 2 For compatibility reasons, "git init --shared=all" does not write "all" into the config, but a number. In the shared setup, you really have to support even older clients on the _same_ repository. But git_config_perm() did not pick up on it. Also, "git update-server-info" failed to pick up on the shared permissions. This patch fixes both issues, and adds a test to prove it. Signed-off-by: Johannes Schindelin Tested-by: martin f krafft Signed-off-by: Junio C Hamano --- t/t1301-shared-repo.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 t/t1301-shared-repo.sh (limited to 't') diff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh new file mode 100755 index 0000000000..bb5f30220a --- /dev/null +++ b/t/t1301-shared-repo.sh @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Copyright (c) 2007 Johannes Schindelin +# + +test_description='Test shared repository initialization' + +. ./test-lib.sh + +test_expect_success 'shared=all' ' + mkdir sub && + cd sub && + git init --shared=all && + test 2 = $(git config core.sharedrepository) +' + +test_expect_success 'update-server-info honors core.sharedRepository' ' + : > a1 && + git add a1 && + test_tick && + git commit -m a1 && + umask 0277 && + git update-server-info && + test 444 = $(stat -c %a .git/info/refs) +' + +test_done -- cgit v1.2.3 From 36d56de649aacdbf555d2c9743c514cc52368f2c Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 10 Jul 2007 14:50:49 +0100 Subject: Fix --cherry-pick with given paths If you say --cherry-pick, you do not want to see patches which are in the upstream. If you specify paths with that, what you usually expect is that only those parts of the patches are looked at which actually touch the given paths. With this patch, that expectation is met. Noticed by Sam Vilain. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t6007-rev-list-cherry-pick-file.sh | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 t/t6007-rev-list-cherry-pick-file.sh (limited to 't') diff --git a/t/t6007-rev-list-cherry-pick-file.sh b/t/t6007-rev-list-cherry-pick-file.sh new file mode 100755 index 0000000000..3faeae6c01 --- /dev/null +++ b/t/t6007-rev-list-cherry-pick-file.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +test_description='test git rev-list --cherry-pick -- file' + +. ./test-lib.sh + +# A---B +# \ +# \ +# C +# +# B changes a file foo.c, adding a line of text. C changes foo.c as +# well as bar.c, but the change in foo.c was identical to change B. + +test_expect_success setup ' + echo Hallo > foo && + git add foo && + test_tick && + git commit -m "A" && + git tag A && + git checkout -b branch && + echo Bello > foo && + echo Cello > bar && + git add foo bar && + test_tick && + git commit -m "C" && + git tag C && + git checkout master && + git checkout branch foo && + test_tick && + git commit -m "B" && + git tag B +' + +test_expect_success '--cherry-pick foo comes up empty' ' + test -z "$(git rev-list --left-right --cherry-pick B...C -- foo)" +' + +test_expect_success '--cherry-pick bar does not come up empty' ' + ! test -z "$(git rev-list --left-right --cherry-pick B...C -- bar)" +' + +test_done -- cgit v1.2.3 From defd53142e0c3326c3677cc3d623a6aeef899518 Mon Sep 17 00:00:00 2001 From: Carlos Rica Date: Tue, 10 Jul 2007 23:53:45 +0200 Subject: t0030: Remove repeated instructions and add missing && Moved some tests to another test_expect_success block. Many tests now reuse the same "expect" file. Also replacing many printf "" >expect with one >expect instruction. Added missing && which concatenated tests in some test_expect_success blocks. Signed-off-by: Carlos Rica Signed-off-by: Junio C Hamano --- t/t0030-stripspace.sh | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) (limited to 't') diff --git a/t/t0030-stripspace.sh b/t/t0030-stripspace.sh index fdc9fdce6f..4a2980c833 100755 --- a/t/t0030-stripspace.sh +++ b/t/t0030-stripspace.sh @@ -85,39 +85,36 @@ test_expect_success \ ' test_expect_success \ - 'consecutive blank lines at the beginning should be removed' ' - printf "" > expect && + 'only consecutive blank lines should be completely removed' ' + > expect && + printf "\n" | git stripspace >actual && git diff expect actual && - printf "" > expect && printf "\n\n\n" | git stripspace >actual && git diff expect actual && - printf "" > expect && printf "$sss\n$sss\n$sss\n" | git stripspace >actual && git diff expect actual && - printf "" > expect && printf "$sss$sss\n$sss\n\n" | git stripspace >actual && git diff expect actual && - printf "" > expect && printf "\n$sss\n$sss$sss\n" | git stripspace >actual && git diff expect actual && - printf "" > expect && printf "$sss$sss$sss$sss\n\n\n" | git stripspace >actual && git diff expect actual && - printf "" > expect && printf "\n$sss$sss$sss$sss\n\n" | git stripspace >actual && git diff expect actual && - printf "" > expect && printf "\n\n$sss$sss$sss$sss\n" | git stripspace >actual && - git diff expect actual && + git diff expect actual +' +test_expect_success \ + 'consecutive blank lines at the beginning should be removed' ' printf "$ttt\n" > expect && printf "\n$ttt\n" | git stripspace >actual && git diff expect actual && @@ -139,26 +136,22 @@ test_expect_success \ git diff expect actual && printf "$ttt\n" > expect && + printf "$sss\n$sss\n$sss\n$ttt\n" | git stripspace >actual && git diff expect actual && - printf "$ttt\n" > expect && printf "\n$sss\n$sss$sss\n$ttt\n" | git stripspace >actual && git diff expect actual && - printf "$ttt\n" > expect && printf "$sss$sss\n$sss\n\n$ttt\n" | git stripspace >actual && git diff expect actual && - printf "$ttt\n" > expect && printf "$sss$sss$sss\n\n\n$ttt\n" | git stripspace >actual && git diff expect actual && - printf "$ttt\n" > expect && printf "\n$sss$sss$sss\n\n$ttt\n" | git stripspace >actual && git diff expect actual && - printf "$ttt\n" > expect && printf "\n\n$sss$sss$sss\n$ttt\n" | git stripspace >actual && git diff expect actual ' @@ -186,26 +179,22 @@ test_expect_success \ git diff expect actual && printf "$ttt\n" > expect && + printf "$ttt\n$sss\n$sss\n$sss\n" | git stripspace >actual && git diff expect actual && - printf "$ttt\n" > expect && printf "$ttt\n\n$sss\n$sss$sss\n" | git stripspace >actual && git diff expect actual && - printf "$ttt\n" > expect && printf "$ttt\n$sss$sss\n$sss\n\n" | git stripspace >actual && git diff expect actual && - printf "$ttt\n" > expect && printf "$ttt\n$sss$sss$sss\n\n\n" | git stripspace >actual && git diff expect actual && - printf "$ttt\n" > expect && printf "$ttt\n\n$sss$sss$sss\n\n" | git stripspace >actual && git diff expect actual && - printf "$ttt\n" > expect && printf "$ttt\n\n\n$sss$sss$sss\n" | git stripspace >actual && git diff expect actual ' @@ -224,7 +213,7 @@ test_expect_success \ 'text plus spaces without newline at end should end with newline' ' test `printf "$ttt$sss" | git stripspace | wc -l` -gt 0 && test `printf "$ttt$ttt$sss" | git stripspace | wc -l` -gt 0 && - test `printf "$ttt$ttt$ttt$sss" | git stripspace | wc -l` -gt 0 + test `printf "$ttt$ttt$ttt$sss" | git stripspace | wc -l` -gt 0 && test `printf "$ttt$sss$sss" | git stripspace | wc -l` -gt 0 && test `printf "$ttt$ttt$sss$sss" | git stripspace | wc -l` -gt 0 && test `printf "$ttt$sss$sss$sss" | git stripspace | wc -l` -gt 0 @@ -340,13 +329,13 @@ test_expect_success \ printf "" >expect && printf "" | git stripspace >actual && - git diff expect actual + git diff expect actual && printf "$sss$sss" | git stripspace >actual && - git diff expect actual + git diff expect actual && printf "$sss$sss$sss" | git stripspace >actual && - git diff expect actual + git diff expect actual && printf "$sss$sss$sss$sss" | git stripspace >actual && git diff expect actual -- cgit v1.2.3 From b61a8a67478310eb3349d869119ce7a729090273 Mon Sep 17 00:00:00 2001 From: Carlos Rica Date: Tue, 10 Jul 2007 23:59:43 +0200 Subject: t0030: Add tests with consecutive text lines and others with spaces added. Previous tests only had paragraphs of one line. This commit adds some tests to check when many consecutive text lines are given. Also, it adds tests for checking that many lines between paragraphs are correctly reduced to one when there are tabs and spaces in those lines. Signed-off-by: Carlos Rica Signed-off-by: Junio C Hamano --- t/t0030-stripspace.sh | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 't') diff --git a/t/t0030-stripspace.sh b/t/t0030-stripspace.sh index 4a2980c833..b1c900379b 100755 --- a/t/t0030-stripspace.sh +++ b/t/t0030-stripspace.sh @@ -81,6 +81,30 @@ test_expect_success \ printf "$ttt\n\n$ttt$ttt$ttt\n" > expect && printf "$ttt\n\n\n\n\n$ttt$ttt$ttt\n" | git stripspace >actual && + git diff expect actual && + + printf "$ttt\n\n$ttt\n" > expect && + printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && + git diff expect actual && + + printf "$ttt$ttt\n\n$ttt\n" > expect && + printf "$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && + git diff expect actual && + + printf "$ttt$ttt$ttt\n\n$ttt\n" > expect && + printf "$ttt$ttt$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && + git diff expect actual && + + printf "$ttt\n\n$ttt\n" > expect && + printf "$ttt\n\t\n \n\n \t\t\n$ttt\n" | git stripspace >actual && + git diff expect actual && + + printf "$ttt\n\n$ttt$ttt\n" > expect && + printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt\n" | git stripspace >actual && + git diff expect actual && + + printf "$ttt\n\n$ttt$ttt$ttt\n" > expect && + printf "$ttt\n\t\n \n\n \t\t\n$ttt$ttt$ttt\n" | git stripspace >actual && git diff expect actual ' @@ -341,4 +365,31 @@ test_expect_success \ git diff expect actual ' +test_expect_success \ + 'consecutive text lines should be unchanged' ' + printf "$ttt$ttt\n$ttt\n" >expect && + printf "$ttt$ttt\n$ttt\n" | git stripspace >actual && + git diff expect actual && + + printf "$ttt\n$ttt$ttt\n$ttt\n" >expect && + printf "$ttt\n$ttt$ttt\n$ttt\n" | git stripspace >actual && + git diff expect actual && + + printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" >expect && + printf "$ttt\n$ttt\n$ttt\n$ttt$ttt\n" | git stripspace >actual && + git diff expect actual && + + printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" >expect && + printf "$ttt\n$ttt\n\n$ttt$ttt\n$ttt\n" | git stripspace >actual && + git diff expect actual && + + printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" >expect && + printf "$ttt$ttt\n\n$ttt\n$ttt$ttt\n" | git stripspace >actual && + git diff expect actual && + + printf "$ttt\n$ttt$ttt\n\n$ttt\n" >expect && + printf "$ttt\n$ttt$ttt\n\n$ttt\n" | git stripspace >actual && + git diff expect actual +' + test_done -- cgit v1.2.3 From 5206d13091a38b2fef534c78e893814dbab0af26 Mon Sep 17 00:00:00 2001 From: Carlos Rica Date: Wed, 11 Jul 2007 01:11:53 +0200 Subject: t7004: Add tests for the git tag -n option. These tests check the syntax for the git tag -n option and its output when one, none or many lines of the message are requested. Also this commit adds a missing && in the test that checks the sorted output of git tag -l. Signed-off-by: Carlos Rica Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 201 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index b785080f9f..17de2a90e6 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -164,7 +164,7 @@ test_expect_success 'listing all tags should print them ordered' ' git tag a1 && git tag v1.0 && git tag t210 && - git tag -l > actual + git tag -l > actual && git diff expect actual ' @@ -437,6 +437,106 @@ test_expect_success \ git diff expect actual ' +# listing messages for annotated non-signed tags: + +test_expect_success \ + 'listing the one-line message of a non-signed tag should succeed' ' + git-tag -m "A msg" tag-one-line && + + echo "tag-one-line" >expect && + git-tag -l | grep "^tag-one-line" >actual && + git diff expect actual && + git-tag -n 0 -l | grep "^tag-one-line" >actual && + git diff expect actual && + git-tag -n 0 -l tag-one-line >actual && + git diff expect actual && + + echo "tag-one-line A msg" >expect && + git-tag -n xxx -l | grep "^tag-one-line" >actual && + git diff expect actual && + git-tag -n "" -l | grep "^tag-one-line" >actual && + git diff expect actual && + git-tag -n 1 -l | grep "^tag-one-line" >actual && + git diff expect actual && + git-tag -n -l | grep "^tag-one-line" >actual && + git diff expect actual && + git-tag -n 1 -l tag-one-line >actual && + git diff expect actual && + git-tag -n 2 -l tag-one-line >actual && + git diff expect actual && + git-tag -n 999 -l tag-one-line >actual && + git diff expect actual +' + +test_expect_success \ + 'listing the zero-lines message of a non-signed tag should succeed' ' + git-tag -m "" tag-zero-lines && + + echo "tag-zero-lines" >expect && + git-tag -l | grep "^tag-zero-lines" >actual && + git diff expect actual && + git-tag -n 0 -l | grep "^tag-zero-lines" >actual && + git diff expect actual && + git-tag -n 0 -l tag-zero-lines >actual && + git diff expect actual && + + echo "tag-zero-lines " >expect && + git-tag -n 1 -l | grep "^tag-zero-lines" >actual && + git diff expect actual && + git-tag -n -l | grep "^tag-zero-lines" >actual && + git diff expect actual && + git-tag -n 1 -l tag-zero-lines >actual && + git diff expect actual && + git-tag -n 2 -l tag-zero-lines >actual && + git diff expect actual && + git-tag -n 999 -l tag-zero-lines >actual && + git diff expect actual +' + +echo 'tag line one' >annotagmsg +echo 'tag line two' >>annotagmsg +echo 'tag line three' >>annotagmsg +test_expect_success \ + 'listing many message lines of a non-signed tag should succeed' ' + git-tag -F annotagmsg tag-lines && + + echo "tag-lines" >expect && + git-tag -l | grep "^tag-lines" >actual && + git diff expect actual && + git-tag -n 0 -l | grep "^tag-lines" >actual && + git diff expect actual && + git-tag -n 0 -l tag-lines >actual && + git diff expect actual && + + echo "tag-lines tag line one" >expect && + git-tag -n 1 -l | grep "^tag-lines" >actual && + git diff expect actual && + git-tag -n -l | grep "^tag-lines" >actual && + git diff expect actual && + git-tag -n 1 -l tag-lines >actual && + git diff expect actual && + + echo " tag line two" >>expect && + git-tag -n 2 -l | grep "^ *tag.line" >actual && + git diff expect actual && + git-tag -n 2 -l tag-lines >actual && + git diff expect actual && + + echo " tag line three" >>expect && + git-tag -n 3 -l | grep "^ *tag.line" >actual && + git diff expect actual && + git-tag -n 3 -l tag-lines >actual && + git diff expect actual && + git-tag -n 4 -l | grep "^ *tag.line" >actual && + git diff expect actual && + git-tag -n 4 -l tag-lines >actual && + git diff expect actual && + git-tag -n 99 -l | grep "^ *tag.line" >actual && + git diff expect actual && + git-tag -n 99 -l tag-lines >actual && + git diff expect actual +' + # trying to verify annotated non-signed tags: test_expect_success \ @@ -651,6 +751,106 @@ test_expect_success \ git-tag -v commentnonlfile-signed-tag ' +# listing messages for signed tags: + +test_expect_success \ + 'listing the one-line message of a signed tag should succeed' ' + git-tag -s -m "A message line signed" stag-one-line && + + echo "stag-one-line" >expect && + git-tag -l | grep "^stag-one-line" >actual && + git diff expect actual && + git-tag -n 0 -l | grep "^stag-one-line" >actual && + git diff expect actual && + git-tag -n 0 -l stag-one-line >actual && + git diff expect actual && + + echo "stag-one-line A message line signed" >expect && + git-tag -n xxx -l | grep "^stag-one-line" >actual && + git diff expect actual && + git-tag -n "" -l | grep "^stag-one-line" >actual && + git diff expect actual && + git-tag -n 1 -l | grep "^stag-one-line" >actual && + git diff expect actual && + git-tag -n -l | grep "^stag-one-line" >actual && + git diff expect actual && + git-tag -n 1 -l stag-one-line >actual && + git diff expect actual && + git-tag -n 2 -l stag-one-line >actual && + git diff expect actual && + git-tag -n 999 -l stag-one-line >actual && + git diff expect actual +' + +test_expect_success \ + 'listing the zero-lines message of a signed tag should succeed' ' + git-tag -s -m "" stag-zero-lines && + + echo "stag-zero-lines" >expect && + git-tag -l | grep "^stag-zero-lines" >actual && + git diff expect actual && + git-tag -n 0 -l | grep "^stag-zero-lines" >actual && + git diff expect actual && + git-tag -n 0 -l stag-zero-lines >actual && + git diff expect actual && + + echo "stag-zero-lines " >expect && + git-tag -n 1 -l | grep "^stag-zero-lines" >actual && + git diff expect actual && + git-tag -n -l | grep "^stag-zero-lines" >actual && + git diff expect actual && + git-tag -n 1 -l stag-zero-lines >actual && + git diff expect actual && + git-tag -n 2 -l stag-zero-lines >actual && + git diff expect actual && + git-tag -n 999 -l stag-zero-lines >actual && + git diff expect actual +' + +echo 'stag line one' >sigtagmsg +echo 'stag line two' >>sigtagmsg +echo 'stag line three' >>sigtagmsg +test_expect_success \ + 'listing many message lines of a signed tag should succeed' ' + git-tag -s -F sigtagmsg stag-lines && + + echo "stag-lines" >expect && + git-tag -l | grep "^stag-lines" >actual && + git diff expect actual && + git-tag -n 0 -l | grep "^stag-lines" >actual && + git diff expect actual && + git-tag -n 0 -l stag-lines >actual && + git diff expect actual && + + echo "stag-lines stag line one" >expect && + git-tag -n 1 -l | grep "^stag-lines" >actual && + git diff expect actual && + git-tag -n -l | grep "^stag-lines" >actual && + git diff expect actual && + git-tag -n 1 -l stag-lines >actual && + git diff expect actual && + + echo " stag line two" >>expect && + git-tag -n 2 -l | grep "^ *stag.line" >actual && + git diff expect actual && + git-tag -n 2 -l stag-lines >actual && + git diff expect actual && + + echo " stag line three" >>expect && + git-tag -n 3 -l | grep "^ *stag.line" >actual && + git diff expect actual && + git-tag -n 3 -l stag-lines >actual && + git diff expect actual && + git-tag -n 4 -l | grep "^ *stag.line" >actual && + git diff expect actual && + git-tag -n 4 -l stag-lines >actual && + git diff expect actual && + git-tag -n 99 -l | grep "^ *stag.line" >actual && + git diff expect actual && + git-tag -n 99 -l stag-lines >actual && + git diff expect actual +' + # tags pointing to objects different from commits: tree=$(git rev-parse HEAD^{tree}) -- cgit v1.2.3 From 6f084a56fcb3543d88d252bb49c1d2bbf2bd0cf3 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 10 Jul 2007 18:50:44 +0100 Subject: branch --track: code cleanup and saner handling of local branches This patch cleans up some complicated code, and replaces it with a cleaner version, using code from remote.[ch], which got extended a little in the process. This also enables us to fix two cases: The earlier "fix" to setup tracking only when the original ref started with "refs/remotes" is wrong. You are absolutely allowed to use a separate layout for your tracking branches. The correct fix, of course, is to set up tracking information only when there is a matching remote..fetch line containing a colon. Another corner case was not handled properly. If two remotes write to the original ref, just warn the user and do not set up tracking. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3200-branch.sh | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 't') diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index a19e961cb3..ef1eeb7d8a 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -148,13 +148,14 @@ test_expect_success 'test tracking setup via config' \ test $(git config branch.my3.remote) = local && test $(git config branch.my3.merge) = refs/heads/master' -test_expect_success 'autosetupmerge = all' ' +test_expect_success 'avoid ambiguous track' ' git config branch.autosetupmerge true && + git config remote.ambi1.url = lalala && + git config remote.ambi1.fetch = refs/heads/lalala:refs/heads/master && + git config remote.ambi2.url = lilili && + git config remote.ambi2.fetch = refs/heads/lilili:refs/heads/master && git branch all1 master && - test -z "$(git config branch.all1.merge)" && - git config branch.autosetupmerge all && - git branch all2 master && - test $(git config branch.all2.merge) = refs/heads/master + test -z "$(git config branch.all1.merge)" ' test_expect_success 'test overriding tracking setup via --no-track' \ @@ -167,10 +168,10 @@ test_expect_success 'test overriding tracking setup via --no-track' \ ! test "$(git config branch.my2.remote)" = local && ! test "$(git config branch.my2.merge)" = refs/heads/master' -test_expect_success 'test local tracking setup' \ +test_expect_success 'no tracking without .fetch entries' \ 'git branch --track my6 s && - test $(git config branch.my6.remote) = . && - test $(git config branch.my6.merge) = refs/heads/s' + test -z "$(git config branch.my6.remote)" && + test -z "$(git config branch.my6.merge)"' test_expect_success 'test tracking setup via --track but deeper' \ 'git config remote.local.url . && @@ -182,8 +183,8 @@ test_expect_success 'test tracking setup via --track but deeper' \ test_expect_success 'test deleting branch deletes branch config' \ 'git branch -d my7 && - test "$(git config branch.my7.remote)" = "" && - test "$(git config branch.my7.merge)" = ""' + test -z "$(git config branch.my7.remote)" && + test -z "$(git config branch.my7.merge)"' test_expect_success 'test deleting branch without config' \ 'git branch my7 s && -- cgit v1.2.3 From ec0603e13c4e33c3a1501fe16f576db9aff1701a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 12 Jul 2007 01:04:16 -0700 Subject: Teach read-tree 2-way merge to ignore intermediate symlinks Earlier in 16a4c61, we taught "read-tree -m -u" not to be confused when switching from a branch that has a path frotz/filfre to another branch that has a symlink frotz that points at xyzzy/ directory. The fix was incomplete in that it was still confused when coming back (i.e. switching from a branch with frotz -> xyzzy/ to another branch with frotz/filfre). This fix is rather expensive in that for a path that is created we would need to see if any of the leading component of that path exists as a symbolic link in the filesystem (in which case, we know that path itself does not exist, and the fact we already decided to check it out tells us that in the index we already know that symbolic link is going away as there is no D/F conflict). Signed-off-by: Junio C Hamano --- t/t2007-checkout-symlink.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 t/t2007-checkout-symlink.sh (limited to 't') diff --git a/t/t2007-checkout-symlink.sh b/t/t2007-checkout-symlink.sh new file mode 100755 index 0000000000..0526fce163 --- /dev/null +++ b/t/t2007-checkout-symlink.sh @@ -0,0 +1,50 @@ +#!/bin/sh +# +# Copyright (c) 2007 Junio C Hamano + +test_description='git checkout to switch between branches with symlink<->dir' + +. ./test-lib.sh + +test_expect_success setup ' + + mkdir frotz && + echo hello >frotz/filfre && + git add frotz/filfre && + test_tick && + git commit -m "master has file frotz/filfre" && + + git branch side && + + echo goodbye >nitfol && + git add nitfol + test_tick && + git commit -m "master adds file nitfol" && + + git checkout side && + + git rm --cached frotz/filfre && + mv frotz xyzzy && + ln -s xyzzy frotz && + git add xyzzy/filfre frotz && + test_tick && + git commit -m "side moves frotz/ to xyzzy/ and adds frotz->xyzzy/" + +' + +test_expect_success 'switch from symlink to dir' ' + + git checkout master + +' + +rm -fr frotz xyzzy nitfol && +git checkout -f master || exit + +test_expect_success 'switch from dir to symlink' ' + + git checkout side + +' + +test_done -- cgit v1.2.3 From bdecd9d41b3528e17aea2290344c584412e2424e Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Fri, 13 Jul 2007 19:41:38 +0200 Subject: More permissive "git-rm --cached" behavior without -f. In the previous behavior, "git-rm --cached" (without -f) had the same restriction as "git-rm". This forced the user to use the -f flag in situations which weren't actually dangerous, like: $ git add foo # oops, I didn't want this $ git rm --cached foo # back to initial situation Previously, the index had to match the file *and* the HEAD. With --cached, the index must now match the file *or* the HEAD. The behavior without --cached is unchanged, but provides better error messages. Signed-off-by: Matthieu Moy Signed-off-by: Junio C Hamano --- t/t3600-rm.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 't') diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index 13a461f31b..5c001aa489 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -45,6 +45,40 @@ test_expect_success \ 'Test that git rm foo succeeds' \ 'git rm --cached foo' +test_expect_success \ + 'Test that git rm --cached foo succeeds if the index matches the file' \ + 'echo content > foo + git add foo + git rm --cached foo' + +test_expect_success \ + 'Test that git rm --cached foo succeeds if the index matches the file' \ + 'echo content > foo + git add foo + git commit -m foo + echo "other content" > foo + git rm --cached foo' + +test_expect_failure \ + 'Test that git rm --cached foo fails if the index matches neither the file nor HEAD' \ + 'echo content > foo + git add foo + git commit -m foo + echo "other content" > foo + git add foo + echo "yet another content" > foo + git rm --cached foo' + +test_expect_success \ + 'Test that git rm --cached -f foo works in case where --cached only did not' \ + 'echo content > foo + git add foo + git commit -m foo + echo "other content" > foo + git add foo + echo "yet another content" > foo + git rm --cached -f foo' + test_expect_success \ 'Post-check that foo exists but is not in index after git rm foo' \ '[ -f foo ] && ! git ls-files --error-unmatch foo' -- cgit v1.2.3 From b6f3481bb456acbbb990a1045344bb06e5a40283 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sun, 15 Jul 2007 01:40:37 -0400 Subject: Teach fast-import to recursively copy files/directories Some source material (e.g. Subversion dump files) perform directory renames by telling us the directory was copied, then deleted in the same revision. This makes it difficult for a frontend to convert such data formats to a fast-import stream, as all the frontend has on hand is "Copy a/ to b/; Delete a/" with no details about what files are in a/, unless the frontend also kept track of all files. The new 'C' subcommand within a commit allows the frontend to make a recursive copy of one path to another path within the branch, without needing to keep track of the individual file paths. The metadata copy is performed in memory efficiently, but is implemented as a copy-immediately operation, rather than copy-on-write. With this new 'C' subcommand frontends could obviously implement an 'R' (rename) on their own as a combination of 'C' and 'D' (delete), but since we have already offered up 'R' in the past and it is a trivial thing to keep implemented I'm not going to deprecate it. Signed-off-by: Shawn O. Pearce --- t/t9300-fast-import.sh | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) (limited to 't') diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index bf3720d762..4b920be331 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -648,4 +648,87 @@ test_expect_success \ git diff-tree -M -r M3^ M3 >actual && compare_diff_raw expect actual' +### +### series N +### + +test_tick +cat >input < $GIT_COMMITTER_DATE +data <expect <actual && + compare_diff_raw expect actual' + +cat >input < $GIT_COMMITTER_DATE +data < $GIT_COMMITTER_DATE +data <expect <actual && + compare_diff_raw expect actual' + +cat >input < $GIT_COMMITTER_DATE +data < Date: Sat, 14 Jul 2007 12:51:44 -0500 Subject: Use $(RM) in Makefiles instead of 'rm -f' Signed-off-by: Emil Medve Signed-off-by: Junio C Hamano --- t/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/Makefile b/t/Makefile index b25caca887..72d7884232 100644 --- a/t/Makefile +++ b/t/Makefile @@ -6,6 +6,7 @@ #GIT_TEST_OPTS=--verbose --debug SHELL_PATH ?= $(SHELL) TAR ?= $(TAR) +RM ?= rm -f # Shell quote; SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) @@ -19,7 +20,7 @@ $(T): @echo "*** $@ ***"; GIT_CONFIG=.git/config '$(SHELL_PATH_SQ)' $@ $(GIT_TEST_OPTS) clean: - rm -fr trash + $(RM) -r trash # we can test NO_OPTIMIZE_COMMITS independently of LC_ALL full-svn-test: -- cgit v1.2.3 From 29633bb91c7bcff31ff3bb59378709e3e3ef627d Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 15 Jul 2007 21:53:50 -0700 Subject: git-svn: fix commiting renames over DAV with funky file names Renaming files with non-URI friendly characters caused breakage when committing to DAV repositories (over http(s)). Even if I try leaving out the $self->{url} from the return value of url_path(), a partial (without host), unescaped path name does not work. Filenames for DAV repos need to be URI-encoded before being passed to the library. Since this bug did not affect file:// and svn:// repos, the git-svn test library needed to be expanded to include support for starting Apache with mod_dav_svn enabled. This new test is not enabled by default, but can be enabled by setting SVN_HTTPD_PORT to any available TCP/IP port on 127.0.0.1. Additionally, for running this test, the following variables (with defaults shown) can be changed for the suitable system. The default values are set for Debian systems: SVN_HTTPD_MODULE_PATH=/usr/lib/apache2/modules SVN_HTTPD_PATH=/usr/sbin/apache2 Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/lib-git-svn.sh | 34 ++++++++++ t/t9115-git-svn-dcommit-funky-renames.sh | 54 ++++++++++++++++ t/t9115/funky-names.dump | 103 +++++++++++++++++++++++++++++++ 3 files changed, 191 insertions(+) create mode 100755 t/t9115-git-svn-dcommit-funky-renames.sh create mode 100644 t/t9115/funky-names.dump (limited to 't') diff --git a/t/lib-git-svn.sh b/t/lib-git-svn.sh index f6fe78cd27..8d4a447213 100644 --- a/t/lib-git-svn.sh +++ b/t/lib-git-svn.sh @@ -48,3 +48,37 @@ svnrepo="file://$svnrepo" poke() { test-chmtime +1 "$1" } + +SVN_HTTPD_MODULE_PATH=${SVN_HTTPD_MODULE_PATH-'/usr/lib/apache2/modules'} +SVN_HTTPD_PATH=${SVN_HTTPD_PATH-'/usr/sbin/apache2'} + +start_httpd () { + if test -z "$SVN_HTTPD_PORT" + then + echo >&2 'SVN_HTTPD_PORT is not defined!' + return + fi + + mkdir "$GIT_DIR"/logs + + cat > "$GIT_DIR/httpd.conf" < + DAV svn + SVNPath $rawsvnrepo + +EOF + "$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k start + svnrepo=http://127.0.0.1:$SVN_HTTPD_PORT/svn +} + +stop_httpd () { + test -z "$SVN_HTTPD_PORT" && return + "$SVN_HTTPD_PATH" -f "$GIT_DIR"/httpd.conf -k stop +} diff --git a/t/t9115-git-svn-dcommit-funky-renames.sh b/t/t9115-git-svn-dcommit-funky-renames.sh new file mode 100755 index 0000000000..182299cbb5 --- /dev/null +++ b/t/t9115-git-svn-dcommit-funky-renames.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# +# Copyright (c) 2007 Eric Wong + + +test_description='git-svn dcommit can commit renames of files with ugly names' + +. ./lib-git-svn.sh + +test_expect_success 'load repository with strange names' " + svnadmin load -q $rawsvnrepo < ../t9115/funky-names.dump && + start_httpd + " + +test_expect_success 'init and fetch repository' " + git svn init $svnrepo && + git svn fetch && + git reset --hard git-svn + " + +test_expect_success 'create file in existing ugly and empty dir' ' + mkdir "#{bad_directory_name}" && + echo hi > "#{bad_directory_name}/ foo" && + git update-index --add "#{bad_directory_name}/ foo" && + git commit -m "new file in ugly parent" && + git svn dcommit + ' + +test_expect_success 'rename ugly file' ' + git mv "#{bad_directory_name}/ foo" "file name with feces" && + git commit -m "rename ugly file" && + git svn dcommit + ' + +test_expect_success 'rename pretty file' ' + echo :x > pretty && + git update-index --add pretty && + git commit -m "pretty :x" && + git svn dcommit && + mkdir regular_dir_name && + git mv pretty regular_dir_name/pretty && + git commit -m "moved pretty file" && + git svn dcommit + ' + +test_expect_success 'rename pretty file into ugly one' ' + git mv regular_dir_name/pretty "#{bad_directory_name}/ booboo" && + git commit -m booboo && + git svn dcommit + ' + +stop_httpd + +test_done diff --git a/t/t9115/funky-names.dump b/t/t9115/funky-names.dump new file mode 100644 index 0000000000..42422f791e --- /dev/null +++ b/t/t9115/funky-names.dump @@ -0,0 +1,103 @@ +SVN-fs-dump-format-version: 2 + +UUID: 819c44fe-2bcc-4066-88e4-985e2bc0b418 + +Revision-number: 0 +Prop-content-length: 56 +Content-length: 56 + +K 8 +svn:date +V 27 +2007-07-12T07:54:26.062914Z +PROPS-END + +Revision-number: 1 +Prop-content-length: 152 +Content-length: 152 + +K 7 +svn:log +V 44 +what will those wacky people think of next? + +K 10 +svn:author +V 12 +normalperson +K 8 +svn:date +V 27 +2007-07-12T08:00:05.011573Z +PROPS-END + +Node-path: leading space +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: leading space file +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 5 +Text-content-md5: e4fa20c67542cdc21271e08d329397ab +Content-length: 15 + +PROPS-END +ugly + + +Node-path: #{bad_directory_name} +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: #{cool_name} +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 18 +Text-content-md5: 87dac40ca337dfa3dcc8911388c3ddda +Content-length: 28 + +PROPS-END +strange name here + + +Node-path: dir name with spaces +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END + + +Node-path: file name with spaces +Node-kind: file +Node-action: add +Prop-content-length: 10 +Text-content-length: 7 +Text-content-md5: c1f10cfd640618484a2a475c11410fd3 +Content-length: 17 + +PROPS-END +spaces + + +Node-path: regular_dir_name +Node-kind: dir +Node-action: add +Prop-content-length: 10 +Content-length: 10 + +PROPS-END -- cgit v1.2.3 From 0cf7375542504e3762753cdc4cff3bb5c8fc628e Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Tue, 17 Jul 2007 20:28:28 +0200 Subject: unpack-trees.c: assume submodules are clean during check-out In particular, when moving back to a commit without a given submodule and then moving back forward to a commit with the given submodule, we shouldn't complain that updating would lose untracked file in the submodule, because git currently does not checkout subprojects during superproject check-out. Signed-off-by: Sven Verdoolaege Signed-off-by: Junio C Hamano --- t/t7400-submodule-basic.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 't') diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 5e91db64e9..e8ce7cdb83 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -21,6 +21,10 @@ subcommands of git-submodule. # -add an entry to .gitmodules for submodule 'example' # test_expect_success 'Prepare submodule testing' ' + : > t && + git-add t && + git-commit -m "initial commit" && + git branch initial HEAD && mkdir lib && cd lib && git init && @@ -166,4 +170,9 @@ test_expect_success 'status should be "up-to-date" after update' ' git-submodule status | grep "^ $rev1" ' +test_expect_success 'checkout superproject with subproject already present' ' + git-checkout initial && + git-checkout master +' + test_done -- cgit v1.2.3 From ef0c2abf3e5061f891b7f07953ef3b0695f52c89 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Thu, 19 Jul 2007 22:09:35 -0700 Subject: Add GIT_EDITOR environment and core.editor configuration variables These variables let you specify an editor that will be launched in preference to the EDITOR and VISUAL environment variables. The order of preference is GIT_EDITOR, core.editor, EDITOR, VISUAL. [jc: added a test and config variable documentation] Signed-off-by: Adam Roben Signed-off-by: Junio C Hamano --- t/t7005-editor.sh | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100755 t/t7005-editor.sh (limited to 't') diff --git a/t/t7005-editor.sh b/t/t7005-editor.sh new file mode 100755 index 0000000000..28643b0da4 --- /dev/null +++ b/t/t7005-editor.sh @@ -0,0 +1,91 @@ +#!/bin/sh + +test_description='GIT_EDITOR, core.editor, and stuff' + +. ./test-lib.sh + +for i in GIT_EDITOR core_editor EDITOR VISUAL vi +do + cat >e-$i.sh <<-EOF + echo "Edited by $i" >"\$1" + EOF + chmod +x e-$i.sh +done +unset vi +mv e-vi.sh vi +PATH=".:$PATH" +unset EDITOR VISUAL GIT_EDITOR + +test_expect_success setup ' + + msg="Hand edited" && + echo "$msg" >expect && + git add vi && + test_tick && + git commit -m "$msg" && + git show -s --pretty=oneline | + sed -e "s/^[0-9a-f]* //" >actual && + diff actual expect + +' + +TERM=dumb +export TERM +test_expect_success 'dumb should error out when falling back on vi' ' + + if git commit --amend + then + echo "Oops?" + exit 1 + else + : happy + fi +' + +TERM=vt100 +export TERM +for i in vi EDITOR VISUAL core_editor GIT_EDITOR +do + echo "Edited by $i" >expect + unset EDITOR VISUAL GIT_EDITOR + git config --unset-all core.editor + case "$i" in + core_editor) + git config core.editor ./e-core_editor.sh + ;; + [A-Z]*) + eval "$i=./e-$i.sh" + export $i + ;; + esac + test_expect_success "Using $i" ' + git commit --amend && + git show -s --pretty=oneline | + sed -e "s/^[0-9a-f]* //" >actual && + diff actual expect + ' +done + +unset EDITOR VISUAL GIT_EDITOR +git config --unset-all core.editor +for i in vi EDITOR VISUAL core_editor GIT_EDITOR +do + echo "Edited by $i" >expect + case "$i" in + core_editor) + git config core.editor ./e-core_editor.sh + ;; + [A-Z]*) + eval "$i=./e-$i.sh" + export $i + ;; + esac + test_expect_success "Using $i (override)" ' + git commit --amend && + git show -s --pretty=oneline | + sed -e "s/^[0-9a-f]* //" >actual && + diff actual expect + ' +done + +test_done -- cgit v1.2.3 From 62e09ce998dd7f6b844deb650101c743a5c4ce50 Mon Sep 17 00:00:00 2001 From: Carlos Rica Date: Fri, 20 Jul 2007 01:42:28 +0200 Subject: Make git tag a builtin. This replaces the script "git-tag.sh" with "builtin-tag.c". The existing test suite for "git tag" guarantees the compatibility with the features provided by the script version. There are some minor changes in the behaviour of "git tag" here: "git tag -v" now can get more than one tag to verify, like "git tag -d" does, "git tag" with no arguments prints all tags, more like "git branch" does, and "git tag -n" also prints all tags with annotations (without needing -l). Tests and documentation were also updated to reflect these changes. The program is currently calling the script "git verify-tag" for verify. This can be changed porting it to C and calling its functions directly from builtin-tag.c. Signed-off-by: Carlos Rica Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 79 insertions(+), 9 deletions(-) (limited to 't') diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 17de2a90e6..a0be164619 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -5,7 +5,7 @@ test_description='git-tag -Basic tests for operations with tags.' +Tests for operations with tags.' . ./test-lib.sh @@ -16,11 +16,15 @@ tag_exists () { } # todo: git tag -l now returns always zero, when fixed, change this test -test_expect_success 'listing all tags in an empty tree should succeed' \ - 'git tag -l' +test_expect_success 'listing all tags in an empty tree should succeed' ' + git tag -l && + git tag +' -test_expect_success 'listing all tags in an empty tree should output nothing' \ - 'test `git-tag -l | wc -l` -eq 0' +test_expect_success 'listing all tags in an empty tree should output nothing' ' + test `git-tag -l | wc -l` -eq 0 && + test `git-tag | wc -l` -eq 0 +' test_expect_failure 'looking for a tag in an empty tree should fail' \ 'tag_exists mytag' @@ -49,11 +53,15 @@ test_expect_success 'creating a tag using default HEAD should succeed' ' git tag mytag ' -test_expect_success 'listing all tags if one exists should succeed' \ - 'git-tag -l' +test_expect_success 'listing all tags if one exists should succeed' ' + git-tag -l && + git-tag +' -test_expect_success 'listing all tags if one exists should output that tag' \ - 'test `git-tag -l` = mytag' +test_expect_success 'listing all tags if one exists should output that tag' ' + test `git-tag -l` = mytag && + test `git-tag` = mytag +' # pattern matching: @@ -165,6 +173,8 @@ test_expect_success 'listing all tags should print them ordered' ' git tag v1.0 && git tag t210 && git tag -l > actual && + git diff expect actual && + git tag > actual && git diff expect actual ' @@ -264,6 +274,10 @@ test_expect_failure \ 'trying to verify a non-annotated and non-signed tag should fail' \ 'git-tag -v non-annotated-tag' +test_expect_failure \ + 'trying to verify many non-annotated or unknown tags, should fail' \ + 'git-tag -v unknown-tag1 non-annotated-tag unknown-tag2' + # creating annotated tags: get_tag_msg () { @@ -306,6 +320,18 @@ test_expect_success \ git diff expect actual ' +cat >inputmsg <expect +cat inputmsg >>expect +test_expect_success 'creating an annotated tag with -F - should succeed' ' + git-tag -F - stdin-annotated-tag actual && + git diff expect actual +' + # blank and empty messages: get_tag_header empty-annotated-tag $commit commit $time >expect @@ -551,6 +577,12 @@ test_expect_success \ ! git-tag -v file-annotated-tag ' +test_expect_success \ + 'trying to verify two annotated non-signed tags should fail' ' + tag_exists annotated-tag file-annotated-tag && + ! git-tag -v annotated-tag file-annotated-tag +' + # creating and verifying signed tags: gpg --version >/dev/null @@ -589,9 +621,47 @@ test_expect_success 'creating a signed tag with -m message should succeed' ' git diff expect actual ' +cat >sigmsgfile <expect +cat sigmsgfile >>expect +echo '-----BEGIN PGP SIGNATURE-----' >>expect +test_expect_success \ + 'creating a signed tag with -F messagefile should succeed' ' + git-tag -s -F sigmsgfile file-signed-tag && + get_tag_msg file-signed-tag >actual && + git diff expect actual +' + +cat >siginputmsg <expect +cat siginputmsg >>expect +echo '-----BEGIN PGP SIGNATURE-----' >>expect +test_expect_success 'creating a signed tag with -F - should succeed' ' + git-tag -s -F - stdin-signed-tag actual && + git diff expect actual +' + test_expect_success 'verifying a signed tag should succeed' \ 'git-tag -v signed-tag' +test_expect_success 'verifying two signed tags in one command should succeed' \ + 'git-tag -v signed-tag file-signed-tag' + +test_expect_success \ + 'verifying many signed and non-signed tags should fail' ' + ! git-tag -v signed-tag annotated-tag && + ! git-tag -v file-annotated-tag file-signed-tag && + ! git-tag -v annotated-tag file-signed-tag file-annotated-tag && + ! git-tag -v signed-tag annotated-tag file-signed-tag +' + test_expect_success 'verifying a forged tag should fail' ' forged=$(git cat-file tag signed-tag | sed -e "s/signed-tag/forged-tag/" | -- cgit v1.2.3 From 6368f3f8e701cb080b83ceb8ee622636046c514c Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 21 Jul 2007 18:09:41 +0100 Subject: rebase -i: call editor just once for a multi-squash Sometimes you want to squash more than two commits. Before this patch, the editor was fired up for each squash command. Now the editor is started only with the last squash command. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 43a6675caa..8206436cc7 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -65,6 +65,7 @@ cat > fake-editor.sh << EOF #!/bin/sh test "\$1" = .git/COMMIT_EDITMSG && { test -z "\$FAKE_COMMIT_MESSAGE" || echo "\$FAKE_COMMIT_MESSAGE" > "\$1" + test -z "\$FAKE_COMMIT_AMEND" || echo "\$FAKE_COMMIT_AMEND" >> "\$1" exit } test -z "\$FAKE_LINES" && exit @@ -212,4 +213,12 @@ test_expect_success 'verbose flag is heeded, even after --continue' ' grep "^ file1 | 2 +-$" output ' +test_expect_success 'multi-squash only fires up editor once' ' + base=$(git rev-parse HEAD~4) && + FAKE_COMMIT_AMEND="ONCE" FAKE_LINES="1 squash 2 squash 3 squash 4" \ + git rebase -i $base && + test $base = $(git rev-parse HEAD^) && + test 1 = $(git show | grep ONCE | wc -l) +' + test_done -- cgit v1.2.3 From e317cfafd247b279055e9ee64a6a982043bd06e7 Mon Sep 17 00:00:00 2001 From: Carlos Rica Date: Sat, 21 Jul 2007 14:13:12 +0200 Subject: builtin-tag.c: Fix two memory leaks and minor notation changes. A repeated call to read_sha1_file was not freing memory when the buffer was allocated but returned size was zero. Also, now the program does not allow many -F or -m options, which was a bug too because it was not freing the memory allocated for any previous -F or -m options. Tests are provided for ensuring that only one option -F or -m is given. Also, another test is shipped here, to check that "git tag" fails when a non-existing file is passed to the -F option, something that git-tag.sh allowed creating the tag with an empty message. Signed-off-by: Carlos Rica Acked-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 't') diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index a0be164619..c4fa4461f7 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -332,6 +332,33 @@ test_expect_success 'creating an annotated tag with -F - should succeed' ' git diff expect actual ' +test_expect_success \ + 'trying to create a tag with a non-existing -F file should fail' ' + ! test -f nonexistingfile && + ! tag_exists notag && + ! git-tag -F nonexistingfile notag && + ! tag_exists notag +' + +test_expect_success \ + 'trying to create tags giving many -m or -F options should fail' ' + echo "message file 1" >msgfile1 && + echo "message file 2" >msgfile2 && + ! tag_exists msgtag && + ! git-tag -m "message 1" -m "message 2" msgtag && + ! tag_exists msgtag && + ! git-tag -F msgfile1 -F msgfile2 msgtag && + ! tag_exists msgtag && + ! git-tag -m "message 1" -F msgfile1 msgtag && + ! tag_exists msgtag && + ! git-tag -F msgfile1 -m "message 1" msgtag && + ! tag_exists msgtag && + ! git-tag -F msgfile1 -m "message 1" -F msgfile2 msgtag && + ! tag_exists msgtag && + ! git-tag -m "message 1" -F msgfile1 -m "message 2" msgtag && + ! tag_exists msgtag +' + # blank and empty messages: get_tag_header empty-annotated-tag $commit commit $time >expect @@ -648,6 +675,14 @@ test_expect_success 'creating a signed tag with -F - should succeed' ' git diff expect actual ' +test_expect_success \ + 'trying to create a signed tag with non-existing -F file should fail' ' + ! test -f nonexistingfile && + ! tag_exists nosigtag && + ! git-tag -s -F nonexistingfile nosigtag && + ! tag_exists nosigtag +' + test_expect_success 'verifying a signed tag should succeed' \ 'git-tag -v signed-tag' -- cgit v1.2.3 From dfd05e38f07f76505158399cc433b0b1870a769a Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 23 Jul 2007 18:34:13 +0100 Subject: filter-branch: Big syntax change; support rewriting multiple refs We used to take the first non-option argument as the name for the new branch. This syntax is not extensible to support rewriting more than just HEAD. Instead, we now have the following syntax: git filter-branch [...] [] All positive refs given in are rewritten. Yes, in-place. If a ref was changed, the original head is stored in refs/original/$ref now, for your inspecting pleasure, in addition to the reflogs (since it is easier to inspect "git show-ref | grep original" than to inspect all the reflogs). This commit also adds the --force option to remove .git-rewrite/ and all refs from refs/original/ before filtering. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7003-filter-branch.sh | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) (limited to 't') diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index 4ddd656e84..bc6e2ddb19 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -30,24 +30,24 @@ test_expect_success 'setup' ' H=$(git rev-parse H) test_expect_success 'rewrite identically' ' - git-filter-branch H2 + git-filter-branch branch ' - test_expect_success 'result is really identical' ' - test $H = $(git rev-parse H2) + test $H = $(git rev-parse HEAD) ' test_expect_success 'rewrite, renaming a specific file' ' - git-filter-branch --tree-filter "mv d doh || :" H3 + git-filter-branch -f --tree-filter "mv d doh || :" HEAD ' test_expect_success 'test that the file was renamed' ' - test d = $(git show H3:doh) + test d = $(git show HEAD:doh) ' -git tag oldD H3~4 +git tag oldD HEAD~4 test_expect_success 'rewrite one branch, keeping a side branch' ' - git-filter-branch --tree-filter "mv b boh || :" modD D..oldD + git branch modD oldD && + git-filter-branch -f --tree-filter "mv b boh || :" D..modD ' test_expect_success 'common ancestor is still common (unchanged)' ' @@ -69,7 +69,8 @@ test_expect_success 'filter subdirectory only' ' git rm a && test_tick && git commit -m "again not subdir" && - git-filter-branch --subdirectory-filter subdir sub + git branch sub && + git-filter-branch -f --subdirectory-filter subdir refs/heads/sub ' test_expect_success 'subdirectory filter result looks okay' ' @@ -89,7 +90,8 @@ test_expect_success 'setup and filter history that requires --full-history' ' test_tick && git commit -m "again subdir on master" && git merge branch && - git-filter-branch --subdirectory-filter subdir sub-master + git branch sub-master && + git-filter-branch -f --subdirectory-filter subdir sub-master ' test_expect_success 'subdirectory filter result looks okay' ' @@ -100,7 +102,8 @@ test_expect_success 'subdirectory filter result looks okay' ' ' test_expect_success 'use index-filter to move into a subdirectory' ' - git-filter-branch --index-filter \ + git branch directorymoved && + git-filter-branch -f --index-filter \ "git ls-files -s | sed \"s-\\t-&newsubdir/-\" | GIT_INDEX_FILE=\$GIT_INDEX_FILE.new \ git update-index --index-info && @@ -108,9 +111,10 @@ test_expect_success 'use index-filter to move into a subdirectory' ' test -z "$(git diff HEAD directorymoved:newsubdir)"' test_expect_success 'stops when msg filter fails' ' - ! git-filter-branch --msg-filter false nonono && - rm -rf .git-rewrite && - ! git rev-parse nonono + old=$(git rev-parse HEAD) && + ! git-filter-branch -f --msg-filter false && + test $old = $(git rev-parse HEAD) && + rm -rf .git-rewrite ' test_expect_success 'author information is preserved' ' @@ -118,7 +122,8 @@ test_expect_success 'author information is preserved' ' git add i && test_tick && GIT_AUTHOR_NAME="B V Uips" git commit -m bvuips && - git-filter-branch --msg-filter "cat; \ + git branch preserved-author && + git-filter-branch -f --msg-filter "cat; \ test \$GIT_COMMIT != $(git rev-parse master) || \ echo Hallo" \ preserved-author && @@ -129,7 +134,8 @@ test_expect_success "remove a certain author's commits" ' echo i > i && test_tick && git commit -m i i && - git-filter-branch --commit-filter "\ + git branch removed-author && + git-filter-branch -f --commit-filter "\ if [ \"\$GIT_AUTHOR_NAME\" = \"B V Uips\" ];\ then\ shift;\ @@ -148,4 +154,9 @@ test_expect_success "remove a certain author's commits" ' test 0 = $(git rev-list --author="B V Uips" removed-author | wc -l) ' +test_expect_success 'barf on invalid name' ' + ! git filter-branch -f master xy-problem && + ! git filter-branch -f HEAD^ +' + test_done -- cgit v1.2.3 From d1cc130a5eb50d5bfe1e8b76cab3d8970fd70ad1 Mon Sep 17 00:00:00 2001 From: Steven Grimm Date: Sun, 22 Jul 2007 21:17:42 -0700 Subject: Teach git-commit about commit message templates. These are useful in organizations that enforce particular formats for commit messages, e.g., to specify bug IDs or test plans. Use of the template is not enforced; it is simply used as the initial content when the editor is invoked. Signed-off-by: Steven Grimm Signed-off-by: Junio C Hamano --- t/t7500-commit.sh | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++ t/t7500/add-comments | 4 +++ t/t7500/add-content | 3 ++ t/t7500/add-signed-off | 3 ++ 4 files changed, 106 insertions(+) create mode 100755 t/t7500-commit.sh create mode 100755 t/t7500/add-comments create mode 100755 t/t7500/add-content create mode 100755 t/t7500/add-signed-off (limited to 't') diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh new file mode 100755 index 0000000000..f11ada8617 --- /dev/null +++ b/t/t7500-commit.sh @@ -0,0 +1,96 @@ +#!/bin/sh +# +# Copyright (c) 2007 Steven Grimm +# + +test_description='git-commit + +Tests for selected commit options.' + +. ./test-lib.sh + +commit_msg_is () { + test "`git log --pretty=format:%s%b -1`" = "$1" +} + +# A sanity check to see if commit is working at all. +test_expect_success 'a basic commit in an empty tree should succeed' ' + echo content > foo && + git add foo && + git commit -m "initial commit" +' + +test_expect_success 'nonexistent template file should return error' ' + echo changes >> foo && + git add foo && + ! git commit --template "$PWD"/notexist +' + +test_expect_success 'nonexistent template file in config should return error' ' + git config commit.template "$PWD"/notexist && + ! git commit && + git config --unset commit.template +' + +# From now on we'll use a template file that exists. +TEMPLATE="$PWD"/template + +test_expect_success 'unedited template should not commit' ' + echo "template line" > "$TEMPLATE" && + ! git commit --template "$TEMPLATE" +' + +test_expect_success 'unedited template with comments should not commit' ' + echo "# comment in template" >> "$TEMPLATE" && + ! git commit --template "$TEMPLATE" +' + +test_expect_success 'a Signed-off-by line by itself should not commit' ' + ! GIT_EDITOR=../t7500/add-signed-off git commit --template "$TEMPLATE" +' + +test_expect_success 'adding comments to a template should not commit' ' + ! GIT_EDITOR=../t7500/add-comments git commit --template "$TEMPLATE" +' + +test_expect_success 'adding real content to a template should commit' ' + GIT_EDITOR=../t7500/add-content git commit --template "$TEMPLATE" && + commit_msg_is "template linecommit message" +' + +test_expect_success '-t option should be short for --template' ' + echo "short template" > "$TEMPLATE" && + echo "new content" >> foo && + git add foo && + GIT_EDITOR=../t7500/add-content git commit -t "$TEMPLATE" && + commit_msg_is "short templatecommit message" +' + +test_expect_success 'config-specified template should commit' ' + echo "new template" > "$TEMPLATE" && + git config commit.template "$TEMPLATE" && + echo "more content" >> foo && + git add foo && + GIT_EDITOR=../t7500/add-content git commit && + git config --unset commit.template && + commit_msg_is "new templatecommit message" +' + +test_expect_success 'explicit commit message should override template' ' + echo "still more content" >> foo && + git add foo && + GIT_EDITOR=../t7500/add-content git commit --template "$TEMPLATE" \ + -m "command line msg" && + commit_msg_is "command line msg" +' + +test_expect_success 'commit message from file should override template' ' + echo "content galore" >> foo && + git add foo && + echo "standard input msg" | + GIT_EDITOR=../t7500/add-content git commit \ + --template "$TEMPLATE" --file - && + commit_msg_is "standard input msg" +' + +test_done diff --git a/t/t7500/add-comments b/t/t7500/add-comments new file mode 100755 index 0000000000..a72e65c891 --- /dev/null +++ b/t/t7500/add-comments @@ -0,0 +1,4 @@ +#!/bin/sh +echo "# this is a new comment" >> "$1" +echo "# and so is this" >> "$1" +exit 0 diff --git a/t/t7500/add-content b/t/t7500/add-content new file mode 100755 index 0000000000..2fa3d86a10 --- /dev/null +++ b/t/t7500/add-content @@ -0,0 +1,3 @@ +#!/bin/sh +echo "commit message" >> "$1" +exit 0 diff --git a/t/t7500/add-signed-off b/t/t7500/add-signed-off new file mode 100755 index 0000000000..e1d856af6d --- /dev/null +++ b/t/t7500/add-signed-off @@ -0,0 +1,3 @@ +#!/bin/sh +echo "Signed-off-by: foo " >> "$1" +exit 0 -- cgit v1.2.3 From c4eaed49c22366f1994a75179adeac47e7863794 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 24 Jul 2007 23:25:38 -0700 Subject: t9200: Be careful when checking CVS/Entries CVS/Entries file can contain a line with single D to say "this directory does not have any subdirectories". Do not get confused with such an entry. Signed-off-by: Junio C Hamano --- t/t9200-git-cvsexportcommit.sh | 64 +++++++++++++++++++++++++----------------- 1 file changed, 39 insertions(+), 25 deletions(-) (limited to 't') diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh index 4efa0c926c..910c584f24 100755 --- a/t/t9200-git-cvsexportcommit.sh +++ b/t/t9200-git-cvsexportcommit.sh @@ -28,6 +28,18 @@ git add empty && git commit -q -a -m "Initial" 2>/dev/null || exit 1 +check_entries () { + # $1 == directory, $2 == expected + grep '^/' "$1/CVS/Entries" | sort | cut -d/ -f2,3,5 >actual + if test -z "$2" + then + >expected + else + printf '%s\n' "$2" | tr '|' '\012' >expected + fi + diff -u expected actual +} + test_expect_success \ 'New file' \ 'mkdir A B C D E F && @@ -43,10 +55,10 @@ test_expect_success \ id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && git cvsexportcommit -c $id && - test "$(echo $(sort A/CVS/Entries|cut -d/ -f2,3,5))" = "newfile1.txt/1.1/" && - test "$(echo $(sort B/CVS/Entries|cut -d/ -f2,3,5))" = "newfile2.txt/1.1/" && - test "$(echo $(sort C/CVS/Entries|cut -d/ -f2,3,5))" = "newfile3.png/1.1/-kb" && - test "$(echo $(sort D/CVS/Entries|cut -d/ -f2,3,5))" = "newfile4.png/1.1/-kb" && + check_entries A "newfile1.txt/1.1/" && + check_entries B "newfile2.txt/1.1/" && + check_entries C "newfile3.png/1.1/-kb" && + check_entries D "newfile4.png/1.1/-kb" && diff A/newfile1.txt ../A/newfile1.txt && diff B/newfile2.txt ../B/newfile2.txt && diff C/newfile3.png ../C/newfile3.png && @@ -67,12 +79,12 @@ test_expect_success \ id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && git cvsexportcommit -c $id && - test "$(echo $(sort A/CVS/Entries|cut -d/ -f2,3,5))" = "newfile1.txt/1.2/" && - test "$(echo $(sort B/CVS/Entries|cut -d/ -f2,3,5))" = "" && - test "$(echo $(sort C/CVS/Entries|cut -d/ -f2,3,5))" = "" && - test "$(echo $(sort D/CVS/Entries|cut -d/ -f2,3,5))" = "newfile4.png/1.2/-kb" && - test "$(echo $(sort E/CVS/Entries|cut -d/ -f2,3,5))" = "newfile5.txt/1.1/" && - test "$(echo $(sort F/CVS/Entries|cut -d/ -f2,3,5))" = "newfile6.png/1.1/-kb" && + check_entries A "newfile1.txt/1.2/" && + check_entries B "" && + check_entries C "" && + check_entries D "newfile4.png/1.2/-kb" && + check_entries E "newfile5.txt/1.1/" && + check_entries F "newfile6.png/1.1/-kb" && diff A/newfile1.txt ../A/newfile1.txt && diff D/newfile4.png ../D/newfile4.png && diff E/newfile5.txt ../E/newfile5.txt && @@ -115,12 +127,12 @@ test_expect_success \ id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && git cvsexportcommit -c $id && - test "$(echo $(sort A/CVS/Entries|cut -d/ -f2,3,5))" = "newfile1.txt/1.2/" && - test "$(echo $(sort B/CVS/Entries|cut -d/ -f2,3,5))" = "" && - test "$(echo $(sort C/CVS/Entries|cut -d/ -f2,3,5))" = "" && - test "$(echo $(sort D/CVS/Entries|cut -d/ -f2,3,5))" = "" && - test "$(echo $(sort E/CVS/Entries|cut -d/ -f2,3,5))" = "newfile5.txt/1.1/" && - test "$(echo $(sort F/CVS/Entries|cut -d/ -f2,3,5))" = "newfile6.png/1.1/-kb" && + check_entries A "newfile1.txt/1.2/" && + check_entries B "" && + check_entries C "" && + check_entries D "" && + check_entries E "newfile5.txt/1.1/" && + check_entries F "newfile6.png/1.1/-kb" && diff A/newfile1.txt ../A/newfile1.txt && diff E/newfile5.txt ../E/newfile5.txt && diff F/newfile6.png ../F/newfile6.png @@ -133,12 +145,12 @@ test_expect_success \ id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && git cvsexportcommit -c $id && - test "$(echo $(sort A/CVS/Entries|cut -d/ -f2,3,5))" = "" && - test "$(echo $(sort B/CVS/Entries|cut -d/ -f2,3,5))" = "" && - test "$(echo $(sort C/CVS/Entries|cut -d/ -f2,3,5))" = "" && - test "$(echo $(sort D/CVS/Entries|cut -d/ -f2,3,5))" = "" && - test "$(echo $(sort E/CVS/Entries|cut -d/ -f2,3,5))" = "newfile5.txt/1.1/" && - test "$(echo $(sort F/CVS/Entries|cut -d/ -f2,3,5))" = "newfile6.png/1.1/-kb" && + check_entries A "" && + check_entries B "" && + check_entries C "" && + check_entries D "" && + check_entries E "newfile5.txt/1.1/" && + check_entries F "newfile6.png/1.1/-kb" && diff E/newfile5.txt ../E/newfile5.txt && diff F/newfile6.png ../F/newfile6.png )' @@ -154,7 +166,7 @@ test_expect_success \ id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && git-cvsexportcommit -c $id && - test "$(echo $(sort "G g/CVS/Entries"|cut -d/ -f2,3,5))" = "with spaces.png/1.1/-kb with spaces.txt/1.1/" + check_entries "G g" "with spaces.png/1.1/-kb|with spaces.txt/1.1/" )' test_expect_success \ @@ -166,7 +178,7 @@ test_expect_success \ id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && git-cvsexportcommit -c $id - test "$(echo $(sort "G g/CVS/Entries"|cut -d/ -f2,3,5))" = "with spaces.png/1.2/-kb with spaces.txt/1.2/" + check_entries "G g" "with spaces.png/1.2/-kb|with spaces.txt/1.2/" )' # Some filesystems mangle pathnames with UTF-8 characters -- @@ -191,7 +203,9 @@ test_expect_success \ id=$(git rev-list --max-count=1 HEAD) && (cd "$CVSWORK" && git-cvsexportcommit -v -c $id && - test "$(echo $(sort Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö/CVS/Entries|cut -d/ -f2,3,5))" = "gårdetsågårdet.png/1.1/-kb gårdetsågårdet.txt/1.1/" + check_entries \ + "Å/goo/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y/z/å/ä/ö" \ + "gårdetsågårdet.png/1.1/-kb|gårdetsågårdet.txt/1.1/" )' fi -- cgit v1.2.3 From ceff079bdcaebb67b0379a1036a32b4dfebb6012 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 25 Jul 2007 15:32:22 -0700 Subject: Make sure git-stash works from subdirectory. We say "SUBDIRECTORY_OK" but we did not chdir to toplevel; this is fine as long as everything we use can be started from a subdirectory, but unfortunately "merge-recursive" is not one of the programs you can safely use from a subdirectory. Signed-off-by: Junio C Hamano --- t/t3903-stash.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 't') diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh index 392ac1c5c5..9a9a250d2c 100755 --- a/t/t3903-stash.sh +++ b/t/t3903-stash.sh @@ -66,4 +66,11 @@ test_expect_success 'apply stashed changes (including index)' ' test 1 = $(git show HEAD:file) ' +test_expect_success 'unstashing in a subdirectory' ' + git reset --hard HEAD && + mkdir subdir && + cd subdir && + git stash apply +' + test_done -- cgit v1.2.3 From f653aee5a37b909e772d612eb7e226f09fd2f3d3 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 23 Jul 2007 12:58:27 +0100 Subject: Teach "git stripspace" the --strip-comments option With --strip-comments (or short -s), git stripspace now removes lines beginning with a '#', too. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t0030-stripspace.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 't') diff --git a/t/t0030-stripspace.sh b/t/t0030-stripspace.sh index b1c900379b..cad95f35ad 100755 --- a/t/t0030-stripspace.sh +++ b/t/t0030-stripspace.sh @@ -392,4 +392,9 @@ test_expect_success \ git diff expect actual ' +test_expect_success 'strip comments, too' ' + test ! -z "$(echo "# comment" | git stripspace)" && + test -z "$(echo "# comment" | git stripspace -s)" +' + test_done -- cgit v1.2.3 From 65a5a21d024373674d6068a03c71558035775e0c Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 26 Jul 2007 22:13:12 -0700 Subject: Add test for symlinked configuration file updates. Signed-off-by: Junio C Hamano --- t/t1300-repo-config.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 't') diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 1c43cc333d..187ca2df5c 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -595,4 +595,19 @@ echo >>result test_expect_success '--null --get-regexp' 'cmp result expect' +test_expect_success 'symlinked configuration' ' + + ln -s notyet myconfig && + GIT_CONFIG=myconfig git config test.frotz nitfol && + test -h myconfig && + test -f notyet && + test "z$(GIT_CONFIG=notyet git config test.frotz)" = znitfol && + GIT_CONFIG=myconfig git config test.xyzzy rezrov && + test -h myconfig && + test -f notyet && + test "z$(GIT_CONFIG=notyet git config test.frotz)" = znitfol && + test "z$(GIT_CONFIG=notyet git config test.xyzzy)" = zrezrov + +' + test_done -- cgit v1.2.3 From fb47cfbd59b12ea67e1a5c6a9d0bd665fcae4581 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 24 Jul 2007 21:43:09 +0100 Subject: rebase -i: fix interrupted squashing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a squashing merge failed, the first commit would not be replaced, due to "git reset --soft" being called with an unmerged index. Noticed by Uwe Kleine-König. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 8206436cc7..817f614cde 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -221,4 +221,34 @@ test_expect_success 'multi-squash only fires up editor once' ' test 1 = $(git show | grep ONCE | wc -l) ' +test_expect_success 'squash works as expected' ' + for n in one two three four + do + echo $n >> file$n && + git add file$n && + git commit -m $n + done && + one=$(git rev-parse HEAD~3) && + FAKE_LINES="1 squash 3 2" git rebase -i HEAD~3 && + test $one = $(git rev-parse HEAD~2) +' + +test_expect_success 'interrupted squash works as expected' ' + for n in one two three four + do + echo $n >> conflict && + git add conflict && + git commit -m $n + done && + one=$(git rev-parse HEAD~3) && + ! FAKE_LINES="1 squash 3 2" git rebase -i HEAD~3 && + (echo one; echo two; echo four) > conflict && + git add conflict && + ! git rebase --continue && + echo resolved > conflict && + git add conflict && + git rebase --continue && + test $one = $(git rev-parse HEAD~2) +' + test_done -- cgit v1.2.3 From 12075103ddc9a061cf6f3b04feb206123bb78e2f Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Sat, 28 Jul 2007 16:27:32 +0200 Subject: gitweb: Simplify 'opt' parameter validation, add "no merges" feeds Simplify and make more readable validation of 'opt' (extra options) parameter, using exists($hash{key}) instead of grepping keys of a hash for value. Move 'opt' parameter to be the last (for now) in the URL. Make use of '--no-merges' extra option ('opt') by adding "no merges" RSS and Atom feeds to the HTML header. Note that alternate format links in the RSS and Atom views do not use '--no-merges' option yet! Adds tests for the 'opt' parameter to t9500-gitweb-standalone-no-errors.sh Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- t/t9500-gitweb-standalone-no-errors.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 't') diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh index d948724566..fa32598b0c 100755 --- a/t/t9500-gitweb-standalone-no-errors.sh +++ b/t/t9500-gitweb-standalone-no-errors.sh @@ -521,4 +521,32 @@ test_expect_success \ 'gitweb_run "p=.git;a=log"' test_debug 'cat gitweb.log' +# ---------------------------------------------------------------------- +# extra options + +test_expect_success \ + 'opt: log --no-merges' \ + 'gitweb_run "p=.git;a=log;opt=--no-merges"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'opt: atom --no-merges' \ + 'gitweb_run "p=.git;a=log;opt=--no-merges"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'opt: "file" history --no-merges' \ + 'gitweb_run "p=.git;a=history;f=file;opt=--no-merges"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'opt: log --no-such-option (invalid option)' \ + 'gitweb_run "p=.git;a=log;opt=--no-such-option"' +test_debug 'cat gitweb.log' + +test_expect_success \ + 'opt: tree --no-merges (invalid option for action)' \ + 'gitweb_run "p=.git;a=tree;opt=--no-merges"' +test_debug 'cat gitweb.log' + test_done -- cgit v1.2.3 From 82cb8afa9bf24d2f77a6d565cdc08d6aa1febeb4 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sun, 29 Jul 2007 05:49:56 -0400 Subject: git-diff: turn on recursion by default The tree recursion behavior of git-diff may appear inconsistent to the user because it depends on the format of the patch as well as whether one is diffing between trees or against the index. Since git-diff is a porcelain wrapper for low-level diff commands, it makes sense for its behavior to be consistent no matter what is being diffed. This patch turns on recursion in all cases. Signed-off-by: Junio C Hamano --- t/t9300-fast-import.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 4b920be331..6f95305bf4 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -577,7 +577,7 @@ EXPECT_END test_expect_success \ 'L: verify internal tree sorting' \ 'git-fast-import output && + git diff-tree --abbrev --raw L^ L >output && git diff expect output' ### -- cgit v1.2.3 From d7f6bae28142e07e544efdab73260cf9f60ca899 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 28 Jul 2007 17:57:25 -0700 Subject: rebase: try not to munge commit log message This makes rebase/am keep the original commit log message better, even when it does not conform to "single line paragraph to say what it does, then explain and defend why it is a good change in later paragraphs" convention. This change is a two-edged sword. While the earlier behaviour would make such commit log messages more friendly to readers who expect to get the birds-eye view with oneline summary formats, users who primarily use git as a way to interact with foreign SCM systems would not care much about the convenience of oneline git log tools, but care more about preserving their own convention. This changes their commits less useful to readers who read them with git tools while keeping them more consistent with the foreign SCM systems they interact with. Signed-off-by: Junio C Hamano --- t/t3405-rebase-malformed.sh | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 t/t3405-rebase-malformed.sh (limited to 't') diff --git a/t/t3405-rebase-malformed.sh b/t/t3405-rebase-malformed.sh new file mode 100755 index 0000000000..e4e2e649ed --- /dev/null +++ b/t/t3405-rebase-malformed.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +test_description='rebase should not insist on git message convention' + +. ./test-lib.sh + +cat >F <<\EOF +This is an example of a commit log message +that does not conform to git commit convention. + +It has two paragraphs, but its first paragraph is not friendly +to oneline summary format. +EOF + +test_expect_success setup ' + + >file1 && + >file2 && + git add file1 file2 && + test_tick && + git commit -m "Initial commit" && + + git checkout -b side && + cat F >file2 && + git add file2 && + test_tick && + git commit -F F && + + git cat-file commit HEAD | sed -e "1,/^\$/d" >F0 && + + git checkout master && + + echo One >file1 && + test_tick && + git add file1 && + git commit -m "Second commit" +' + +test_expect_success rebase ' + + git rebase master side && + git cat-file commit HEAD | sed -e "1,/^\$/d" >F1 && + + diff -u F0 F1 && + diff -u F F0 +' + +test_done -- cgit v1.2.3 From 18508c39c48d457fd095e0e30391471658698a1a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 30 Jul 2007 22:16:40 -0700 Subject: Unset GIT_EDITOR while running tests. Signed-off-by: Junio C Hamano --- t/test-lib.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't') diff --git a/t/test-lib.sh b/t/test-lib.sh index 78d7e87e86..cc1253ccab 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -11,6 +11,7 @@ TZ=UTC export LANG LC_ALL PAGER TZ EDITOR=: VISUAL=: +unset GIT_EDITOR unset AUTHOR_DATE unset AUTHOR_EMAIL unset AUTHOR_NAME -- cgit v1.2.3 From 773a69fb09acfdfa2ce5566548d8a8a370a59fde Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Tue, 31 Jul 2007 12:30:52 +0200 Subject: Add a test for git-config --file Check for non-0 exit code if the confiog file does not exist and if it works exactly like when setting GIT_CONFIG. Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- t/t1300-repo-config.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 't') diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh index 187ca2df5c..1d2bf2c060 100755 --- a/t/t1300-repo-config.sh +++ b/t/t1300-repo-config.sh @@ -325,6 +325,9 @@ EOF test_expect_success 'new variable inserts into proper section' 'cmp .git/config expect' +test_expect_success 'alternative GIT_CONFIG (non-existing file should fail)' \ + 'git config --file non-existing-config -l; test $? != 0' + cat > other-config << EOF [ein] bahn = strasse @@ -338,6 +341,9 @@ GIT_CONFIG=other-config git config -l > output test_expect_success 'alternative GIT_CONFIG' 'cmp output expect' +test_expect_success 'alternative GIT_CONFIG (--file)' \ + 'git config --file other-config -l > output && cmp output expect' + GIT_CONFIG=other-config git config anwohner.park ausweis cat > expect << EOF -- cgit v1.2.3 From 12ace0b20de33d57100435a60e09bb3971420003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 31 Jul 2007 15:37:30 -0400 Subject: Add test case for basic commit functionality. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Kristian Høgsberg Signed-off-by: Junio C Hamano --- t/t7501-commit.sh | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 t/t7501-commit.sh (limited to 't') diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh new file mode 100644 index 0000000000..8cc2cd9e60 --- /dev/null +++ b/t/t7501-commit.sh @@ -0,0 +1,134 @@ +#!/bin/sh +# +# Copyright (c) 2007 Kristian Høgsberg +# + +# FIXME: Test the various index usages, -i and -o, test reflog, +# signoff, hooks + +test_description='git-commit' +. ./test-lib.sh + +test_tick + +test_expect_success \ + "initial status" \ + "echo 'bongo bongo' >file && + git-add file && \ + git-status | grep 'Initial commit'" + +test_expect_failure \ + "fail initial amend" \ + "git-commit --amend" + +test_expect_success \ + "initial commit" \ + "git-commit -m initial" + +test_expect_failure \ + "invalid options 1" \ + "git-commit --amend -F file" + +test_expect_failure \ + "invalid options 2" \ + "git-commit -C HEAD -m illegal" + +test_expect_failure \ + "using invalid commit with -C" \ + "git-commit -C bogus" + +test_expect_failure \ + "testing nothing to commit" \ + "git-commit -m initial" + +test_expect_success \ + "next commit" \ + "echo 'bongo bongo bongo' >file \ + git-commit -m next -a" + +test_expect_failure \ + "commit message from non-existing file" \ + "echo 'more bongo: bongo bongo bongo bongo' >file && \ + git-commit -F gah -a" + +# Empty except stray tabs and spaces on a few lines. +sed -e 's/@$//' >msg <msg && \ + git-commit -F msg -a" + +cat >editor <<\EOF +#!/bin/sh +sed -i -e "s/a file/an amend commit/g" $1 +EOF +chmod 755 editor + +test_expect_success \ + "amend commit" \ + "VISUAL=./editor git-commit --amend" + +test_expect_failure \ + "passing --amend and -F" \ + "echo 'enough with the bongos' >file && \ + git-commit -F msg --amend ." + +test_expect_success \ + "using message from other commit" \ + "git-commit -C HEAD^ ." + +cat >editor <<\EOF +#!/bin/sh +sed -i -e "s/amend/older/g" $1 +EOF +chmod 755 editor + +test_expect_success \ + "editing message from other commit" \ + "echo 'hula hula' >file && \ + VISUAL=./editor git-commit -c HEAD^ -a" + +test_expect_success \ + "message from stdin" \ + "echo 'silly new contents' >file && \ + echo commit message from stdin | git-commit -F - -a" + +test_expect_success \ + "overriding author from command line" \ + "echo 'gak' >file && \ + git-commit -m 'author' --author 'Rubber Duck ' -a" + +test_expect_success \ + "interactive add" \ + "echo 7 | git-commit --interactive | grep 'What now'" + +test_expect_success \ + "showing committed revisions" \ + "git-rev-list HEAD >current" + +# We could just check the head sha1, but checking each commit makes it +# easier to isolate bugs. + +cat >expected <<\EOF +72c0dc9855b0c9dadcbfd5a31cab072e0cb774ca +9b88fc14ce6b32e3d9ee021531a54f18a5cf38a2 +3536bbb352c3a1ef9a420f5b4242d48578b92aa7 +d381ac431806e53f3dd7ac2f1ae0534f36d738b9 +4fd44095ad6334f3ef72e4c5ec8ddf108174b54a +402702b49136e7587daa9280e91e4bb7cb2179f7 +EOF + +test_expect_success \ + 'validate git-rev-list output.' \ + 'diff current expected' + +test_done -- cgit v1.2.3 From e5392c51469c25851f9c6e53165d75fc61901768 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 1 Aug 2007 01:28:59 +0100 Subject: Add is_absolute_path() and make_absolute_path() This patch adds convenience functions to work with absolute paths. The function is_absolute_path() should help the efforts to integrate the MinGW fork. Note that make_absolute_path() returns a pointer to a static buffer. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t0000-basic.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 't') diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh index 4bba9c0717..4e49d59065 100755 --- a/t/t0000-basic.sh +++ b/t/t0000-basic.sh @@ -281,4 +281,20 @@ test_expect_success 'update-index D/F conflict' ' test $numpath0 = 1 ' +test_expect_success 'absolute path works as expected' ' + mkdir first && + ln -s ../.git first/.git && + mkdir second && + ln -s ../first second/other && + mkdir third && + dir="$(cd .git; pwd -P)" && + dir2=third/../second/other/.git && + test "$dir" = "$(test-absolute-path $dir2)" && + file="$dir"/index && + test "$file" = "$(test-absolute-path $dir2/index)" && + ln -s ../first/file .git/syml && + sym="$(cd first; pwd -P)"/file && + test "$sym" = "$(test-absolute-path $dir2/syml)" +' + test_done -- cgit v1.2.3 From e90fdc39b6903502192b2dd11e5503cea721a1ad Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 1 Aug 2007 01:30:14 +0100 Subject: Clean up work-tree handling The old version of work-tree support was an unholy mess, barely readable, and not to the point. For example, why do you have to provide a worktree, when it is not used? As in "git status". Now it works. Another riddle was: if you can have work trees inside the git dir, why are some programs complaining that they need a work tree? IOW it is allowed to call $ git --git-dir=../ --work-tree=. bla when you really want to. In this case, you are both in the git directory and in the working tree. So, programs have to actually test for the right thing, namely if they are inside a working tree, and not if they are inside a git directory. Also, GIT_DIR=../.git should behave the same as if no GIT_DIR was specified, unless there is a repository in the current working directory. It does now. The logic to determine if a repository is bare, or has a work tree (tertium non datur), is this: --work-tree=bla overrides GIT_WORK_TREE, which overrides core.bare = true, which overrides core.worktree, which overrides GIT_DIR/.. when GIT_DIR ends in /.git, which overrides the directory in which .git/ was found. In related news, a long standing bug was fixed: when in .git/bla/x.git/, which is a bare repository, git formerly assumed ../.. to be the appropriate git dir. This problem was reported by Shawn Pearce to have caused much pain, where a colleague mistakenly ran "git init" in "/" a long time ago, and bare repositories just would not work. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t1500-rev-parse.sh | 20 ++++++++++---------- t/t1501-worktree.sh | 24 +++++++++++++++++++----- 2 files changed, 29 insertions(+), 15 deletions(-) (limited to 't') diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh index ec4996637d..bea40cba8d 100755 --- a/t/t1500-rev-parse.sh +++ b/t/t1500-rev-parse.sh @@ -31,9 +31,9 @@ test_rev_parse() { test_rev_parse toplevel false false true '' cd .git || exit 1 -test_rev_parse .git/ false true true .git/ +test_rev_parse .git/ true true false '' cd objects || exit 1 -test_rev_parse .git/objects/ false true true .git/objects/ +test_rev_parse .git/objects/ true true false '' cd ../.. || exit 1 mkdir -p sub/dir || exit 1 @@ -42,7 +42,7 @@ test_rev_parse subdirectory false false true sub/dir/ cd ../.. || exit 1 git config core.bare true -test_rev_parse 'core.bare = true' true false true +test_rev_parse 'core.bare = true' true false false git config --unset core.bare test_rev_parse 'core.bare undefined' false false true @@ -50,28 +50,28 @@ test_rev_parse 'core.bare undefined' false false true mkdir work || exit 1 cd work || exit 1 export GIT_DIR=../.git -export GIT_CONFIG="$GIT_DIR"/config +export GIT_CONFIG="$(pwd)"/../.git/config git config core.bare false -test_rev_parse 'GIT_DIR=../.git, core.bare = false' false false true '' +test_rev_parse 'GIT_DIR=../.git, core.bare = false' false false true work/ git config core.bare true -test_rev_parse 'GIT_DIR=../.git, core.bare = true' true false true '' +test_rev_parse 'GIT_DIR=../.git, core.bare = true' true false false '' git config --unset core.bare -test_rev_parse 'GIT_DIR=../.git, core.bare undefined' false false true '' +test_rev_parse 'GIT_DIR=../.git, core.bare undefined' false false true work/ mv ../.git ../repo.git || exit 1 export GIT_DIR=../repo.git -export GIT_CONFIG="$GIT_DIR"/config +export GIT_CONFIG="$(pwd)"/../repo.git/config git config core.bare false test_rev_parse 'GIT_DIR=../repo.git, core.bare = false' false false true '' git config core.bare true -test_rev_parse 'GIT_DIR=../repo.git, core.bare = true' true false true '' +test_rev_parse 'GIT_DIR=../repo.git, core.bare = true' true false false '' git config --unset core.bare -test_rev_parse 'GIT_DIR=../repo.git, core.bare undefined' true false true '' +test_rev_parse 'GIT_DIR=../repo.git, core.bare undefined' false false true '' test_done diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh index aadeeab9ab..732216184f 100755 --- a/t/t1501-worktree.sh +++ b/t/t1501-worktree.sh @@ -33,17 +33,17 @@ mv .git repo.git || exit 1 say "core.worktree = relative path" export GIT_DIR=repo.git -export GIT_CONFIG=$GIT_DIR/config +export GIT_CONFIG="$(pwd)"/$GIT_DIR/config unset GIT_WORK_TREE git config core.worktree ../work test_rev_parse 'outside' false false false cd work || exit 1 export GIT_DIR=../repo.git -export GIT_CONFIG=$GIT_DIR/config +export GIT_CONFIG="$(pwd)"/$GIT_DIR/config test_rev_parse 'inside' false false true '' cd sub/dir || exit 1 export GIT_DIR=../../../repo.git -export GIT_CONFIG=$GIT_DIR/config +export GIT_CONFIG="$(pwd)"/$GIT_DIR/config test_rev_parse 'subdirectory' false false true sub/dir/ cd ../../.. || exit 1 @@ -84,9 +84,23 @@ test_rev_parse 'in repo.git' false true false cd objects || exit 1 test_rev_parse 'in repo.git/objects' false true false cd ../work || exit 1 -test_rev_parse 'in repo.git/work' false false true '' +test_rev_parse 'in repo.git/work' false true true '' cd sub/dir || exit 1 -test_rev_parse 'in repo.git/sub/dir' false false true sub/dir/ +test_rev_parse 'in repo.git/sub/dir' false true true sub/dir/ cd ../../../.. || exit 1 +test_expect_success 'repo finds its work tree' ' + (cd repo.git && + : > work/sub/dir/untracked && + test sub/dir/untracked = "$(git ls-files --others)") +' + +test_expect_success 'repo finds its work tree from work tree, too' ' + (cd repo.git/work/sub/dir && + : > tracked && + git --git-dir=../../.. add tracked && + cd ../../.. && + test sub/dir/tracked = "$(git ls-files)") +' + test_done -- cgit v1.2.3 From 96ffe892e307ea512abbc633f822558c568cece1 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 1 Aug 2007 15:59:35 +0100 Subject: rebase -i: ignore patches that are already in the upstream Non-interactive rebase had this from the beginning -- match it by using --cherry-pick option to rev-list. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 817f614cde..dc436d768e 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -68,6 +68,9 @@ test "\$1" = .git/COMMIT_EDITMSG && { test -z "\$FAKE_COMMIT_AMEND" || echo "\$FAKE_COMMIT_AMEND" >> "\$1" exit } +test -z "\$EXPECT_COUNT" || + test "\$EXPECT_COUNT" = \$(grep -ve "^#" -e "^$" < "\$1" | wc -l) || + exit test -z "\$FAKE_LINES" && exit grep -v "^#" < "\$1" > "\$1".tmp rm "\$1" @@ -251,4 +254,16 @@ test_expect_success 'interrupted squash works as expected' ' test $one = $(git rev-parse HEAD~2) ' +test_expect_success 'ignore patch if in upstream' ' + HEAD=$(git rev-parse HEAD) && + git checkout -b has-cherry-picked HEAD^ && + echo unrelated > file7 && + git add file7 && + test_tick && + git commit -m "unrelated change" && + git cherry-pick $HEAD && + EXPECT_COUNT=1 git rebase -i $HEAD && + test $HEAD = $(git rev-parse HEAD^) +' + test_done -- cgit v1.2.3 From 6d4bbebd35e3a6e8091d7188f1c4d49af7f054e3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 1 Aug 2007 18:14:41 -0700 Subject: git-commit.sh: Permit the --amend message to be given with -m/-c/-C/-F. [jc: adjusted t/t7501 as this makes -F and --amend compatible] Signed-off-by: David Kastrup Signed-off-by: Junio C Hamano --- t/t7501-commit.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 't') diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index 8cc2cd9e60..6bd3c9e3e0 100644 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -27,7 +27,7 @@ test_expect_success \ test_expect_failure \ "invalid options 1" \ - "git-commit --amend -F file" + "git-commit -m foo -m bar -F file" test_expect_failure \ "invalid options 2" \ @@ -78,9 +78,9 @@ test_expect_success \ "VISUAL=./editor git-commit --amend" test_expect_failure \ - "passing --amend and -F" \ + "passing -m and -F" \ "echo 'enough with the bongos' >file && \ - git-commit -F msg --amend ." + git-commit -F msg -m amending ." test_expect_success \ "using message from other commit" \ -- cgit v1.2.3 From c9e6589288b09f4e631c7f12f0f9a77c29851632 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 1 Aug 2007 23:31:03 +0100 Subject: rebase -i: fix for optional [branch] parameter When calling "git rebase -i ", git should switch to first. This worked before, but I broke it by my "Shut git rebase -i up" patch. Fix that, and add a test to make sure that it does not break again. Signed-off-by: Johannes Schindelin Acked-by: Alex Riesen Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index dc436d768e..a9b552ff08 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -98,6 +98,14 @@ test_expect_success 'no changes are a nop' ' test $(git rev-parse I) = $(git rev-parse HEAD) ' +test_expect_success 'test the [branch] option' ' + git checkout -b dead-end && + git rm file6 && + git commit -m "stop here" && + git rebase -i F branch2 && + test $(git rev-parse I) = $(git rev-parse HEAD) +' + test_expect_success 'rebase on top of a non-conflicting commit' ' git checkout branch1 && git tag original-branch1 && -- cgit v1.2.3 From 3d5c418ff56645e13bdbd8c9f7d84fdaf7c8494b Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 1 Aug 2007 23:42:36 -0700 Subject: git-clone: aggressively optimize local clone behaviour. This changes the behaviour of cloning from a repository on the local machine, by defaulting to "-l" (use hardlinks to share files under .git/objects) and making "-l" a no-op. A new option, --no-hardlinks, is also added to cause file-level copy of files under .git/objects while still avoiding the normal "pack to pipe, then receive and index pack" network transfer overhead. The old behaviour of local cloning without -l nor -s is availble by specifying the source repository with the newly introduced file:///path/to/repo.git/ syntax (i.e. "same as network" cloning). * With --no-hardlinks (i.e. have all .git/objects/ copied via cpio) would not catch the source repository corruption, and also risks corrupted recipient repository if an alpha-particle hits memory cell while indexing and resolving deltas. As long as the recipient is created uncorrupted, you have a good back-up. * same-as-network is expensive, but it would catch the breakage of the source repository. It still risks corrupted recipient repository due to hardware failure. As long as the recipient is created uncorrupted, you have a good back-up. * The new default on the same filesystem, as long as the source repository is healthy, it is very likely that the recipient would be, too. Also it is very cheap. You do not get any back-up benefit, though. None of the method is resilient against the source repository corruption, so let's discount that from the comparison. Then the difference with and without --no-hardlinks matters primarily if you value the back-up benefit or not. If you want to use the cloned repository as a back-up, then it is cheaper to do a clone with --no-hardlinks and two git-fsck (source before clone, recipient after clone) than same-as-network clone, especially as you are likely to do a git-fsck on the recipient if you are so paranoid anyway. Which leads me to believe that being able to use file:/// is probably a good idea, if only for testability, but probably of little practical value. We default to hardlinked clone for everyday use, and paranoids can use --no-hardlinks as a way to make a back-up. Signed-off-by: Junio C Hamano --- t/t5500-fetch-pack.sh | 2 +- t/t5700-clone-reference.sh | 2 +- t/t5701-clone-local.sh | 17 +++++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh index 7da515361a..7b6798d8b5 100755 --- a/t/t5500-fetch-pack.sh +++ b/t/t5500-fetch-pack.sh @@ -129,7 +129,7 @@ pull_to_client 2nd "B" $((64*3)) pull_to_client 3rd "A" $((1*3)) # old fails -test_expect_success "clone shallow" "git-clone --depth 2 . shallow" +test_expect_success "clone shallow" "git-clone --depth 2 file://`pwd`/. shallow" (cd shallow; git count-objects -v) > count.shallow diff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh index 6d43252593..4e93aaab02 100755 --- a/t/t5700-clone-reference.sh +++ b/t/t5700-clone-reference.sh @@ -51,7 +51,7 @@ diff expected current' cd "$base_dir" test_expect_success 'cloning with reference (no -l -s)' \ -'git clone --reference B A D' +'git clone --reference B file://`pwd`/A D' cd "$base_dir" diff --git a/t/t5701-clone-local.sh b/t/t5701-clone-local.sh index b0933274db..a3026ec4fc 100755 --- a/t/t5701-clone-local.sh +++ b/t/t5701-clone-local.sh @@ -43,4 +43,21 @@ test_expect_success 'local clone from x.git that does not exist' ' fi ' +test_expect_success 'With -no-hardlinks, local will make a copy' ' + cd "$D" && + git clone --bare --no-hardlinks x w && + cd w && + linked=$(find objects -type f ! -links 1 | wc -l) && + test "$linked" = 0 +' + +test_expect_success 'Even without -l, local will make a hardlink' ' + cd "$D" && + rm -fr w && + git clone -l --bare x w && + cd w && + copied=$(find objects -type f -links 1 | wc -l) && + test "$copied" = 0 +' + test_done -- cgit v1.2.3 From a697ec69cbd3eb1a8fb70e4e0587e5049cd1ad83 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 3 Aug 2007 14:31:47 -0700 Subject: Fix bogus use of printf in t3700 test The hashed contents did not matter in the end result, but it passed an uninitialized variable to printf, which caused it to emit empty while giving an error/usage message. Signed-off-by: Junio C Hamano --- t/t3700-add.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t3700-add.sh b/t/t3700-add.sh index b52fde8577..213e9249da 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -131,8 +131,8 @@ test_expect_success 'git add with filemode=0, symlinks=0 prefers stage 2 over st ( echo "100644 $(git hash-object -w stage1) 1 file" echo "100755 $(git hash-object -w stage2) 2 file" - echo "100644 $(printf $s | git hash-object -w -t blob --stdin) 1 symlink" - echo "120000 $(printf $s | git hash-object -w -t blob --stdin) 2 symlink" + echo "100644 $(printf 1 | git hash-object -w -t blob --stdin) 1 symlink" + echo "120000 $(printf 2 | git hash-object -w -t blob --stdin) 2 symlink" ) | git update-index --index-info && git config core.filemode 0 && git config core.symlinks 0 && -- cgit v1.2.3 From 7efeb8f09866ddd09485c0e6f371a6cbba3d2a0a Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sun, 5 Aug 2007 14:12:53 +0100 Subject: Reinstate the old behaviour when GIT_DIR is set and GIT_WORK_TREE is unset The old behaviour was to unilaterally default to the cwd is the work tree when GIT_DIR was set, but GIT_WORK_TREE wasn't, no matter if we are inside the GIT_DIR, or if GIT_DIR is actually something like ../../../.git. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t1500-rev-parse.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh index bea40cba8d..e474b3f1d5 100755 --- a/t/t1500-rev-parse.sh +++ b/t/t1500-rev-parse.sh @@ -28,6 +28,8 @@ test_rev_parse() { [ $# -eq 0 ] && return } +# label is-bare is-inside-git is-inside-work prefix + test_rev_parse toplevel false false true '' cd .git || exit 1 @@ -53,13 +55,13 @@ export GIT_DIR=../.git export GIT_CONFIG="$(pwd)"/../.git/config git config core.bare false -test_rev_parse 'GIT_DIR=../.git, core.bare = false' false false true work/ +test_rev_parse 'GIT_DIR=../.git, core.bare = false' false false true '' git config core.bare true test_rev_parse 'GIT_DIR=../.git, core.bare = true' true false false '' git config --unset core.bare -test_rev_parse 'GIT_DIR=../.git, core.bare undefined' false false true work/ +test_rev_parse 'GIT_DIR=../.git, core.bare undefined' false false true '' mv ../.git ../repo.git || exit 1 export GIT_DIR=../repo.git -- cgit v1.2.3 From 7fa8254f9476de24661e93b2a90c6ce30dc10006 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 8 Aug 2007 17:01:49 -0700 Subject: allow git-bundle to create bottomless bundle While "git bundle" was a useful way to sneakernet incremental changes, we did not allow: $ git bundle create v2.6.20.bndl v2.6.20 to create a bundle that contains the whole history to a well-known good revision. Such a bundle can be mirrored everywhere, and people can prime their repository with it to reduce the load on the repository that serves near the tip of the development. Signed-off-by: Junio C Hamano --- t/t5510-fetch.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't') diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 426017e1d0..439430f569 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -145,4 +145,12 @@ test_expect_success 'bundle does not prerequisite objects' ' test 4 = $(git verify-pack -v bundle.pack | wc -l) ' +test_expect_success 'bundle should be able to create a full history' ' + + cd "$D" && + git tag -a -m '1.0' v1.0 master && + git bundle create bundle4 v1.0 + +' + test_done -- cgit v1.2.3 From 77b258f436874bdd1caecd4b3c9c63e3d49bd147 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 11 Aug 2007 14:08:20 -0700 Subject: t3404: fix "fake-editor" Here-text to create fake-editor did not use <<\EOF but < --- t/t3404-rebase-interactive.sh | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index a9b552ff08..40d6799ed6 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -61,29 +61,31 @@ test_expect_success 'setup' ' git tag I ' -cat > fake-editor.sh << EOF +cat > fake-editor.sh <<\EOF #!/bin/sh -test "\$1" = .git/COMMIT_EDITMSG && { - test -z "\$FAKE_COMMIT_MESSAGE" || echo "\$FAKE_COMMIT_MESSAGE" > "\$1" - test -z "\$FAKE_COMMIT_AMEND" || echo "\$FAKE_COMMIT_AMEND" >> "\$1" +case "$1" in +*/COMMIT_EDITMSG) + test -z "$FAKE_COMMIT_MESSAGE" || echo "$FAKE_COMMIT_MESSAGE" > "$1" + test -z "$FAKE_COMMIT_AMEND" || echo "$FAKE_COMMIT_AMEND" >> "$1" exit -} -test -z "\$EXPECT_COUNT" || - test "\$EXPECT_COUNT" = \$(grep -ve "^#" -e "^$" < "\$1" | wc -l) || + ;; +esac +test -z "$EXPECT_COUNT" || + test "$EXPECT_COUNT" = $(sed -e '/^#/d' -e '/^$/d' < "$1" | wc -l) || exit -test -z "\$FAKE_LINES" && exit -grep -v "^#" < "\$1" > "\$1".tmp -rm "\$1" -cat "\$1".tmp +test -z "$FAKE_LINES" && exit +grep -v '^#' < "$1" > "$1".tmp +rm -f "$1" +cat "$1".tmp action=pick -for line in \$FAKE_LINES; do - case \$line in +for line in $FAKE_LINES; do + case $line in squash) - action="\$line";; + action="$line";; *) - echo sed -n "\${line}s/^pick/\$action/p" - sed -n "\${line}p" < "\$1".tmp - sed -n "\${line}s/^pick/\$action/p" < "\$1".tmp >> "\$1" + echo sed -n "${line}s/^pick/$action/p" + sed -n "${line}p" < "$1".tmp + sed -n "${line}s/^pick/$action/p" < "$1".tmp >> "$1" action=pick;; esac done -- cgit v1.2.3 From d616813d75b888b7c29bbad19808fe5cffa5380c Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sat, 11 Aug 2007 23:59:01 +0200 Subject: git-add: Add support for --refresh option. This allows to refresh only a subset of the project files, based on the specified pathspecs. Signed-off-by: Alexandre Julliard Signed-off-by: Junio C Hamano --- t/t3700-add.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 't') diff --git a/t/t3700-add.sh b/t/t3700-add.sh index 213e9249da..a328bf57eb 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -143,4 +143,16 @@ test_expect_success 'git add with filemode=0, symlinks=0 prefers stage 2 over st git ls-files --stage | grep "^120000 .* 0 symlink$" ' +test_expect_success 'git add --refresh' ' + >foo && git add foo && git commit -a -m "commit all" && + test -z "`git diff-index HEAD -- foo`" && + git read-tree HEAD && + case "`git diff-index HEAD -- foo`" in + :100644" "*"M foo") echo ok;; + *) echo fail; (exit 1);; + esac && + git add --refresh -- foo && + test -z "`git diff-index HEAD -- foo`" +' + test_done -- cgit v1.2.3 From 95eb6853af73ba91188a481a882076fa2639f15f Mon Sep 17 00:00:00 2001 From: Mark Levedahl Date: Sun, 12 Aug 2007 11:24:30 -0400 Subject: t3902 - skip test if file system doesn't support HT in names Windows / cygwin don't support HT, LF, or TAB in file name so this test is meaningless there. Signed-off-by: Mark Levedahl Signed-off-by: Junio C Hamano --- t/t3902-quoted.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 't') diff --git a/t/t3902-quoted.sh b/t/t3902-quoted.sh index 63f950b179..245fb3babd 100755 --- a/t/t3902-quoted.sh +++ b/t/t3902-quoted.sh @@ -7,6 +7,12 @@ test_description='quoted output' . ./test-lib.sh +P1='pathname with HT' +: >"$P1" 2>&1 && test -f "$P1" && rm -f "$P1" || { + echo >&2 'Filesystem does not support HT in names' + test_done +} + FN='濱野' GN='純' HT=' ' -- cgit v1.2.3 From 70f64148bf7ca5136f2aa18c41b3b8f4bebfd138 Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Sat, 11 Aug 2007 15:24:29 -0400 Subject: Fix t5701-clone-local for white space from wc Signed-off-by: Brian Gernhardt Signed-off-by: Junio C Hamano --- t/t5701-clone-local.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t5701-clone-local.sh b/t/t5701-clone-local.sh index a3026ec4fc..56f9d8ae73 100755 --- a/t/t5701-clone-local.sh +++ b/t/t5701-clone-local.sh @@ -48,7 +48,7 @@ test_expect_success 'With -no-hardlinks, local will make a copy' ' git clone --bare --no-hardlinks x w && cd w && linked=$(find objects -type f ! -links 1 | wc -l) && - test "$linked" = 0 + test 0 = $linked ' test_expect_success 'Even without -l, local will make a hardlink' ' @@ -57,7 +57,7 @@ test_expect_success 'Even without -l, local will make a hardlink' ' git clone -l --bare x w && cd w && copied=$(find objects -type f -links 1 | wc -l) && - test "$copied" = 0 + test 0 = $copied ' test_done -- cgit v1.2.3 From 30c5cd312472574f6a8d8c82ba7c4af76d43ff7c Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Mon, 13 Aug 2007 07:38:11 +0200 Subject: Add a test for git-commit being confused by relative GIT_DIR Signed-off-by: David Kastrup Signed-off-by: Junio C Hamano --- t/t2050-git-dir-relative.sh | 55 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 t/t2050-git-dir-relative.sh (limited to 't') diff --git a/t/t2050-git-dir-relative.sh b/t/t2050-git-dir-relative.sh new file mode 100755 index 0000000000..88f268b9d7 --- /dev/null +++ b/t/t2050-git-dir-relative.sh @@ -0,0 +1,55 @@ +#!/bin/sh + +test_description='check problems with relative GIT_DIR + +This test creates a working tree state with a file and subdir: + + top (committed several times) + subdir (a subdirectory) + +It creates a commit-hook and tests it, then moves .git +into the subdir while keeping the worktree location, +and tries commits from the top and the subdir, checking +that the commit-hook still gets called.' + +. ./test-lib.sh + +COMMIT_FILE="$(pwd)/output" +export COMMIT_FILE + +test_expect_success 'Setting up post-commit hook' ' +mkdir -p .git/hooks && +echo >.git/hooks/post-commit "#!/bin/sh +touch \"\${COMMIT_FILE}\" +echo Post commit hook was called." && +chmod +x .git/hooks/post-commit' + +test_expect_success 'post-commit hook used ordinarily' ' +echo initial >top && +git-add top +git-commit -m initial && +test -r "${COMMIT_FILE}" +' + +rm -rf "${COMMIT_FILE}" +mkdir subdir +mv .git subdir + +test_expect_success 'post-commit-hook created and used from top dir' ' +echo changed >top && +git --git-dir subdir/.git add top && +git --git-dir subdir/.git commit -m topcommit && +test -r "${COMMIT_FILE}" +' + +rm -rf "${COMMIT_FILE}" + +test_expect_success 'post-commit-hook from sub dir' ' +echo changed again >top +cd subdir && +git --git-dir .git --work-tree .. add ../top && +git --git-dir .git --work-tree .. commit -m subcommit && +test -r "${COMMIT_FILE}" +' + +test_done -- cgit v1.2.3 From b798671fa935492ce511766bc99fb26b2892499b Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 14 Aug 2007 15:33:07 -0700 Subject: merge-recursive: do not rudely die on binary merge When you try to merge a path that involves binary file-level merge, merge-recursive died rudely without cleaning up its own mess. A files added by the merge were left in the working tree, but the index was not written out (because it just punted and died), so it was cumbersome for the user to retry it by first running "git reset --hard". This changes merge-recursive to still warn but do the "binary" merge for such a path; leave the "our" version in the working tree, but still keep the path unmerged so that the user can sort it out. Signed-off-by: Junio C Hamano --- t/t6027-merge-binary.sh | 67 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 t/t6027-merge-binary.sh (limited to 't') diff --git a/t/t6027-merge-binary.sh b/t/t6027-merge-binary.sh new file mode 100755 index 0000000000..a7358f75b1 --- /dev/null +++ b/t/t6027-merge-binary.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +test_description='ask merge-recursive to merge binary files' + +. ./test-lib.sh + +test_expect_success setup ' + + cat ../test4012.png >m && + git add m && + git ls-files -s | sed -e "s/ 0 / 1 /" >E1 && + test_tick && + git commit -m "initial" && + + git branch side && + echo frotz >a && + git add a && + echo nitfol >>m && + git add a m && + git ls-files -s a >E0 && + git ls-files -s m | sed -e "s/ 0 / 3 /" >E3 && + test_tick && + git commit -m "master adds some" && + + git checkout side && + echo rezrov >>m && + git add m && + git ls-files -s m | sed -e "s/ 0 / 2 /" >E2 && + test_tick && + git commit -m "side modifies" && + + git tag anchor && + + cat E0 E1 E2 E3 >expect +' + +test_expect_success resolve ' + + rm -f a* m* && + git reset --hard anchor && + + if git merge -s resolve master + then + echo Oops, should not have succeeded + false + else + git ls-files -s >current + diff -u current expect + fi +' + +test_expect_success recursive ' + + rm -f a* m* && + git reset --hard anchor && + + if git merge -s recursive master + then + echo Oops, should not have succeeded + false + else + git ls-files -s >current + diff -u current expect + fi +' + +test_done -- cgit v1.2.3 From 1a9d7e9b484e77436edc7f5cacd39c24ec605e6d Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 14 Aug 2007 01:41:02 -0700 Subject: attr.c: read .gitattributes from index as well. This makes .gitattributes files to be read from the index when they are not checked out to the work tree. This is in line with the way we always allowed low-level tools to operate in sparsely checked out work tree in a reasonable way. It swaps the order of new file creation and converting the blob to work tree representation; otherwise when we are in the middle of checking out .gitattributes we would notice an empty but unwritten .gitattributes file in the work tree and will ignore the copy in the index. Signed-off-by: Junio C Hamano --- t/t0020-crlf.sh | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) (limited to 't') diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh index fe1dfd08a0..0807d9f01a 100755 --- a/t/t0020-crlf.sh +++ b/t/t0020-crlf.sh @@ -290,4 +290,85 @@ test_expect_success '.gitattributes says two and three are text' ' fi ' +test_expect_success 'in-tree .gitattributes (1)' ' + + echo "one -crlf" >>.gitattributes && + git add .gitattributes && + git commit -m "Add .gitattributes" && + + rm -rf tmp one dir .gitattributes patch.file three && + git read-tree --reset -u HEAD && + + if remove_cr one >/dev/null + then + echo "Eh? one should not have CRLF" + false + else + : happy + fi && + remove_cr three >/dev/null || { + echo "Eh? three should still have CRLF" + false + } +' + +test_expect_success 'in-tree .gitattributes (2)' ' + + rm -rf tmp one dir .gitattributes patch.file three && + git read-tree --reset HEAD && + git checkout-index -f -q -u -a && + + if remove_cr one >/dev/null + then + echo "Eh? one should not have CRLF" + false + else + : happy + fi && + remove_cr three >/dev/null || { + echo "Eh? three should still have CRLF" + false + } +' + +test_expect_success 'in-tree .gitattributes (3)' ' + + rm -rf tmp one dir .gitattributes patch.file three && + git read-tree --reset HEAD && + git checkout-index -u .gitattributes && + git checkout-index -u one dir/two three && + + if remove_cr one >/dev/null + then + echo "Eh? one should not have CRLF" + false + else + : happy + fi && + remove_cr three >/dev/null || { + echo "Eh? three should still have CRLF" + false + } +' + +test_expect_success 'in-tree .gitattributes (4)' ' + + rm -rf tmp one dir .gitattributes patch.file three && + git read-tree --reset HEAD && + git checkout-index -u one dir/two three && + git checkout-index -u .gitattributes && + + if remove_cr one >/dev/null + then + echo "Eh? one should not have CRLF" + false + else + : happy + fi && + remove_cr three >/dev/null || { + echo "Eh? three should still have CRLF" + false + } +' + test_done -- cgit v1.2.3 From 6ed77266c6e85130920ef30cd290d36ad4464695 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 15 Aug 2007 09:55:18 -0700 Subject: git-svn: fix log with single revision against a non-HEAD branch Running git-svn log -r against a other than the current HEAD did not work if the was exclusive to the other branch. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/t9116-git-svn-log.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 t/t9116-git-svn-log.sh (limited to 't') diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh new file mode 100755 index 0000000000..0d4e6b3f04 --- /dev/null +++ b/t/t9116-git-svn-log.sh @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Copyright (c) 2007 Eric Wong +# + +test_description='git-svn log tests' +. ./lib-git-svn.sh + +test_expect_success 'setup repository and import' " + mkdir import && + cd import && + for i in trunk branches/a branches/b \ + tags/0.1 tags/0.2 tags/0.3; do + mkdir -p \$i && \ + echo hello >> \$i/README || exit 1 + done && \ + svn import -m test . $svnrepo + cd .. && + git-svn init $svnrepo -T trunk -b branches -t tags && + git-svn fetch && + git reset --hard trunk && + echo bye >> README && + git commit -a -m bye && + git svn dcommit && + git reset --hard a && + echo why >> FEEDME && + git update-index --add FEEDME && + git commit -m feedme && + git svn dcommit && + git reset --hard trunk && + echo aye >> README && + git commit -a -m aye && + git svn dcommit + " + +test_expect_success 'run log' " + git reset --hard a && + git svn log -r2 trunk | grep ^r2 && + git svn log -r4 trunk | grep ^r4 && + git svn log -r3 | grep ^r3 + " + +test_expect_success 'run log against a from trunk' " + git reset --hard trunk && + git svn log -r3 a | grep ^r3 + " + +test_done -- cgit v1.2.3 From a4882c27f8b3793d94b03fd503a0c67ad9772cf6 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 15 Aug 2007 14:12:14 -0700 Subject: Fix "git add -u" data corruption. This applies to 'maint' to fix a rather serious data corruption issue. When "git add -u" affects a subdirectory in such a way that the only changes to its contents are path removals, the next tree object written out of that index was bogus, as the remove codepath forgot to invalidate the cache-tree entry. Reported by Salikh Zakirov. Signed-off-by: Junio C Hamano --- t/t2200-add-update.sh | 59 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 43 insertions(+), 16 deletions(-) (limited to 't') diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh index 83005e70d0..4c7c6af432 100755 --- a/t/t2200-add-update.sh +++ b/t/t2200-add-update.sh @@ -13,26 +13,53 @@ only the updates to dir/sub.' . ./test-lib.sh -test_expect_success 'setup' ' -echo initial >top && -mkdir dir && -echo initial >dir/sub && -git-add dir/sub top && -git-commit -m initial && -echo changed >top && -echo changed >dir/sub && -echo other >dir/other +test_expect_success setup ' + echo initial >check && + echo initial >top && + mkdir dir1 dir2 && + echo initial >dir1/sub1 && + echo initial >dir1/sub2 && + echo initial >dir2/sub3 && + git add check dir1 dir2 top && + test_tick + git-commit -m initial && + + echo changed >check && + echo changed >top && + echo changed >dir2/sub3 && + rm -f dir1/sub1 && + echo other >dir2/other +' + +test_expect_success update ' + git add -u dir1 dir2 ' -test_expect_success 'update' 'git-add -u dir' +test_expect_success 'update noticed a removal' ' + test "$(git-ls-files dir1/sub1)" = "" +' -test_expect_success 'update touched correct path' \ - 'test "`git-diff-files --name-status dir/sub`" = ""' +test_expect_success 'update touched correct path' ' + test "$(git-diff-files --name-status dir2/sub3)" = "" +' -test_expect_success 'update did not touch other tracked files' \ - 'test "`git-diff-files --name-status top`" = "M top"' +test_expect_success 'update did not touch other tracked files' ' + test "$(git-diff-files --name-status check)" = "M check" && + test "$(git-diff-files --name-status top)" = "M top" +' -test_expect_success 'update did not touch untracked files' \ - 'test "`git-diff-files --name-status dir/other`" = ""' +test_expect_success 'update did not touch untracked files' ' + test "$(git-ls-files dir2/other)" = "" +' + +test_expect_success 'cache tree has not been corrupted' ' + + git ls-files -s | + sed -e "s/ 0 / /" >expect && + git ls-tree -r $(git write-tree) | + sed -e "s/ blob / /" >current && + diff -u expect current + +' test_done -- cgit v1.2.3 From 2ed2c222dfe372385dc562fb5dc246d5595c1eae Mon Sep 17 00:00:00 2001 From: Salikh Zakirov Date: Thu, 16 Aug 2007 02:01:43 +0900 Subject: git-add -u paths... now works from subdirectory git-add -u also takes the path limiters, but unlike the command without the -u option, the code forgot that it could be invoked from a subdirectory, and did not correctly handle the prefix. Signed-off-by: Salikh Zakirov Signed-off-by: Junio C Hamano --- t/t2200-add-update.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 't') diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh index 4c7c6af432..58cd7f31be 100755 --- a/t/t2200-add-update.sh +++ b/t/t2200-add-update.sh @@ -62,4 +62,18 @@ test_expect_success 'cache tree has not been corrupted' ' ' +test_expect_success 'update from a subdirectory' ' + ( + cd dir1 && + echo more >sub2 && + git add -u sub2 + ) +' + +test_expect_success 'change gets noticed' ' + + test "$(git diff-files --name-status dir1)" = "" + +' + test_done -- cgit v1.2.3 From e06c5a6c7bdaa8c96b72e29f7fb49a331f1e0cc2 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Wed, 15 Aug 2007 19:22:09 +0200 Subject: git-apply: apply submodule changes Apply "Subproject commit HEX" changes produced by git-diff. As usual in the current git, only the superproject itself is actually modified (possibly creating empty directories for new submodules). Any checked-out submodule is left untouched and is not required to be up-to-date. With clean-ups from Junio C Hamano. Signed-off-by: Sven Verdoolaege Signed-off-by: Junio C Hamano --- t/t7400-submodule-basic.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 't') diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index e8ce7cdb83..9d142ed649 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -175,4 +175,21 @@ test_expect_success 'checkout superproject with subproject already present' ' git-checkout master ' +test_expect_success 'apply submodule diff' ' + git branch second && + ( + cd lib && + echo s >s && + git add s && + git commit -m "change subproject" + ) && + git update-index --add lib && + git-commit -m "change lib" && + git-format-patch -1 --stdout >P.diff && + git checkout second && + git apply --index P.diff && + D=$(git diff --cached master) && + test -z "$D" +' + test_done -- cgit v1.2.3 From 312efe9b58edb428132f0bf0fdc7f3d6a41f1183 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 15 Aug 2007 20:55:44 -0700 Subject: git-clone: allow --bare clone This is a stop-gap to work around problem with git-init without intrusive changes. Signed-off-by: Junio C Hamano --- t/t5701-clone-local.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t5701-clone-local.sh b/t/t5701-clone-local.sh index 56f9d8ae73..822ac8c28e 100755 --- a/t/t5701-clone-local.sh +++ b/t/t5701-clone-local.sh @@ -8,13 +8,16 @@ D=`pwd` test_expect_success 'preparing origin repository' ' : >file && git add . && git commit -m1 && git clone --bare . a.git && - git clone --bare . x + git clone --bare . x && + test "$(GIT_CONFIG=a.git/config git config --bool core.bare)" = true && + test "$(GIT_CONFIG=x/config git config --bool core.bare)" = true ' test_expect_success 'local clone without .git suffix' ' cd "$D" && git clone -l -s a b && cd b && + test "$(GIT_CONFIG=.git/config git config --bool core.bare)" = false && git fetch ' -- cgit v1.2.3 From 19b28bf5454380f9f65063e8bc3cdee669e731a9 Mon Sep 17 00:00:00 2001 From: Arjen Laarhoven Date: Fri, 17 Aug 2007 00:02:17 +0200 Subject: t1301-shared-repo.sh: fix 'stat' portability issue The t1301-shared-repo.sh testscript uses /usr/bin/stat to get the file mode, which isn't portable. Implement the test in shell using 'ls' as shown by Junio. Signed-off-by: Arjen Laarhoven Signed-off-by: Junio C Hamano --- t/t1301-shared-repo.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh index bb5f30220a..6bfe19a4e5 100755 --- a/t/t1301-shared-repo.sh +++ b/t/t1301-shared-repo.sh @@ -21,7 +21,16 @@ test_expect_success 'update-server-info honors core.sharedRepository' ' git commit -m a1 && umask 0277 && git update-server-info && - test 444 = $(stat -c %a .git/info/refs) + actual="$(ls -l .git/info/refs)" && + case "$actual" in + -r--r--r--*) + : happy + ;; + *) + echo Oops, .git/info/refs is not 0444 + false + ;; + esac ' test_done -- cgit v1.2.3 From ea08a6fd194991f9d800e4cac5ae55fdb02dd235 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 2 Aug 2007 23:37:21 -0400 Subject: Actually allow TAG_FIXUP branches in fast-import Michael Haggerty noticed while debugging a Git backend for cvs2svn that fast-import was barfing when he tried to use "TAG_FIXUP" as a branch name for temporary work needed to cleanup the tree prior to creating an annotated tag object. The reason we were rejecting the branch name was check_ref_format() returns -2 when there are less than 2 '/' characters in the input name. TAG_FIXUP has 0 '/' characters, but is technically just as valid of a ref as HEAD and MERGE_HEAD, so we really should permit it (and any other similar looking name) during import. New test cases have been added to make sure we still detect very wrong branch names (e.g. containing [ or starting with .) and yet still permit reasonable names (e.g. TAG_FIXUP). Signed-off-by: Shawn O. Pearce --- t/t9300-fast-import.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 't') diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 6f95305bf4..dac6135b22 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -170,6 +170,53 @@ test_expect_failure \ 'git-fast-import input < $GIT_COMMITTER_DATE +data <input < $GIT_COMMITTER_DATE +data <input < $GIT_COMMITTER_DATE +data < Date: Wed, 1 Aug 2007 00:05:15 -0400 Subject: Teach fast-import to ignore lines starting with '#' Several frontend developers have asked that some form of stream comments be permitted within a fast-import data stream. This way they can include information from their own frontend program about where specific data was taken from in the source system, or about a decision that their frontend may have made while creating the fast-import data stream. This change introduces comments in the Bourne-shell/Tcl/Perl style. Lines starting with '#' are ignored, up to and including the LF. Unlike the above mentioned three languages however we do not look for and ignore leading whitespace. This just simplifies the definition of the comment format and the code that parses them. To make comments work we had to stop using read_next_command() within cmd_data() and directly invoke read_line() during the inline variant of the function. This is necessary to retain any lines of the input data that might otherwise look like a comment to fast-import. Signed-off-by: Shawn O. Pearce --- t/t9300-fast-import.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 't') diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index dac6135b22..1f6426a49e 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -778,4 +778,44 @@ test_expect_success \ 'git-fast-import input < $GIT_COMMITTER_DATE +# $GIT_COMMITTER_NAME has inserted here for his benefit. +data < Date: Wed, 1 Aug 2007 00:24:25 -0400 Subject: Make trailing LF following fast-import `data` commands optional A few fast-import frontend developers have found it odd that we require the LF following a `data` command, especially in the exact byte count format. Technically we don't need this LF to parse the stream properly, but having it here does make the stream more readable to humans. We can easily make the LF optional by peeking at the next byte available from the stream and pushing it back into the buffer if its not LF. Signed-off-by: Shawn O. Pearce --- t/t9300-fast-import.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 't') diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 1f6426a49e..5be6f196bd 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -818,4 +818,25 @@ test_expect_success \ 'git-fast-import input < $GIT_COMMITTER_DATE +data < Date: Wed, 1 Aug 2007 02:22:53 -0400 Subject: Make trailing LF optional for all fast-import commands For the same reasons as the prior change we want to allow frontends to omit the trailing LF that usually delimits commands. In some cases these just make the input stream more verbose looking than it needs to be, and its just simpler for the frontend developer to get started if our parser is slightly more lenient about where an LF is required and where it isn't. To make this optional LF feature work we now have to buffer up to one line of input in command_buf. This buffering can happen if we look at the current input command but don't recognize it at this point in the code. In such a case we need to "unget" the entire line, but we cannot depend upon the stdio library to let us do ungetc() for that many characters at once. Signed-off-by: Shawn O. Pearce --- t/t9300-fast-import.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 't') diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 5be6f196bd..5d82b0f1ce 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -839,4 +839,50 @@ test_expect_success \ 'git-fast-import input < $GIT_COMMITTER_DATE +data < $GIT_COMMITTER_DATE +data < $GIT_COMMITTER_DATE +data < $GIT_COMMITTER_DATE +data <expect <actual && + git diff expect actual' + test_done -- cgit v1.2.3 From ac053c02029d88c7ed4d7e92949a1586eb3f7704 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 1 Aug 2007 10:23:08 -0400 Subject: Allow frontends to bidirectionally communicate with fast-import The existing checkpoint command is very useful to force fast-import to dump the branches out to disk so that standard Git tools can access them and the objects they refer to. However there was not a way to know when fast-import had finished executing the checkpoint and it was safe to read those refs. The progress command can be used to make fast-import output any message of the frontend's choosing to standard out. The frontend can scan for these messages using select() or poll() to monitor a pipe connected to the standard output of fast-import. Signed-off-by: Shawn O. Pearce --- t/t9300-fast-import.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 't') diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 5d82b0f1ce..0595041af5 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -885,4 +885,35 @@ test_expect_success \ git log --reverse --pretty=oneline O3 | sed s/^.*z// >actual && git diff expect actual' +cat >input < $GIT_COMMITTER_DATE +data < $GIT_COMMITTER_DATE +data < $GIT_COMMITTER_DATE +data < $GIT_COMMITTER_DATE +data <actual && + grep "progress " expect && + git diff expect actual' + test_done -- cgit v1.2.3 From 1211be6bed1146dcef953c7c2ab332ee995f7152 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 17 Aug 2007 09:56:54 -0700 Subject: Make thin-pack generation subproject aware. When a thin pack wants to send a tree object at "sub/dir", and the commit that is common between the sender and the receiver that is used as the base object has a subproject at that path, we should not try to use the data at "sub/dir" of the base tree as a tree object. It is not a tree to begin with, and more importantly, the commit object there does not have to even exist. Signed-off-by: Junio C Hamano --- t/t3050-subprojects-fetch.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 t/t3050-subprojects-fetch.sh (limited to 't') diff --git a/t/t3050-subprojects-fetch.sh b/t/t3050-subprojects-fetch.sh new file mode 100755 index 0000000000..34f26a8d9e --- /dev/null +++ b/t/t3050-subprojects-fetch.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +test_description='fetching and pushing project with subproject' + +. ./test-lib.sh + +test_expect_success setup ' + test_tick && + mkdir -p sub && ( + cd sub && + git init && + >subfile && + git add subfile + git commit -m "subproject commit #1" + ) && + >mainfile + git add sub mainfile && + test_tick && + git commit -m "superproject commit #1" +' + +test_expect_success clone ' + git clone file://`pwd`/.git cloned && + (git rev-parse HEAD; git ls-files -s) >expected && + ( + cd cloned && + (git rev-parse HEAD; git ls-files -s) >../actual + ) && + diff -u expected actual +' + +test_expect_success advance ' + echo more >mainfile && + git update-index --force-remove sub && + mv sub/.git sub/.git-disabled && + git add sub/subfile mainfile && + mv sub/.git-disabled sub/.git && + test_tick && + git commit -m "superproject commit #2" +' + +test_expect_success fetch ' + (git rev-parse HEAD; git ls-files -s) >expected && + ( + cd cloned && + git pull && + (git rev-parse HEAD; git ls-files -s) >../actual + ) && + diff -u expected actual +' + +test_done -- cgit v1.2.3 From 1d25c8cf82eead72e11287d574ef72d3ebec0db1 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 23 Aug 2007 09:55:41 +0100 Subject: rebase -i: fix squashing corner case When squashing, rebase -i did not prevent fast forwards. This could happen when picking some other commit than the first one, and then squashing the first commit. So do not allow fast forwards when squashing. Noticed by Johannes Sixt. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 40d6799ed6..718c9c1fa3 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -264,6 +264,27 @@ test_expect_success 'interrupted squash works as expected' ' test $one = $(git rev-parse HEAD~2) ' +test_expect_success 'interrupted squash works as expected (case 2)' ' + for n in one two three four + do + echo $n >> conflict && + git add conflict && + git commit -m $n + done && + one=$(git rev-parse HEAD~3) && + ! FAKE_LINES="3 squash 1 2" git rebase -i HEAD~3 && + (echo one; echo four) > conflict && + git add conflict && + ! git rebase --continue && + (echo one; echo two; echo four) > conflict && + git add conflict && + ! git rebase --continue && + echo resolved > conflict && + git add conflict && + git rebase --continue && + test $one = $(git rev-parse HEAD~2) +' + test_expect_success 'ignore patch if in upstream' ' HEAD=$(git rev-parse HEAD) && git checkout -b has-cherry-picked HEAD^ && -- cgit v1.2.3 From 9ec398d200cb07534a92045104862d681c7a7da2 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 23 Aug 2007 10:18:54 -0700 Subject: Fix racy-git handling in git-write-tree. After git-write-tree finishes computing the tree, it updates the index so that later operations can take advantage of fully populated cache tree. However, anybody writing the index file has to mark the entries that are racily clean. For each entry whose cached lstat(3) data in the index exactly matches what is obtained from the filesystem, if the timestamp on the index file was the same or older than the modification timestamp of the file, the blob contents and the work tree file, after convert_to_git(), need to be compared, and if they are different, its index entry needs to be marked not to match the lstat(3) data from the filesystem. In order for this to work, convert_to_git() needs to work correctly, which in turn means you need to read the config file to get the settings of core.crlf and friends. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- t/t0023-crlf-am.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 t/t0023-crlf-am.sh (limited to 't') diff --git a/t/t0023-crlf-am.sh b/t/t0023-crlf-am.sh new file mode 100755 index 0000000000..6f8a4347d5 --- /dev/null +++ b/t/t0023-crlf-am.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +test_description='Test am with auto.crlf' + +. ./test-lib.sh + +cat >patchfile <<\EOF +From 38be10072e45dd6b08ce40851e3fca60a31a340b Mon Sep 17 00:00:00 2001 +From: Marius Storm-Olsen +Date: Thu, 23 Aug 2007 13:00:00 +0200 +Subject: test1 + +--- + foo | 1 + + 1 files changed, 1 insertions(+), 0 deletions(-) + create mode 100644 foo + +diff --git a/foo b/foo +new file mode 100644 +index 0000000000000000000000000000000000000000..5716ca5987cbf97d6bb54920bea6adde242d87e6 +--- /dev/null ++++ b/foo +@@ -0,0 +1 @@ ++bar +EOF + +test_expect_success 'setup' ' + + git config core.autocrlf true && + echo foo >bar && + git add bar && + test_tick && + git commit -m initial + +' + +test_expect_success 'am' ' + + git am --binary -3 Date: Mon, 27 Aug 2007 00:58:06 -0700 Subject: Fix initialization of a bare repository Here is my attempt to fix this with a minimally intrusive patch. * As "git --bare init" cannot tell if it was called with --bare or just "GIT_DIR=. git init", I added an explicit assignment of is_bare_repository_cfg on the codepath for "git --bare". * GIT_WORK_TREE alone without GIT_DIR does not make any sense, nor GIT_WORK_TREE with an explicit "git --bare". Catch that mistake. It might make sense to move this check to "git.c" side as well, but I tried to shoot for the minimum change for now. * Some scripts, especially from the olden days, rely on traditional GIT_DIR behaviour in "git init". Namely, these are some notable patterns: (create a bare repository) - mkdir some.git && cd some.git && GIT_DIR=. git init - mkdir some.git && cd some.git && git --bare init (create a non-bare repository) - mkdir .git && GIT_DIR=.git git init - mkdir .git && GIT_DIR=`pwd`/.git git init This comes with a new test script and also passes the existing test suite, but there may be cases that are still broken with the current tip of master and this patch does not yet fix. I'd appreciate help in straightening this mess out. Signed-off-by: Junio C Hamano --- t/t0001-init.sh | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100755 t/t0001-init.sh (limited to 't') diff --git a/t/t0001-init.sh b/t/t0001-init.sh new file mode 100755 index 0000000000..b14b3ec394 --- /dev/null +++ b/t/t0001-init.sh @@ -0,0 +1,116 @@ +#!/bin/sh + +test_description='git init' + +. ./test-lib.sh + +check_config () { + if test -d "$1" && test -f "$1/config" && test -d "$1/refs" + then + : happy + else + echo "expected a directory $1, a file $1/config and $1/refs" + return 1 + fi + bare=$(GIT_CONFIG="$1/config" git config --bool core.bare) + worktree=$(GIT_CONFIG="$1/config" git config core.worktree) || + worktree=unset + + test "$bare" = "$2" && test "$worktree" = "$3" || { + echo "expected bare=$2 worktree=$3" + echo " got bare=$bare worktree=$worktree" + return 1 + } +} + +test_expect_success 'plain' ' + ( + unset GIT_DIR GIT_WORK_TREE && + mkdir plain && + cd plain && + git init + ) && + check_config plain/.git false unset +' + +test_expect_success 'plain with GIT_WORK_TREE' ' + if ( + unset GIT_DIR && + mkdir plain-wt && + cd plain-wt && + GIT_WORK_TREE=$(pwd) git init + ) + then + echo Should have failed -- GIT_WORK_TREE should not be used + false + fi +' + +test_expect_success 'plain bare' ' + ( + unset GIT_DIR GIT_WORK_TREE GIT_CONFIG && + mkdir plain-bare-1 && + cd plain-bare-1 && + git --bare init + ) && + check_config plain-bare-1 true unset +' + +test_expect_success 'plain bare with GIT_WORK_TREE' ' + if ( + unset GIT_DIR GIT_CONFIG && + mkdir plain-bare-2 && + cd plain-bare-2 && + GIT_WORK_TREE=$(pwd) git --bare init + ) + then + echo Should have failed -- GIT_WORK_TREE should not be used + false + fi +' + +test_expect_success 'GIT_DIR bare' ' + + ( + unset GIT_CONFIG && + mkdir git-dir-bare.git && + GIT_DIR=git-dir-bare.git git init + ) && + check_config git-dir-bare.git true unset +' + +test_expect_success 'GIT_DIR non-bare' ' + + ( + unset GIT_CONFIG && + mkdir non-bare && + cd non-bare && + GIT_DIR=.git git init + ) && + check_config non-bare/.git false unset +' + +test_expect_success 'GIT_DIR & GIT_WORK_TREE (1)' ' + + ( + unset GIT_CONFIG && + mkdir git-dir-wt-1.git && + GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-1.git git init + ) && + check_config git-dir-wt-1.git false "$(pwd)" +' + +test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' ' + + if ( + unset GIT_CONFIG && + mkdir git-dir-wt-2.git && + GIT_WORK_TREE=$(pwd) GIT_DIR=git-dir-wt-2.git git --bare init + ) + then + echo Should have failed -- --bare should not be used + false + fi +' + +test_done -- cgit v1.2.3 From a005085240ef77ac0dde8eb08e27c6ef868d4bab Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 15 Aug 2007 23:19:55 -0700 Subject: git-merge: do up-to-date check also for all strategies This clarifies the logic to omit fast-forward check and omit trivial merge before running the specified strategy. The "index_merge" variable started out as a flag to say "do not do anything clever", but when recursive was changed to skip the trivial merge, the semantics were changed and the variable alone does not make sense anymore. This splits the variable into two, allow_fast_forward (which is almost always true, and avoids making a merge commit when the other commit is a descendant of our branch, but is set to false for ours and subtree) and allow_trivial_merge (which is false for ours, recursive and subtree). Unlike the earlier implementation, the "ours" strategy allows an up-to-date condition. When we are up-to-date, the result will be our commit, and by definition, we will have our tree as the result. Signed-off-by: Junio C Hamano --- t/t6028-merge-up-to-date.sh | 77 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100755 t/t6028-merge-up-to-date.sh (limited to 't') diff --git a/t/t6028-merge-up-to-date.sh b/t/t6028-merge-up-to-date.sh new file mode 100755 index 0000000000..f8f3e3ff2c --- /dev/null +++ b/t/t6028-merge-up-to-date.sh @@ -0,0 +1,77 @@ +#!/bin/sh + +test_description='merge fast forward and up to date' + +. ./test-lib.sh + +test_expect_success setup ' + >file && + git add file && + test_tick && + git commit -m initial && + git tag c0 && + + echo second >file && + git add file && + test_tick && + git commit -m second && + git tag c1 && + git branch test +' + +test_expect_success 'merge -s recursive up-to-date' ' + + git reset --hard c1 && + test_tick && + git merge -s recursive c0 && + expect=$(git rev-parse c1) && + current=$(git rev-parse HEAD) && + test "$expect" = "$current" + +' + +test_expect_success 'merge -s recursive fast-forward' ' + + git reset --hard c0 && + test_tick && + git merge -s recursive c1 && + expect=$(git rev-parse c1) && + current=$(git rev-parse HEAD) && + test "$expect" = "$current" + +' + +test_expect_success 'merge -s ours up-to-date' ' + + git reset --hard c1 && + test_tick && + git merge -s ours c0 && + expect=$(git rev-parse c1) && + current=$(git rev-parse HEAD) && + test "$expect" = "$current" + +' + +test_expect_success 'merge -s ours fast-forward' ' + + git reset --hard c0 && + test_tick && + git merge -s ours c1 && + expect=$(git rev-parse c0^{tree}) && + current=$(git rev-parse HEAD^{tree}) && + test "$expect" = "$current" + +' + +test_expect_success 'merge -s subtree up-to-date' ' + + git reset --hard c1 && + test_tick && + git merge -s subtree c0 && + expect=$(git rev-parse c1) && + current=$(git rev-parse HEAD) && + test "$expect" = "$current" + +' + +test_done -- cgit v1.2.3 From 7e0f1704b837355d833d84d18a3811d145867b97 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 31 Aug 2007 20:05:36 +0100 Subject: filter-branch: provide the convenience functions also for commit filters Move the convenience functions to the top of git-filter-branch.sh, and return from the script when the environment variable SOURCE_FUNCTIONS is set. By sourcing git-filter-branch with that variable set automatically, all commit filters may access the convenience functions like "map". Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7003-filter-branch.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 't') diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index bc6e2ddb19..c79853d986 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -159,4 +159,14 @@ test_expect_success 'barf on invalid name' ' ! git filter-branch -f HEAD^ ' +test_expect_success '"map" works in commit filter' ' + git filter-branch -f --commit-filter "\ + parent=\$(git rev-parse \$GIT_COMMIT^) && + mapped=\$(map \$parent) && + actual=\$(echo \"\$@\" | sed \"s/^.*-p //\") && + test \$mapped = \$actual && + git commit-tree \"\$@\";" master~2..master && + git rev-parse --verify master +' + test_done -- cgit v1.2.3 From f95eef15f2f8a336b9a42749f5458c841a5a5d63 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 31 Aug 2007 20:06:27 +0100 Subject: filter-branch: introduce convenience function "skip_commit" With this function, a commit filter can leave out unwanted commits (such as temporary commits). It does _not_ undo the changeset corresponding to that commit, but it _skips_ the revision. IOW no tree object is changed by this. If you like to commit early and often, but want to filter out all intermediate commits, marked by "@@@" in the commit message, you can now do this with git filter-branch --commit-filter ' if git cat-file commit $GIT_COMMIT | grep '@@@' > /dev/null; then skip_commit "$@"; else git commit-tree "$@"; fi' newbranch Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7003-filter-branch.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 't') diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index c79853d986..e935b2000a 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -138,13 +138,7 @@ test_expect_success "remove a certain author's commits" ' git-filter-branch -f --commit-filter "\ if [ \"\$GIT_AUTHOR_NAME\" = \"B V Uips\" ];\ then\ - shift;\ - while [ -n \"\$1\" ];\ - do\ - shift;\ - echo \"\$1\";\ - shift;\ - done;\ + skip_commit \"\$@\"; else\ git commit-tree \"\$@\";\ fi" removed-author && -- cgit v1.2.3 From 751eb39590a1325e761a84bedd5ca2660d2d3497 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 31 Aug 2007 18:16:12 -0700 Subject: git-svn: fix dcommit clobbering upstream when committing multiple changes Although dcommit could detect if the first commit in the series would conflict with the HEAD revision in SVN, it could not detect conflicts in further commits it made. Now we rebase each uncommitted change after each revision is committed to SVN to ensure that we are up-to-date. git-rebase will bail out on conflict errors if our next change cannot be applied and committed to SVN cleanly, preventing accidental clobbering of changes on the SVN-side. --no-rebase users will have trouble with this, and are thus warned if they are committing more than one commit. Fixing this for (hopefully uncommon) --no-rebase users would be more complex and will probably happen at a later date. Thanks to David Watson for finding this and the original test. Signed-off-by: Junio C Hamano --- t/t9106-git-svn-commit-diff-clobber.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 't') diff --git a/t/t9106-git-svn-commit-diff-clobber.sh b/t/t9106-git-svn-commit-diff-clobber.sh index 6f132f2419..79b7968eaf 100755 --- a/t/t9106-git-svn-commit-diff-clobber.sh +++ b/t/t9106-git-svn-commit-diff-clobber.sh @@ -66,4 +66,34 @@ test_expect_success 'dcommit does the svn equivalent of an index merge' " git-svn dcommit " +test_expect_success 'commit another change from svn side' " + svn co $svnrepo t.svn && + cd t.svn && + echo third line from svn >> file && + poke file && + svn commit -m 'third line from svn' && + cd .. && + rm -rf t.svn + " + +test_expect_failure 'multiple dcommit from git-svn will not clobber svn' " + git reset --hard refs/remotes/git-svn && + echo new file >> new-file && + git update-index --add new-file && + git commit -a -m 'new file' && + echo clobber > file && + git commit -a -m 'clobber' && + git svn dcommit + " || true + + +test_expect_success 'check that rebase really failed' 'test -d .dotest' + +test_expect_success 'resolve, continue the rebase and dcommit' " + echo clobber and I really mean it > file && + git update-index file && + git rebase --continue && + git svn dcommit + " + test_done -- cgit v1.2.3 From 18e32b5b7af4175f852469159d004a2a8de64658 Mon Sep 17 00:00:00 2001 From: Carlos Rica Date: Sat, 1 Sep 2007 07:10:09 +0200 Subject: git-tag: Fix -l option to use better shell style globs. This patch removes certain behaviour of "git tag -l foo", currently listing every tag name having "foo" as a substring. The same thing now could be achieved doing "git tag -l '*foo*'". This feature was added recently when git-tag.sh got the -n option for showing tag annotations, because that commit also replaced the old "grep pattern" behaviour with a more preferable "shell pattern" behaviour (although slightly modified as you can see). Thus, the following builtin-tag.c implemented it in order to ensure that tests were passing unchanged with both programs. Since common "shell patterns" match names with a given substring _only_ when * is inserted before and after (as in "*substring*"), and the "plain" behaviour cannot be achieved easily with the current implementation, this is mostly the right thing to do, in order to make it more flexible and consistent. Tests for "git tag" were also changed to reflect this. Signed-off-by: Carlos Rica Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 't') diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index c4fa4461f7..606d4f2a2c 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -185,18 +185,17 @@ cba EOF test_expect_success \ 'listing tags with substring as pattern must print those matching' ' - git-tag -l a > actual && + git-tag -l "*a*" > actual && git diff expect actual ' cat >expect < actual && + 'listing tags with a suffix as pattern must print those matching' ' + git-tag -l "*.1" > actual && git diff expect actual ' @@ -205,37 +204,36 @@ t210 t211 EOF test_expect_success \ - 'listing tags with substring as pattern must print those matching' ' - git-tag -l t21 > actual && + 'listing tags with a prefix as pattern must print those matching' ' + git-tag -l "t21*" > actual && git diff expect actual ' cat >expect < actual && git diff expect actual ' cat >expect < actual && git diff expect actual ' cat >expect < actual && + git-tag -l "v1.?.?" > actual && git diff expect actual ' -- cgit v1.2.3 From 7afa845edc09d2818af5fe67a0eb45ec579d1260 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sat, 1 Sep 2007 09:25:27 +0200 Subject: rebase -m: Fix incorrect short-logs of already applied commits. When a topic branch is rebased, some of whose commits are already cherry-picked upstream: o--X--A--B--Y <- master \ A--B--Z <- topic then 'git rebase -m master' would report: Already applied: 0001 Y Already applied: 0002 Y With this fix it reports the expected: Already applied: 0001 A Already applied: 0002 B As an added bonus, this change also avoids 'echo' of a commit message, which might contain escapements. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t3406-rebase-message.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 t/t3406-rebase-message.sh (limited to 't') diff --git a/t/t3406-rebase-message.sh b/t/t3406-rebase-message.sh new file mode 100755 index 0000000000..332b2b2feb --- /dev/null +++ b/t/t3406-rebase-message.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +test_description='messages from rebase operation' + +. ./test-lib.sh + +quick_one () { + echo "$1" >"file$1" && + git add "file$1" && + test_tick && + git commit -m "$1" +} + +test_expect_success setup ' + quick_one O && + git branch topic && + quick_one X && + quick_one A && + quick_one B && + quick_one Y && + + git checkout topic && + quick_one A && + quick_one B && + quick_one Z + +' + +cat >expect <<\EOF +Already applied: 0001 A +Already applied: 0002 B +Committed: 0003 Z +EOF + +test_expect_success 'rebase -m' ' + + git rebase -m master >report && + sed -n -e "/^Already applied: /p" \ + -e "/^Committed: /p" report >actual && + diff -u expect actual + +' + +test_done -- cgit v1.2.3 From 8460b2fcd45668d91567c36a22ea4f1b14ba133d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Mon, 3 Sep 2007 20:07:01 +0200 Subject: archive: specfile support (--pretty=format: in archive files) Add support for a new attribute, specfile. Files marked as being specfiles are expanded by git-archive when they are written to an archive. It has no effect on worktree files. The same placeholders as those for the option --pretty=format: of git-log et al. can be used. The attribute is useful for creating auto-updating specfiles. It is limited by the underlying function format_commit_message(), though. E.g. currently there is no placeholder for git-describe like output, and expanded specfiles can't contain NUL bytes. That can be fixed in format_commit_message() later and will then benefit users of git-log, too. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- t/t5000-tar-tree.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 't') diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index 1a4c53a031..3d5d01be78 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -28,12 +28,15 @@ commit id embedding: TAR=${TAR:-tar} UNZIP=${UNZIP:-unzip} +SPECFILEFORMAT=%H%n + test_expect_success \ 'populate workdir' \ 'mkdir a b c && echo simple textfile >a/a && mkdir a/bin && cp /bin/sh a/bin && + printf "%s" "$SPECFILEFORMAT" >a/specfile && ln -s a a/l1 && (p=long_path_to_a_file && cd a && for depth in 1 2 3 4 5; do mkdir $p && cd $p; done && @@ -104,6 +107,22 @@ test_expect_success \ 'validate file contents with prefix' \ 'diff -r a c/prefix/a' +test_expect_success \ + 'create an archive with a specfile' \ + 'echo specfile specfile >a/.gitattributes && + git archive HEAD >f.tar && + rm a/.gitattributes' + +test_expect_success \ + 'extract specfile' \ + '(mkdir f && cd f && $TAR xf -) f/a/specfile.expected && + diff f/a/specfile.expected f/a/specfile' + test_expect_success \ 'git archive --format=zip' \ 'git archive --format=zip HEAD >d.zip' -- cgit v1.2.3 From 6b763c424e4ace1678ade5310f3ca3ffbd11af2c Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 5 Sep 2007 21:58:40 -0700 Subject: git-apply: do not read past the end of buffer When the preimage we are patching is shorter than what the patch text expects, we tried to match the buffer contents at the "original" line with the fragment in full, without checking we have enough data to match in the preimage. This caused the size of a later memmove() to wrap around and attempt to scribble almost the entire address space. Not good. The code that follows the part this patch touches tries to match the fragment with line offsets. Curiously, that code does not have the problem --- it guards against reading past the end of the preimage. Signed-off-by: Junio C Hamano --- t/t4123-apply-shrink.sh | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 t/t4123-apply-shrink.sh (limited to 't') diff --git a/t/t4123-apply-shrink.sh b/t/t4123-apply-shrink.sh new file mode 100755 index 0000000000..984157f03b --- /dev/null +++ b/t/t4123-apply-shrink.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +test_description='apply a patch that is larger than the preimage' + +. ./test-lib.sh + +cat >F <<\EOF +1 +2 +3 +4 +5 +6 +7 +8 +999999 +A +B +C +D +E +F +G +H +I +J + +EOF + +test_expect_success setup ' + + git add F && + mv F G && + sed -e "s/1/11/" -e "s/999999/9/" -e "s/H/HH/" F && + git diff >patch && + sed -e "/^\$/d" F && + git add F + +' + +test_expect_success 'apply should fail gracefully' ' + + if git apply --index patch + then + echo Oops, should not have succeeded + false + else + status=$? + echo "Status was $status" + if test -f .git/index.lock + then + echo Oops, should not have crashed + false + fi + fi +' + +test_done -- cgit v1.2.3 From 432e93a16441a1a11aeb8158a634f76c214abb31 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 5 Sep 2007 22:15:21 -0400 Subject: Cleanup unnecessary file modifications in t1400-update-ref MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Kristian Høgsberg pointed out that the two file modifications we were doing during the 'creating initial files' step are not even used within the test suite. This was actually confusing as we do not even need these changes for the tests to pass. All that really matters here is the specific commit dates are used so that these appear in the branch's reflog, and that the dates are different so that the branch will update when asked and the reflog entry is also updated. There is no need for the file modification. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- t/t1400-update-ref.sh | 2 -- 1 file changed, 2 deletions(-) (limited to 't') diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index c4c0dfaab1..ce045b2a57 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -198,11 +198,9 @@ test_expect_success \ GIT_AUTHOR_DATE="2005-05-26 23:41" \ GIT_COMMITTER_DATE="2005-05-26 23:41" git-commit -F M -a && h_OTHER=$(git rev-parse --verify HEAD) && - echo FIXED >F && GIT_AUTHOR_DATE="2005-05-26 23:44" \ GIT_COMMITTER_DATE="2005-05-26 23:44" git-commit --amend && h_FIXED=$(git rev-parse --verify HEAD) && - echo TEST+FIXED >F && echo Merged initial commit and a later commit. >M && echo $h_TEST >.git/MERGE_HEAD && GIT_AUTHOR_DATE="2005-05-26 23:45" \ -- cgit v1.2.3 From df4a394f91d7d107c2a57e6c1df3638517cab54f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Fri, 7 Sep 2007 00:34:06 +0200 Subject: archive: specfile syntax change: "$Format:%PLCHLDR$" instead of just "%PLCHLDR" (take 2) As suggested by Johannes, --pretty=format: placeholders in specfiles need to be wrapped in $Format:...$ now. This syntax change restricts the expansion of placeholders and makes it easier to use with files that contain non-placeholder percent signs. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- t/t5000-tar-tree.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index 3d5d01be78..6e89e07272 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -36,7 +36,7 @@ test_expect_success \ echo simple textfile >a/a && mkdir a/bin && cp /bin/sh a/bin && - printf "%s" "$SPECFILEFORMAT" >a/specfile && + printf "A\$Format:%s\$O" "$SPECFILEFORMAT" >a/specfile && ln -s a a/l1 && (p=long_path_to_a_file && cd a && for depth in 1 2 3 4 5; do mkdir $p && cd $p; done && @@ -119,7 +119,7 @@ test_expect_success \ test_expect_success \ 'validate specfile contents' \ - 'git log --max-count=1 "--pretty=format:$SPECFILEFORMAT" HEAD \ + 'git log --max-count=1 "--pretty=format:A${SPECFILEFORMAT}O" HEAD \ >f/a/specfile.expected && diff f/a/specfile.expected f/a/specfile' -- cgit v1.2.3 From 38c9c9b798a0df875968ae49d699298131dfa24d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Thu, 6 Sep 2007 18:51:11 +0200 Subject: archive: rename attribute specfile to export-subst As suggested by Junio and Johannes, change the name of the former attribute specfile to export-subst to indicate its function rather than purpose and to make clear that it is not applied to working tree files. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- t/t5000-tar-tree.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 't') diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index 6e89e07272..42e28ab758 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -28,7 +28,7 @@ commit id embedding: TAR=${TAR:-tar} UNZIP=${UNZIP:-unzip} -SPECFILEFORMAT=%H%n +SUBSTFORMAT=%H%n test_expect_success \ 'populate workdir' \ @@ -36,7 +36,7 @@ test_expect_success \ echo simple textfile >a/a && mkdir a/bin && cp /bin/sh a/bin && - printf "A\$Format:%s\$O" "$SPECFILEFORMAT" >a/specfile && + printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile && ln -s a a/l1 && (p=long_path_to_a_file && cd a && for depth in 1 2 3 4 5; do mkdir $p && cd $p; done && @@ -108,20 +108,20 @@ test_expect_success \ 'diff -r a c/prefix/a' test_expect_success \ - 'create an archive with a specfile' \ - 'echo specfile specfile >a/.gitattributes && + 'create an archive with a substfile' \ + 'echo substfile export-subst >a/.gitattributes && git archive HEAD >f.tar && rm a/.gitattributes' test_expect_success \ - 'extract specfile' \ + 'extract substfile' \ '(mkdir f && cd f && $TAR xf -) f/a/specfile.expected && - diff f/a/specfile.expected f/a/specfile' + 'validate substfile contents' \ + 'git log --max-count=1 "--pretty=format:A${SUBSTFORMAT}O" HEAD \ + >f/a/substfile.expected && + diff f/a/substfile.expected f/a/substfile' test_expect_success \ 'git archive --format=zip' \ -- cgit v1.2.3 From 5701115aa7cfe7edd57c2483085456a37e27a5ba Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Sat, 8 Sep 2007 12:30:22 +0200 Subject: git-diff: don't squelch the new SHA1 in submodule diffs The code to squelch empty diffs introduced by commit fb13227e089f22dc31a3b1624559153821056848 would inadvertently populate filespec "two" of a submodule change using the uninitialized (null) SHA1, thereby replacing the submodule SHA1 by 0{40} in the output. This change teaches diffcore_skip_stat_unmatch to handle submodule changes correctly. Signed-off-by: Sven Verdoolaege Signed-off-by: Junio C Hamano --- t/t7400-submodule-basic.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 't') diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh index 9d142ed649..4fe3a41f07 100755 --- a/t/t7400-submodule-basic.sh +++ b/t/t7400-submodule-basic.sh @@ -152,6 +152,10 @@ test_expect_success 'the --cached sha1 should be rev1' ' git-submodule --cached status | grep "^+$rev1" ' +test_expect_success 'git diff should report the SHA1 of the new submodule commit' ' + git-diff | grep "^+Subproject commit $rev2" +' + test_expect_success 'update should checkout rev1' ' git-submodule update && head=$(cd lib && git rev-parse HEAD) && -- cgit v1.2.3 From aba91192ae39cd1a2f79e7ed91e966df3cfe10b7 Mon Sep 17 00:00:00 2001 From: Carlos Rica Date: Sun, 9 Sep 2007 02:39:29 +0200 Subject: git-tag -s must fail if gpg cannot sign the tag. Most of this patch code and message was written by Shawn O. Pearce. I made some tests to know what the problem was, and then I changed the code related with the SIGPIPE signal. If the user has misconfigured `user.signingkey` in their .git/config or just doesn't have any secret keys on their keyring and they ask for a signed tag with `git tag -s` we better make sure the resulting tag was actually signed by gpg. Prior versions of builtin git-tag allowed this failure to slip by without error as they were not checking the return value of the finish_command() so they did not notice when gpg exited with an error exit status. They also did not fail if gpg produced an empty output or if read_in_full received an error from the read system call while trying to read the pipe back from gpg. Finally, we did not actually honor any return value from the do_sign function as it returns ssize_t but was being stored into an unsigned long. This caused the compiler to optimize out the die condition, allowing git-tag to continue along and create the tag object. However, when gpg gets a wrong username, it exits before any read was done and then the writing process receives SIGPIPE and program is terminated. By ignoring this signal, anyway, the function write_or_die gets EPIPE from write_in_full and exits returning 0 to the system without a message. Here we better call to write_in_full directly so we can fail printing a message and return safely to the caller. With these issues fixed `git-tag -s` will now fail to create the tag and will report a non-zero exit status to its caller, thereby allowing automated helper scripts to detect (and recover from) failure if gpg is not working properly. Proposed-by: Shawn O. Pearce Signed-off-by: Carlos Rica Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 't') diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 606d4f2a2c..0d07bc39c7 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -990,6 +990,13 @@ test_expect_success \ git diff expect actual ' +# try to sign with bad user.signingkey +git config user.signingkey BobTheMouse +test_expect_failure \ + 'git-tag -s fails if gpg is misconfigured' \ + 'git tag -s -m tail tag-gpg-failure' +git config --unset user.signingkey + # try to verify without gpg: rm -rf gpghome -- cgit v1.2.3 From 060fe5718455828b2ce5721d26be6399d782e415 Mon Sep 17 00:00:00 2001 From: Ramsay Jones Date: Tue, 11 Sep 2007 19:16:51 +0100 Subject: Fix a test failure (t9500-*.sh) on cygwin On filesystems where it is appropriate to set core.filemode to false, test 29 ("commitdiff(0): mode change") fails when git-commit does not notice a file (execute) permission change. A fix requires noting the new file execute permission in the index with a "git update-index --chmod=+x", prior to the commit. Add a function (note_chmod) which implements this idea, and insert a call in each test that modifies the x permission. Signed-off-by: Ramsay Jones Signed-off-by: Junio C Hamano --- t/t9500-gitweb-standalone-no-errors.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 't') diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh index fa32598b0c..642b836d64 100755 --- a/t/t9500-gitweb-standalone-no-errors.sh +++ b/t/t9500-gitweb-standalone-no-errors.sh @@ -58,6 +58,14 @@ gitweb_run () { # gitweb.log is left for debugging } +safe_chmod () { + chmod "$1" "$2" && + if [ "$(git config --get core.filemode)" = false ] + then + git update-index --chmod="$1" "$2" + fi +} + . ./test-lib.sh perl -MEncode -e 'decode_utf8("", Encode::FB_CROAK)' >/dev/null 2>&1 || { @@ -229,7 +237,7 @@ test_debug 'cat gitweb.log' test_expect_success \ 'commitdiff(0): mode change' \ - 'chmod a+x new_file && + 'safe_chmod +x new_file && git commit -a -m "Mode changed." && gitweb_run "p=.git;a=commitdiff"' test_debug 'cat gitweb.log' @@ -268,7 +276,7 @@ test_debug 'cat gitweb.log' test_expect_success \ 'commitdiff(0): mode change and modified' \ 'echo "New line" >> file2 && - chmod a+x file2 && + safe_chmod +x file2 && git commit -a -m "Mode change and modification." && gitweb_run "p=.git;a=commitdiff"' test_debug 'cat gitweb.log' @@ -295,7 +303,7 @@ test_expect_success \ 'commitdiff(0): renamed, mode change and modified' \ 'git mv file3 file2 && echo "Propter nomen suum." >> file2 && - chmod a+x file2 && + safe_chmod +x file2 && git commit -a -m "File rename, mode change and modification." && gitweb_run "p=.git;a=commitdiff"' test_debug 'cat gitweb.log' @@ -412,10 +420,10 @@ test_expect_success \ git add 03-new && git mv 04-rename-from 04-rename-to && echo "Changed" >> 04-rename-to && - chmod a+x 05-mode-change && + safe_chmod +x 05-mode-change && rm -f 06-file-or-symlink && ln -s 01-change 06-file-or-symlink && echo "Changed and have mode changed" > 07-change-mode-change && - chmod a+x 07-change-mode-change && + safe_chmod +x 07-change-mode-change && git commit -a -m "Large commit" && git checkout master' -- cgit v1.2.3 From 359048d6ec296757266887a8ced5a927b97b94c1 Mon Sep 17 00:00:00 2001 From: Carlos Rica Date: Tue, 11 Sep 2007 03:09:52 +0200 Subject: Add tests for documented features of "git reset". This adds the new file t/t7102-reset.sh following the text and examples in "Documentation/git-reset.txt" in order to check the behaviour of the upcoming "builtin-reset.c", and be able to compare it with the original "git-reset.sh". Signed-off-by: Carlos Rica Signed-off-by: Junio C Hamano --- t/t7102-reset.sh | 389 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 389 insertions(+) create mode 100755 t/t7102-reset.sh (limited to 't') diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh new file mode 100755 index 0000000000..2cad4db127 --- /dev/null +++ b/t/t7102-reset.sh @@ -0,0 +1,389 @@ +#!/bin/sh +# +# Copyright (c) 2007 Carlos Rica +# + +test_description='git-reset + +Documented tests for git-reset' + +. ./test-lib.sh + +test_expect_success 'creating initial files and commits' ' + test_tick && + echo "1st file" >first && + git add first && + git commit -m "create 1st file" && + + echo "2nd file" >second && + git add second && + git commit -m "create 2nd file" && + + echo "2nd line 1st file" >>first && + git commit -a -m "modify 1st file" && + + git rm first && + git mv second secondfile && + git commit -a -m "remove 1st and rename 2nd" && + + echo "1st line 2nd file" >secondfile && + echo "2nd line 2nd file" >>secondfile && + git commit -a -m "modify 2nd file" +' +# git log --pretty=oneline # to see those SHA1 involved + +check_changes () { + test "$(git rev-parse HEAD)" = "$1" && + git diff | git diff .diff_expect - && + git diff --cached | git diff .cached_expect - && + for FILE in * + do + echo $FILE':' + cat $FILE || return + done | git diff .cat_expect - +} + +>.diff_expect +>.cached_expect +cat >.cat_expect <>secondfile && + git commit -a -m "change in branch1" && + + git checkout branch2 && + echo "3rd line in branch2" >>secondfile && + git commit -a -m "change in branch2" && + + ! git merge branch1 && + ! git reset --soft && + + printf "1st line 2nd file\n2nd line 2nd file\n3rd line" >secondfile && + git commit -a -m "the change in branch2" && + + git checkout master && + git branch -D branch1 branch2 && + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc +' + +test_expect_success \ + 'trying to do reset --soft with pending checkout merge should fail' ' + git branch branch3 && + git branch branch4 && + + git checkout branch3 && + echo "3rd line in branch3" >>secondfile && + git commit -a -m "line in branch3" && + + git checkout branch4 && + echo "3rd line in branch4" >>secondfile && + + git checkout -m branch3 && + ! git reset --soft && + + printf "1st line 2nd file\n2nd line 2nd file\n3rd line" >secondfile && + git commit -a -m "the line in branch3" && + + git checkout master && + git branch -D branch3 branch4 && + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc +' + +test_expect_success \ + 'resetting to HEAD with no changes should succeed and do nothing' ' + git reset --hard && + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc + git reset --hard HEAD && + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc + git reset --soft && + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc + git reset --soft HEAD && + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc + git reset --mixed && + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc + git reset --mixed HEAD && + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc + git reset && + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc + git reset HEAD && + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc +' + +>.diff_expect +cat >.cached_expect <.cat_expect <.diff_expect +>.cached_expect +cat >.cat_expect <>secondfile && + git commit -a -C ORIG_HEAD && + check_changes 3d3b7be011a58ca0c179ae45d94e6c83c0b0cd0d && + test "$(git rev-parse ORIG_HEAD)" = \ + 3ec39651e7f44ea531a5de18a9fa791c0fd370fc +' + +>.diff_expect +>.cached_expect +cat >.cat_expect <.diff_expect +cat >.cached_expect <.cat_expect <secondfile && + echo "2nd line 2nd file" >>secondfile && + git add secondfile && + check_changes ddaefe00f1da16864591c61fdc7adb5d7cd6b74e +' + +cat >.diff_expect <.cached_expect +cat >.cat_expect <.diff_expect +>.cached_expect +cat >.cat_expect <secondfile && + echo "2nd line 2nd file" >>secondfile && + git commit -a -m "modify 2nd file" && + check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc +' + +>.diff_expect +>.cached_expect +cat >.cat_expect <>secondfile && + git commit -a -m "change in branch1" && + + git checkout branch2 && + echo "3rd line in branch2" >>secondfile && + git commit -a -m "change in branch2" && + + ! git pull . branch1 && + git reset --hard && + check_changes 77abb337073fb4369a7ad69ff6f5ec0e4d6b54bb +' + +>.diff_expect +>.cached_expect +cat >.cat_expect < expect << EOF +diff --git a/file1 b/file1 +index d00491f..7ed6ff8 100644 +--- a/file1 ++++ b/file1 +@@ -1 +1 @@ +-1 ++5 +diff --git a/file2 b/file2 +deleted file mode 100644 +index 0cfbf08..0000000 +--- a/file2 ++++ /dev/null +@@ -1 +0,0 @@ +-2 +EOF +cat > cached_expect << EOF +diff --git a/file4 b/file4 +new file mode 100644 +index 0000000..b8626c4 +--- /dev/null ++++ b/file4 +@@ -0,0 +1 @@ ++4 +EOF +test_expect_success 'test --mixed ' ' + echo 1 > file1 && + echo 2 > file2 && + git add file1 file2 && + test_tick && + git commit -m files && + git rm file2 && + echo 3 > file3 && + echo 4 > file4 && + echo 5 > file1 && + git add file1 file3 file4 && + ! git reset HEAD -- file1 file2 file3 && + git diff > output && + git diff output expect && + git diff --cached > output && + git diff output cached_expect +' + +test_done -- cgit v1.2.3 From 80bffaf7fbe09ef62ecb9a6ffea70ac0171b456c Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 12 Sep 2007 16:04:22 -0700 Subject: git-commit: Allow partial commit of file removal. When making a partial commit, git-commit uses git-ls-files with the --error-unmatch option to expand and sanity check the user supplied path patterns. When any path pattern does not match with the paths known to the index, it errors out, in order to catch a common mistake to say "git commit Makefiel cache.h" and end up with a commit that touches only cache.h (notice the misspelled "Makefile"). This detection however does not work well when the path has already been removed from the index. If you drop a path from the index and try to commit that partially, i.e. $ git rm COPYING $ git commit -m 'Remove COPYING' COPYING the command complains because git does not know anything about COPYING anymore. This introduces a new option --with-tree to git-ls-files and uses it in git-commit when we build a temporary index to write a tree object for the partial commit. When --with-tree= option is specified, names from the given tree are added to the set of names the index knows about, so we can treat COPYING file in the example as known. Of course, there is no reason to use "git rm" and git-aware people have long time done: $ rm COPYING $ git commit -m 'Remove COPYING' COPYING which works just fine. But this caused a constant confusion. Signed-off-by: Junio C Hamano --- t/t7501-commit.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 't') diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index 6bd3c9e3e0..f178f56208 100644 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -131,4 +131,25 @@ test_expect_success \ 'validate git-rev-list output.' \ 'diff current expected' +test_expect_success 'partial commit that involve removal (1)' ' + + git rm --cached file && + mv file elif && + git add elif && + git commit -m "Partial: add elif" elif && + git diff-tree --name-status HEAD^ HEAD >current && + echo "A elif" >expected && + diff expected current + +' + +test_expect_success 'partial commit that involve removal (2)' ' + + git commit -m "Partial: remove file" file && + git diff-tree --name-status HEAD^ HEAD >current && + echo "D file" >expected && + diff expected current + +' + test_done -- cgit v1.2.3 From cbb390cd8f58ca6fc5c7b2c710425649b057b6d6 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 13 Sep 2007 20:54:14 -0700 Subject: An additional test for "git-reset -- path" Signed-off-by: Junio C Hamano --- t/t7102-reset.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 't') diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index 2cad4db127..f64b1cbf75 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -386,4 +386,20 @@ test_expect_success 'test --mixed ' ' git diff output cached_expect ' +test_expect_success 'test resetting the index at give paths' ' + + mkdir sub && + >sub/file1 && + >sub/file2 && + git update-index --add sub/file1 sub/file2 && + T=$(git write-tree) && + ! git reset HEAD sub/file2 && + U=$(git write-tree) && + echo "$T" && + echo "$U" && + ! git diff-index --cached --exit-code "$T" && + test "$T" != "$U" + +' + test_done -- cgit v1.2.3 From 760da9607ee08e9dd495dee993262bb857694ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Fri, 14 Sep 2007 00:13:06 +0200 Subject: archive: fix subst file generation Before the strbuf conversion, result was a char pointer. The if statement checked for it being not NULL, which meant that no "$Format:...$" string had been found and no replacement had to be made. format_subst() returned NULL in that case -- the caller then simply kept the original file content, as it was unaffected by the expansion. The length of the string being 0 is not the same as the string being NULL (expansion to an empty string vs. no expansion at all), so checking result.len != 0 is not a full replacement for the old NULL check. However, I doubt the subtle optimization explained above resulted in a notable speed-up anyway. Simplify the code and add the tail of the file to the expanded string unconditionally. [jc: added a test to expose the breakage this fixes] Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- t/t5000-tar-tree.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 't') diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh index 42e28ab758..dca2067b2d 100755 --- a/t/t5000-tar-tree.sh +++ b/t/t5000-tar-tree.sh @@ -36,7 +36,8 @@ test_expect_success \ echo simple textfile >a/a && mkdir a/bin && cp /bin/sh a/bin && - printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile && + printf "A\$Format:%s\$O" "$SUBSTFORMAT" >a/substfile1 && + printf "A not substituted O" >a/substfile2 && ln -s a a/l1 && (p=long_path_to_a_file && cd a && for depth in 1 2 3 4 5; do mkdir $p && cd $p; done && @@ -108,20 +109,22 @@ test_expect_success \ 'diff -r a c/prefix/a' test_expect_success \ - 'create an archive with a substfile' \ - 'echo substfile export-subst >a/.gitattributes && + 'create an archive with a substfiles' \ + 'echo "substfile?" export-subst >a/.gitattributes && git archive HEAD >f.tar && rm a/.gitattributes' test_expect_success \ - 'extract substfile' \ + 'extract substfiles' \ '(mkdir f && cd f && $TAR xf -) f/a/substfile.expected && - diff f/a/substfile.expected f/a/substfile' + >f/a/substfile1.expected && + diff f/a/substfile1.expected f/a/substfile1 && + diff a/substfile2 f/a/substfile2 +' test_expect_success \ 'git archive --format=zip' \ -- cgit v1.2.3 From 43b98acc23306fd7fff888477937063361a09593 Mon Sep 17 00:00:00 2001 From: Benoit Sigoure Date: Fri, 14 Sep 2007 10:29:04 +0200 Subject: Add test to check recent fix to "git add -u" An earlier commit fixed type-change case in "git add -u". This adds a test to make sure we do not introduce regression. At the same time, it fixes a stupid typo in the error message. Signed-off-by: Benoit Sigoure Signed-off-by: Junio C Hamano --- t/t2200-add-update.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh index 61d08bb431..eb1ced3c37 100755 --- a/t/t2200-add-update.sh +++ b/t/t2200-add-update.sh @@ -16,11 +16,12 @@ only the updates to dir/sub.' test_expect_success setup ' echo initial >check && echo initial >top && + echo initial >foo && mkdir dir1 dir2 && echo initial >dir1/sub1 && echo initial >dir1/sub2 && echo initial >dir2/sub3 && - git add check dir1 dir2 top && + git add check dir1 dir2 top foo && test_tick git-commit -m initial && @@ -76,4 +77,12 @@ test_expect_success 'change gets noticed' ' ' +test_expect_success 'replace a file with a symlink' ' + + rm foo && + ln -s top foo && + git add -u -- foo + +' + test_done -- cgit v1.2.3 From d99ebf081797dbb43ff618ff59f4c607b0acf045 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 14 Sep 2007 00:31:00 -0700 Subject: Split grep arguments in a way that does not requires to add /dev/null. In order to (almost) always show the name of the file without relying on "-H" option of GNU grep, we used to add /dev/null to the argument list unless we are doing -l or -L. This caused "/dev/null:0" to show up when -c is given in the output. It is not enough to add -c to the set of options we do not pass /dev/null for. When we have too many files, we invoke grep multiple times and we need to avoid giving a widow filename to the last invocation -- otherwise we will not see the name. This keeps two filenames when the argv[] buffer is about to overflow and we have not finished iterating over the index, so that the last round will always have at least two paths to work with (and not require /dev/null). An obvious and the only exception is when there is only 1 file that is given to the underlying grep, and in that case we avoid passing /dev/null and let the external "grep -c" report only the number of matches. Signed-off-by: Junio C Hamano --- t/t7002-grep.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 't') diff --git a/t/t7002-grep.sh b/t/t7002-grep.sh index 6bfb899ed1..68b2b92879 100755 --- a/t/t7002-grep.sh +++ b/t/t7002-grep.sh @@ -107,6 +107,10 @@ do diff expected actual ' + test_expect_failure "grep -c $L (no /dev/null)" ' + git grep -c test $H | grep -q "/dev/null" + ' + done test_done -- cgit v1.2.3 From db33af0a7f64ffc48de3ad018a1df03f744fb7a2 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 14 Sep 2007 16:53:58 -0700 Subject: git-commit: partial commit of paths only removed from the index Because a partial commit is meant to be a way to ignore what are staged in the index, "git rm --cached A && git commit A" should just record what is in A on the filesystem. The previous patch made the command sequence to barf, saying that A has not been added yet. This fixes it. Signed-off-by: Junio C Hamano --- t/t7501-commit.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index f178f56208..b151b51a34 100644 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -131,7 +131,7 @@ test_expect_success \ 'validate git-rev-list output.' \ 'diff current expected' -test_expect_success 'partial commit that involve removal (1)' ' +test_expect_success 'partial commit that involves removal (1)' ' git rm --cached file && mv file elif && @@ -143,7 +143,7 @@ test_expect_success 'partial commit that involve removal (1)' ' ' -test_expect_success 'partial commit that involve removal (2)' ' +test_expect_success 'partial commit that involves removal (2)' ' git commit -m "Partial: remove file" file && git diff-tree --name-status HEAD^ HEAD >current && @@ -152,4 +152,15 @@ test_expect_success 'partial commit that involve removal (2)' ' ' +test_expect_success 'partial commit that involves removal (3)' ' + + git rm --cached elif && + echo elif >elif && + git commit -m "Partial: modify elif" elif && + git diff-tree --name-status HEAD^ HEAD >current && + echo "M elif" >expected && + diff expected current + +' + test_done -- cgit v1.2.3 From 023756f4eb71bfa37e17b0bdbf4b9fcbbba95466 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 15 Sep 2007 18:39:52 +0100 Subject: revision walker: --cherry-pick is a limited operation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We used to rely on the fact that cherry-pick would trigger the code path to set limited = 1 in handle_commit(), when an uninteresting commit was encountered. However, when cherry picking between two independent branches, i.e. when there are no merge bases, and there is only linear development (which can happen when you cvsimport a fork of a project), no uninteresting commit will be encountered. So set limited = 1 when --cherry-pick was asked for. Noticed by Martin Bähr. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t6007-rev-list-cherry-pick-file.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 't') diff --git a/t/t6007-rev-list-cherry-pick-file.sh b/t/t6007-rev-list-cherry-pick-file.sh index 3faeae6c01..4b8611ce20 100755 --- a/t/t6007-rev-list-cherry-pick-file.sh +++ b/t/t6007-rev-list-cherry-pick-file.sh @@ -40,4 +40,18 @@ test_expect_success '--cherry-pick bar does not come up empty' ' ! test -z "$(git rev-list --left-right --cherry-pick B...C -- bar)" ' +test_expect_success '--cherry-pick with independent, but identical branches' ' + git symbolic-ref HEAD refs/heads/independent && + rm .git/index && + echo Hallo > foo && + git add foo && + test_tick && + git commit -m "independent" && + echo Bello > foo && + test_tick && + git commit -m "independent, too" foo && + test -z "$(git rev-list --left-right --cherry-pick \ + HEAD...master -- foo)" +' + test_done -- cgit v1.2.3 From ece7b74903007cee8d280573647243d46a6f3a95 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 17 Sep 2007 01:24:57 +0100 Subject: apply --index-info: fall back to current index for mode changes "git diff" does not record index lines for pure mode changes (i.e. no lines changed). Therefore, apply --index-info would call out a bogus error. Instead, fall back to reading the info from the current index. Incidentally, this fixes an error where git-rebase would not rebase a commit including a pure mode change, and changes requiring a threeway merge. Noticed and later tested by Chris Shoemaker. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3400-rebase.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 't') diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index 62205b2531..95e33b5210 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -68,4 +68,19 @@ test_expect_success \ test 3 = $(git rev-list master.. | wc -l) ' +test_expect_success 'rebase a single mode change' ' + git checkout master && + echo 1 > X && + git add X && + test_tick && + git commit -m prepare && + git checkout -b modechange HEAD^ && + echo 1 > X && + git add X && + chmod a+x A && + test_tick && + git commit -m modechange A X && + GIT_TRACE=1 git rebase master +' + test_done -- cgit v1.2.3 From 64586e75af3c84844b80652575a8b63a9612b24a Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 12 Sep 2007 16:04:22 -0700 Subject: git-commit: Allow partial commit of file removal. When making a partial commit, git-commit uses git-ls-files with the --error-unmatch option to expand and sanity check the user supplied path patterns. When any path pattern does not match with the paths known to the index, it errors out, in order to catch a common mistake to say "git commit Makefiel cache.h" and end up with a commit that touches only cache.h (notice the misspelled "Makefile"). This detection however does not work well when the path has already been removed from the index. If you drop a path from the index and try to commit that partially, i.e. $ git rm COPYING $ git commit -m 'Remove COPYING' COPYING the command complains because git does not know anything about COPYING anymore. This introduces a new option --with-tree to git-ls-files and uses it in git-commit when we build a temporary index to write a tree object for the partial commit. When --with-tree= option is specified, names from the given tree are added to the set of names the index knows about, so we can treat COPYING file in the example as known. Of course, there is no reason to use "git rm" and git-aware people have long time done: $ rm COPYING $ git commit -m 'Remove COPYING' COPYING which works just fine. But this caused a constant confusion. Signed-off-by: Junio C Hamano --- t/t7501-commit.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 't') diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index 6bd3c9e3e0..f178f56208 100644 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -131,4 +131,25 @@ test_expect_success \ 'validate git-rev-list output.' \ 'diff current expected' +test_expect_success 'partial commit that involve removal (1)' ' + + git rm --cached file && + mv file elif && + git add elif && + git commit -m "Partial: add elif" elif && + git diff-tree --name-status HEAD^ HEAD >current && + echo "A elif" >expected && + diff expected current + +' + +test_expect_success 'partial commit that involve removal (2)' ' + + git commit -m "Partial: remove file" file && + git diff-tree --name-status HEAD^ HEAD >current && + echo "D file" >expected && + diff expected current + +' + test_done -- cgit v1.2.3 From cba8d4896187abedd9c35936504b7254a2ecbd91 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 14 Sep 2007 16:53:58 -0700 Subject: git-commit: partial commit of paths only removed from the index Because a partial commit is meant to be a way to ignore what are staged in the index, "git rm --cached A && git commit A" should just record what is in A on the filesystem. The previous patch made the command sequence to barf, saying that A has not been added yet. This fixes it. Signed-off-by: Junio C Hamano --- t/t7501-commit.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index f178f56208..b151b51a34 100644 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -131,7 +131,7 @@ test_expect_success \ 'validate git-rev-list output.' \ 'diff current expected' -test_expect_success 'partial commit that involve removal (1)' ' +test_expect_success 'partial commit that involves removal (1)' ' git rm --cached file && mv file elif && @@ -143,7 +143,7 @@ test_expect_success 'partial commit that involve removal (1)' ' ' -test_expect_success 'partial commit that involve removal (2)' ' +test_expect_success 'partial commit that involves removal (2)' ' git commit -m "Partial: remove file" file && git diff-tree --name-status HEAD^ HEAD >current && @@ -152,4 +152,15 @@ test_expect_success 'partial commit that involve removal (2)' ' ' +test_expect_success 'partial commit that involves removal (3)' ' + + git rm --cached elif && + echo elif >elif && + git commit -m "Partial: modify elif" elif && + git diff-tree --name-status HEAD^ HEAD >current && + echo "M elif" >expected && + diff expected current + +' + test_done -- cgit v1.2.3 From 5c633a4cbeb95fc86c9b3e6126749cf34a2691b5 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 18 Sep 2007 04:15:34 -0400 Subject: git-push: documentation and tests for pushing only branches Commit 098e711e caused git-push to match only branches when considering which refs to push. This patch updates the documentation accordingly and adds a test for this behavior. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t5400-send-pack.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 't') diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh index 6c8767e1df..57c6397be1 100755 --- a/t/t5400-send-pack.sh +++ b/t/t5400-send-pack.sh @@ -113,4 +113,14 @@ test_expect_success \ ! git diff .git/refs/heads/master victim/.git/refs/heads/master ' +test_expect_success \ + 'pushing does not include non-head refs' ' + mkdir parent && cd parent && + git-init && touch file && git-add file && git-commit -m add && + cd .. && + git-clone parent child && cd child && git-push --all && + cd ../parent && + git-branch -a >branches && ! grep -q origin/master branches +' + test_done -- cgit v1.2.3 From cd894ee9adf0c026b74761d7b1c0d8dabe4ff4e1 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 18 Sep 2007 15:19:47 -0700 Subject: t/t4014: test "am -3" with mode-only change. Earlier commit ece7b74903007cee8d280573647243d46a6f3a95 added a test for rebase that uses "am -3", but this adds a test to check "am -3" itself. Signed-off-by: Junio C Hamano --- t/t4014-format-patch.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index df969bb69c..0a6fe53375 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -10,12 +10,15 @@ test_description='Format-patch skipping already incorporated patches' 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 && + cat file >elif && + git add file elif && 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 && + chmod +x elif && + git update-index file elif && + git update-index --chmod=+x elif && git commit -m "Side changes #1" && for i in D E F; do echo "$i"; done >>file && -- cgit v1.2.3 From 46232915d5ac84fb033ad395bbf161c9645c42c9 Mon Sep 17 00:00:00 2001 From: Josh England Date: Tue, 11 Sep 2007 10:59:03 -0600 Subject: Add post-merge hook, related documentation, and tests. The post-merge hook enables one to hook in for `git pull` operations in order to check and/or change attributes of a work tree from the hook. As an example, it can be used in combination with a pre-commit hook to save/restore file ownership and permissions data (or file ACLs) within the repository and transparently update the working tree after a `git pull` operation. Signed-off-by: Josh England Signed-off-by: Junio C Hamano --- t/t5402-post-merge-hook.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 t/t5402-post-merge-hook.sh (limited to 't') diff --git a/t/t5402-post-merge-hook.sh b/t/t5402-post-merge-hook.sh new file mode 100755 index 0000000000..1c4b0b32ab --- /dev/null +++ b/t/t5402-post-merge-hook.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# +# Copyright (c) 2006 Josh England +# + +test_description='Test the post-merge hook.' +. ./test-lib.sh + +test_expect_success setup ' + echo Data for commit0. >a && + git update-index --add a && + tree0=$(git write-tree) && + commit0=$(echo setup | git commit-tree $tree0) && + echo Changed data for commit1. >a && + git update-index a && + tree1=$(git write-tree) && + commit1=$(echo modify | git commit-tree $tree1 -p $commit0) && + git update-ref refs/heads/master $commit0 && + git-clone ./. clone1 && + GIT_DIR=clone1/.git git update-index --add a && + git-clone ./. clone2 && + GIT_DIR=clone2/.git git update-index --add a +' + +for clone in 1 2; do + cat >clone${clone}/.git/hooks/post-merge <<'EOF' +#!/bin/sh +echo $@ >> $GIT_DIR/post-merge.args +EOF + chmod u+x clone${clone}/.git/hooks/post-merge +done + +test_expect_failure 'post-merge does not run for up-to-date ' ' + GIT_DIR=clone1/.git git merge $commit0 && + test -e clone1/.git/post-merge.args +' + +test_expect_success 'post-merge runs as expected ' ' + GIT_DIR=clone1/.git git merge $commit1 && + test -e clone1/.git/post-merge.args +' + +test_expect_success 'post-merge from normal merge receives the right argument ' ' + grep 0 clone1/.git/post-merge.args +' + +test_expect_success 'post-merge from squash merge runs as expected ' ' + GIT_DIR=clone2/.git git merge --squash $commit1 && + test -e clone2/.git/post-merge.args +' + +test_expect_success 'post-merge from squash merge receives the right argument ' ' + grep 1 clone2/.git/post-merge.args +' + +test_done -- cgit v1.2.3 From b888d61c8308027433df9c243fa551f42db1c76a Mon Sep 17 00:00:00 2001 From: Daniel Barkalow Date: Mon, 10 Sep 2007 23:03:25 -0400 Subject: Make fetch a builtin Thanks to Johannes Schindelin for review and fixes, and Julian Phillips for the original C translation. This changes a few small bits of behavior: branch..merge is parsed as if it were the lhs of a fetch refspec, and does not have to exactly match the actual lhs of a refspec, so long as it is a valid abbreviation for the same ref. branch..merge is no longer ignored if the remote is configured with a branches/* file. Neither behavior is useful, because there can only be one ref that gets fetched, but this is more consistant. Also, fetch prints different information to standard out. Signed-off-by: Daniel Barkalow Signed-off-by: Junio C Hamano --- t/t5515/fetch.br-branches-default-merge | 2 +- t/t5515/fetch.br-branches-default-merge_branches-default | 2 +- t/t5515/fetch.br-branches-default-octopus | 2 +- t/t5515/fetch.br-branches-default-octopus_branches-default | 2 +- t/t5515/fetch.br-branches-one-merge | 2 +- t/t5515/fetch.br-branches-one-merge_branches-one | 2 +- t/t5515/fetch.br-config-glob-octopus | 2 +- t/t5515/fetch.br-config-glob-octopus_config-glob | 2 +- t/t5515/fetch.br-remote-glob-octopus | 2 +- t/t5515/fetch.br-remote-glob-octopus_remote-glob | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) (limited to 't') diff --git a/t/t5515/fetch.br-branches-default-merge b/t/t5515/fetch.br-branches-default-merge index ea65f31bde..828bfd8e9e 100644 --- a/t/t5515/fetch.br-branches-default-merge +++ b/t/t5515/fetch.br-branches-default-merge @@ -1,5 +1,5 @@ # br-branches-default-merge -754b754407bf032e9a2f9d5a9ad05ca79a6b228f branch 'master' of ../ +754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge branch 'master' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-branches-default-merge_branches-default b/t/t5515/fetch.br-branches-default-merge_branches-default index 7b5fa949e6..f1486730fa 100644 --- a/t/t5515/fetch.br-branches-default-merge_branches-default +++ b/t/t5515/fetch.br-branches-default-merge_branches-default @@ -1,5 +1,5 @@ # br-branches-default-merge branches-default -754b754407bf032e9a2f9d5a9ad05ca79a6b228f branch 'master' of ../ +754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge branch 'master' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-branches-default-octopus b/t/t5515/fetch.br-branches-default-octopus index 128397d737..bb1a1915c6 100644 --- a/t/t5515/fetch.br-branches-default-octopus +++ b/t/t5515/fetch.br-branches-default-octopus @@ -1,5 +1,5 @@ # br-branches-default-octopus -754b754407bf032e9a2f9d5a9ad05ca79a6b228f branch 'master' of ../ +754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge branch 'master' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-branches-default-octopus_branches-default b/t/t5515/fetch.br-branches-default-octopus_branches-default index 4b37cd481a..970fc93725 100644 --- a/t/t5515/fetch.br-branches-default-octopus_branches-default +++ b/t/t5515/fetch.br-branches-default-octopus_branches-default @@ -1,5 +1,5 @@ # br-branches-default-octopus branches-default -754b754407bf032e9a2f9d5a9ad05ca79a6b228f branch 'master' of ../ +754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge branch 'master' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-branches-one-merge b/t/t5515/fetch.br-branches-one-merge index 3a4e77ead5..24099fd53e 100644 --- a/t/t5515/fetch.br-branches-one-merge +++ b/t/t5515/fetch.br-branches-one-merge @@ -1,5 +1,5 @@ # br-branches-one-merge -8e32a6d901327a23ef831511badce7bf3bf46689 branch 'one' of ../ +8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge branch 'one' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-branches-one-merge_branches-one b/t/t5515/fetch.br-branches-one-merge_branches-one index 00e04b435e..e4b4fdee4c 100644 --- a/t/t5515/fetch.br-branches-one-merge_branches-one +++ b/t/t5515/fetch.br-branches-one-merge_branches-one @@ -1,5 +1,5 @@ # br-branches-one-merge branches-one -8e32a6d901327a23ef831511badce7bf3bf46689 branch 'one' of ../ +8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge branch 'one' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-config-glob-octopus b/t/t5515/fetch.br-config-glob-octopus index 9ee213ea45..938e532db2 100644 --- a/t/t5515/fetch.br-config-glob-octopus +++ b/t/t5515/fetch.br-config-glob-octopus @@ -2,7 +2,7 @@ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge branch 'master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 branch 'one' of ../ 0567da4d5edd2ff4bb292a465ba9e64dcad9536b not-for-merge branch 'three' of ../ -6134ee8f857693b96ff1cc98d3e2fd62b199e5a8 not-for-merge branch 'two' of ../ +6134ee8f857693b96ff1cc98d3e2fd62b199e5a8 branch 'two' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-config-glob-octopus_config-glob b/t/t5515/fetch.br-config-glob-octopus_config-glob index 44bd0ec59f..c9225bf6ff 100644 --- a/t/t5515/fetch.br-config-glob-octopus_config-glob +++ b/t/t5515/fetch.br-config-glob-octopus_config-glob @@ -2,7 +2,7 @@ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge branch 'master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 branch 'one' of ../ 0567da4d5edd2ff4bb292a465ba9e64dcad9536b not-for-merge branch 'three' of ../ -6134ee8f857693b96ff1cc98d3e2fd62b199e5a8 not-for-merge branch 'two' of ../ +6134ee8f857693b96ff1cc98d3e2fd62b199e5a8 branch 'two' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-remote-glob-octopus b/t/t5515/fetch.br-remote-glob-octopus index c1554f8f2d..b08e046195 100644 --- a/t/t5515/fetch.br-remote-glob-octopus +++ b/t/t5515/fetch.br-remote-glob-octopus @@ -2,7 +2,7 @@ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge branch 'master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 branch 'one' of ../ 0567da4d5edd2ff4bb292a465ba9e64dcad9536b not-for-merge branch 'three' of ../ -6134ee8f857693b96ff1cc98d3e2fd62b199e5a8 not-for-merge branch 'two' of ../ +6134ee8f857693b96ff1cc98d3e2fd62b199e5a8 branch 'two' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-remote-glob-octopus_remote-glob b/t/t5515/fetch.br-remote-glob-octopus_remote-glob index e6134345b8..d4d547c847 100644 --- a/t/t5515/fetch.br-remote-glob-octopus_remote-glob +++ b/t/t5515/fetch.br-remote-glob-octopus_remote-glob @@ -2,7 +2,7 @@ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge branch 'master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 branch 'one' of ../ 0567da4d5edd2ff4bb292a465ba9e64dcad9536b not-for-merge branch 'three' of ../ -6134ee8f857693b96ff1cc98d3e2fd62b199e5a8 not-for-merge branch 'two' of ../ +6134ee8f857693b96ff1cc98d3e2fd62b199e5a8 branch 'two' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ -- cgit v1.2.3 From d8b3a2bf189a9e7fea76454157b77fa71c9abc05 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 18 Sep 2007 04:54:51 -0400 Subject: Don't attempt to merge non-existant remotes in t5515 This was actually reverted in 756373da by Junio. We no longer support merging the right hand side of a fetchspec in a branch's branch.$name.merge configuration setting as we interpret these names as being only those published by the remote we are going to fetch from. The older shell based implementation of git-fetch did not report an error when branch.$name.merge was referencing a branch that does not exist on the remote and we are running `git fetch` for the current branch. The new builtin-fetch does notice this failure and aborts the fetch, thus breaking the tests. Junio and I kicked it around on #git earlier today and decided that the best approach here is to error out and tell the user that their configuration is wrong, as this is likely more user friendly than silently ignoring the user's request. Since the new builtin-fetch is already issuing the error there is no code change required, we just need to remove the bad configuration from our test. Signed-off-by: Shawn O. Pearce --- t/t5515-fetch-merge-logic.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 't') diff --git a/t/t5515-fetch-merge-logic.sh b/t/t5515-fetch-merge-logic.sh index 6c9cc67508..31c1081617 100755 --- a/t/t5515-fetch-merge-logic.sh +++ b/t/t5515-fetch-merge-logic.sh @@ -84,8 +84,7 @@ test_expect_success setup ' git config branch.br-$remote-merge.merge refs/heads/three && git config branch.br-$remote-octopus.remote $remote && git config branch.br-$remote-octopus.merge refs/heads/one && - git config --add branch.br-$remote-octopus.merge two && - git config --add branch.br-$remote-octopus.merge remotes/rem/three + git config --add branch.br-$remote-octopus.merge two done ' -- cgit v1.2.3 From 85682c1903a4ae776b0bf2d30d9ecd1e19689131 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 18 Sep 2007 04:54:53 -0400 Subject: Correct handling of branch.$name.merge in builtin-fetch My prior bug fix for git-push titled "Don't configure remote "." to fetch everything to itself" actually broke t5520 as we were unable to evaluate a branch configuration of: [branch "copy"] remote = . merge = refs/heads/master as remote "." did not have a "remote...fetch" configuration entry to offer up refs/heads/master as a possible candidate available to be fetched and merged. In shell script git-fetch and prior to the above mentioned commit this was hardcoded for a url of "." to be the set of local branches. Chasing down this bug led me to the conclusion that our prior behavior with regards to branch.$name.merge was incorrect. In the shell script based git-fetch implementation we only fetched and merged a branch if it appeared both in branch.$name.merge *and* in remote.$r.fetch, where $r = branch.$name.remote. In other words in the following config file: [remote "origin"] url = git://git.kernel.org/pub/scm/git/git.git fetch = refs/heads/master:refs/remotes/origin/master [branch "master"] remote = origin merge = refs/heads/master [branch "pu"] remote = origin merge = refs/heads/pu Attempting to run `git pull` while on branch "pu" would always give the user "Already up-to-date" as git-fetch did not fetch pu and thus did not mark it for merge in .git/FETCH_HEAD. The configured merge would always be ignored and the user would be left scratching her confused head wondering why merge did not work on "pu" but worked fine on "master". If we are using the "default fetch" specification for the current branch and the current branch has a branch.$name.merge configured we now union it with the list of refs in remote.$r.fetch. This way the above configuration does what the user expects it to do, which is to fetch only "master" by default but when on "pu" to fetch both "master" and "pu". This uncovered some breakage in the test suite where old-style Cogito branches (.git/branches/$r) did not fetch the branches listed in .git/config for merging and thus did not actually merge them if the user tried to use `git pull` on that branch. Junio and I discussed it on list and felt that the union approach here makes more sense to DWIM for the end-user than silently ignoring their configured request so the test vectors for t5515 have been updated to include for-merge lines in .git/FETCH_HEAD where they have been configured for-merge in .git/config. Since we are now performing a union of the fetch specification and the merge specification and we cannot allow a branch to be listed twice (otherwise it comes out twice in .git/FETCH_HEAD) we need to perform a double loop here over all of the branch.$name.merge lines and try to set their merge flag if we have already schedule that branch for fetching by remote.$r.fetch. If no match is found then we must add new specifications to fetch the branch but not store it as no local tracking branch has been designated. Signed-off-by: Shawn O. Pearce --- t/t5515/fetch.br-branches-default-merge | 1 + t/t5515/fetch.br-branches-default-merge_branches-default | 1 + t/t5515/fetch.br-branches-default-octopus | 2 ++ t/t5515/fetch.br-branches-default-octopus_branches-default | 2 ++ t/t5515/fetch.br-branches-one-merge | 1 + t/t5515/fetch.br-branches-one-merge_branches-one | 1 + t/t5515/fetch.br-branches-one-octopus | 1 + t/t5515/fetch.br-branches-one-octopus_branches-one | 1 + 8 files changed, 10 insertions(+) (limited to 't') diff --git a/t/t5515/fetch.br-branches-default-merge b/t/t5515/fetch.br-branches-default-merge index 828bfd8e9e..ca2cc1d1b4 100644 --- a/t/t5515/fetch.br-branches-default-merge +++ b/t/t5515/fetch.br-branches-default-merge @@ -1,5 +1,6 @@ # br-branches-default-merge 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge branch 'master' of ../ +0567da4d5edd2ff4bb292a465ba9e64dcad9536b branch 'three' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-branches-default-merge_branches-default b/t/t5515/fetch.br-branches-default-merge_branches-default index f1486730fa..7d947cd80f 100644 --- a/t/t5515/fetch.br-branches-default-merge_branches-default +++ b/t/t5515/fetch.br-branches-default-merge_branches-default @@ -1,5 +1,6 @@ # br-branches-default-merge branches-default 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge branch 'master' of ../ +0567da4d5edd2ff4bb292a465ba9e64dcad9536b branch 'three' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-branches-default-octopus b/t/t5515/fetch.br-branches-default-octopus index bb1a1915c6..ec39c54b7e 100644 --- a/t/t5515/fetch.br-branches-default-octopus +++ b/t/t5515/fetch.br-branches-default-octopus @@ -1,5 +1,7 @@ # br-branches-default-octopus 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge branch 'master' of ../ +8e32a6d901327a23ef831511badce7bf3bf46689 branch 'one' of ../ +6134ee8f857693b96ff1cc98d3e2fd62b199e5a8 branch 'two' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-branches-default-octopus_branches-default b/t/t5515/fetch.br-branches-default-octopus_branches-default index 970fc93725..6bf42e24b6 100644 --- a/t/t5515/fetch.br-branches-default-octopus_branches-default +++ b/t/t5515/fetch.br-branches-default-octopus_branches-default @@ -1,5 +1,7 @@ # br-branches-default-octopus branches-default 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge branch 'master' of ../ +8e32a6d901327a23ef831511badce7bf3bf46689 branch 'one' of ../ +6134ee8f857693b96ff1cc98d3e2fd62b199e5a8 branch 'two' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-branches-one-merge b/t/t5515/fetch.br-branches-one-merge index 24099fd53e..b4b3b35ce0 100644 --- a/t/t5515/fetch.br-branches-one-merge +++ b/t/t5515/fetch.br-branches-one-merge @@ -1,5 +1,6 @@ # br-branches-one-merge 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge branch 'one' of ../ +0567da4d5edd2ff4bb292a465ba9e64dcad9536b branch 'three' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-branches-one-merge_branches-one b/t/t5515/fetch.br-branches-one-merge_branches-one index e4b4fdee4c..2ecef384eb 100644 --- a/t/t5515/fetch.br-branches-one-merge_branches-one +++ b/t/t5515/fetch.br-branches-one-merge_branches-one @@ -1,5 +1,6 @@ # br-branches-one-merge branches-one 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge branch 'one' of ../ +0567da4d5edd2ff4bb292a465ba9e64dcad9536b branch 'three' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-branches-one-octopus b/t/t5515/fetch.br-branches-one-octopus index 53fe808a3b..96e3029416 100644 --- a/t/t5515/fetch.br-branches-one-octopus +++ b/t/t5515/fetch.br-branches-one-octopus @@ -1,5 +1,6 @@ # br-branches-one-octopus 8e32a6d901327a23ef831511badce7bf3bf46689 branch 'one' of ../ +6134ee8f857693b96ff1cc98d3e2fd62b199e5a8 branch 'two' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ diff --git a/t/t5515/fetch.br-branches-one-octopus_branches-one b/t/t5515/fetch.br-branches-one-octopus_branches-one index 41b18ff78a..55e0bad621 100644 --- a/t/t5515/fetch.br-branches-one-octopus_branches-one +++ b/t/t5515/fetch.br-branches-one-octopus_branches-one @@ -1,5 +1,6 @@ # br-branches-one-octopus branches-one 8e32a6d901327a23ef831511badce7bf3bf46689 branch 'one' of ../ +6134ee8f857693b96ff1cc98d3e2fd62b199e5a8 branch 'two' of ../ 754b754407bf032e9a2f9d5a9ad05ca79a6b228f not-for-merge tag 'tag-master' of ../ 8e32a6d901327a23ef831511badce7bf3bf46689 not-for-merge tag 'tag-one' of ../ 22feea448b023a2d864ef94b013735af34d238ba not-for-merge tag 'tag-one-tree' of ../ -- cgit v1.2.3 From 400e58b74e701398bd7e51bd3f102f31cc45ee93 Mon Sep 17 00:00:00 2001 From: Sam Vilain Date: Fri, 21 Sep 2007 14:02:33 +1200 Subject: git-svn: fix test for trunk svn (commit message not needed) The 'svn mv -m "rename to thunk"' was a local operation, therefore not needing a commit message, it was silently ignored. Newer svn clients will instead raise an error. Signed-off-by: Sam Vilain Acked-by: Eric Wong Signed-off-by: Junio C Hamano --- t/t9104-git-svn-follow-parent.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 't') diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh index d8f9cab35d..9eab94569f 100755 --- a/t/t9104-git-svn-follow-parent.sh +++ b/t/t9104-git-svn-follow-parent.sh @@ -19,8 +19,7 @@ test_expect_success 'initialize repo' " poke trunk/readme && svn commit -m 'another commit' && svn up && - svn mv -m 'rename to thunk' trunk thunk && - svn up && + svn mv trunk thunk && echo goodbye >> thunk/readme && poke thunk/readme && svn commit -m 'bye now' && -- cgit v1.2.3 From d99c74e2913ab098953bd5b422b95f39e2dcfb55 Mon Sep 17 00:00:00 2001 From: Sam Vilain Date: Fri, 21 Sep 2007 14:02:34 +1200 Subject: git-svn: fix test for trunk svn (transaction out of date) Older svn clients did not raise a 'transaction out of date' error here, but trunk does - so 'svn up'. Signed-off-by: Sam Vilain Acked-by: Eric Wong Signed-off-by: Junio C Hamano --- t/t9101-git-svn-props.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't') diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh index 622ea1c0df..5aac644223 100755 --- a/t/t9101-git-svn-props.sh +++ b/t/t9101-git-svn-props.sh @@ -140,6 +140,7 @@ test_expect_success 'test show-ignore' " cd test_wc && mkdir -p deeply/nested/directory && svn add deeply && + svn up && svn propset -R svn:ignore 'no-such-file*' . svn commit -m 'propset svn:ignore' cd .. && -- cgit v1.2.3 From ffab62681cf420abb87aabf3fd2fc96e000877e4 Mon Sep 17 00:00:00 2001 From: Sam Vilain Date: Fri, 21 Sep 2007 15:27:01 +1200 Subject: git-svn: handle changed svn command-line syntax Previously, if you passed a revision and a path to svn cp, it meant to look back at that revision and select that path. New behaviour is to get the path then go back to the revision (like other commands that accept @REV or -rREV do). The more consistent syntax is not supported by the old tools, so we have to try both in turn. Signed-off-by: Sam Vilain Acked-by: Eric Wong Signed-off-by: Junio C Hamano --- t/t9104-git-svn-follow-parent.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t9104-git-svn-follow-parent.sh b/t/t9104-git-svn-follow-parent.sh index 9eab94569f..7ba76309ac 100755 --- a/t/t9104-git-svn-follow-parent.sh +++ b/t/t9104-git-svn-follow-parent.sh @@ -51,8 +51,10 @@ test_expect_success 'init and fetch from one svn-remote' " " test_expect_success 'follow deleted parent' " - svn cp -m 'resurrecting trunk as junk' \ - -r2 $svnrepo/trunk $svnrepo/junk && + (svn cp -m 'resurrecting trunk as junk' \ + $svnrepo/trunk@2 $svnrepo/junk || + svn cp -m 'resurrecting trunk as junk' \ + -r2 $svnrepo/trunk $svnrepo/junk) && git config --add svn-remote.svn.fetch \ junk:refs/remotes/svn/junk && git-svn fetch -i svn/thunk && -- cgit v1.2.3 From a85d1b69172f397e815e1ce02db41e4b82b86162 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 24 Sep 2007 00:51:40 +0200 Subject: Add test-script for git-merge porcelain This test-script excercises the porcelainish aspects of git-merge, and does it thoroughly enough to detect a small bug already noticed by Junio: squashing an octopus generates a faulty .git/SQUASH_MSG. Signed-off-by: Lars Hjemli Signed-off-by: Junio C Hamano --- t/t7600-merge.sh | 344 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 344 insertions(+) create mode 100755 t/t7600-merge.sh (limited to 't') diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh new file mode 100755 index 0000000000..dec6ea2271 --- /dev/null +++ b/t/t7600-merge.sh @@ -0,0 +1,344 @@ +#!/bin/sh +# +# Copyright (c) 2007 Lars Hjemli +# + +test_description='git-merge + +Testing basic merge operations/option parsing.' + +. ./test-lib.sh + +cat >file <file.1 <file.5 <file.9 <result.1 <result.1-5 <result.1-5-9 <msg.1-5 && + echo "Merge commit 'c2'; commit 'c3'" >msg.1-5-9 && + echo "Squashed commit of the following:" >squash.1 && + echo >>squash.1 && + git log --no-merges ^HEAD c1 >>squash.1 && + echo "Squashed commit of the following:" >squash.1-5 && + echo >>squash.1-5 && + git log --no-merges ^HEAD c2 >>squash.1-5 && + echo "Squashed commit of the following:" >squash.1-5-9 && + echo >>squash.1-5-9 && + git log --no-merges ^HEAD c2 c3 >>squash.1-5-9 +} + +verify_diff() { + if ! diff -u "$1" "$2" + then + echo "$3" + false + fi +} + +verify_merge() { + verify_diff "$2" "$1" "[OOPS] bad merge result" && + if test $(git ls-files -u | wc -l) -gt 0 + then + echo "[OOPS] unmerged files" + false + fi && + if ! git diff --exit-code + then + echo "[OOPS] working tree != index" + false + fi && + if test -n "$3" + then + git show -s --pretty=format:%s HEAD >msg.act && + verify_diff "$3" msg.act "[OOPS] bad merge message" + fi +} + +verify_head() { + if test "$1" != "$(git rev-parse HEAD)" + then + echo "[OOPS] HEAD != $1" + false + fi +} + +verify_parents() { + i=1 + while test $# -gt 0 + do + if test "$1" != "$(git rev-parse HEAD^$i)" + then + echo "[OOPS] HEAD^$i != $1" + return 1 + fi + i=$(expr $i + 1) + shift + done +} + +verify_mergeheads() { + i=1 + if ! test -f .git/MERGE_HEAD + then + echo "[OOPS] MERGE_HEAD is missing" + false + fi && + while test $# -gt 0 + do + head=$(head -n $i .git/MERGE_HEAD | tail -n 1) + if test "$1" != "$head" + then + echo "[OOPS] MERGE_HEAD $i != $1" + return 1 + fi + i=$(expr $i + 1) + shift + done +} + +verify_no_mergehead() { + if test -f .git/MERGE_HEAD + then + echo "[OOPS] MERGE_HEAD exists" + false + fi +} + + +test_expect_success 'setup' ' + git add file && + test_tick && + git commit -m "commit 0" && + git tag c0 && + c0=$(git rev-parse HEAD) && + cp file.1 file && + git add file && + test_tick && + git commit -m "commit 1" && + git tag c1 && + c1=$(git rev-parse HEAD) && + git reset --hard "$c0" && + cp file.5 file && + git add file && + test_tick && + git commit -m "commit 2" && + git tag c2 && + c2=$(git rev-parse HEAD) && + git reset --hard "$c0" && + cp file.9 file && + git add file && + test_tick && + git commit -m "commit 3" && + git tag c3 && + c3=$(git rev-parse HEAD) + git reset --hard "$c0" && + create_merge_msgs +' + +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_success 'merge c0 with c1' ' + git reset --hard c0 && + git merge c1 && + verify_merge file result.1 && + verify_head "$c1" +' + +test_debug 'gitk --all' + +test_expect_success 'merge c1 with c2' ' + git reset --hard c1 && + test_tick && + git merge c2 && + verify_merge file result.1-5 msg.1-5 && + verify_parents $c1 $c2 +' + +test_debug 'gitk --all' + +test_expect_success 'merge c1 with c2 and c3' ' + git reset --hard c1 && + test_tick && + git merge c2 c3 && + verify_merge file result.1-5-9 msg.1-5-9 && + verify_parents $c1 $c2 $c3 +' + +test_debug 'gitk --all' + +test_expect_success 'merge c0 with c1 (no-commit)' ' + git reset --hard c0 && + git merge --no-commit c1 && + verify_merge file result.1 && + verify_head $c1 +' + +test_debug 'gitk --all' + +test_expect_success 'merge c1 with c2 (no-commit)' ' + git reset --hard c1 && + git merge --no-commit c2 && + verify_merge file result.1-5 && + verify_head $c1 && + verify_mergeheads $c2 +' + +test_debug 'gitk --all' + +test_expect_success 'merge c1 with c2 and c3 (no-commit)' ' + git reset --hard c1 && + git merge --no-commit c2 c3 && + verify_merge file result.1-5-9 && + verify_head $c1 && + verify_mergeheads $c2 $c3 +' + +test_debug 'gitk --all' + +test_expect_success 'merge c0 with c1 (squash)' ' + git reset --hard c0 && + git merge --squash c1 && + verify_merge file result.1 && + verify_head $c0 && + verify_no_mergehead && + verify_diff squash.1 .git/SQUASH_MSG "[OOPS] bad squash message" +' + +test_debug 'gitk --all' + +test_expect_success 'merge c1 with c2 (squash)' ' + git reset --hard c1 && + git merge --squash c2 && + verify_merge file result.1-5 && + verify_head $c1 && + verify_no_mergehead && + verify_diff squash.1-5 .git/SQUASH_MSG "[OOPS] bad squash message" +' + +test_debug 'gitk --all' + +test_expect_success 'merge c1 with c2 and c3 (squash)' ' + git reset --hard c1 && + git merge --squash c2 c3 && + verify_merge file result.1-5-9 && + verify_head $c1 && + verify_no_mergehead && + verify_diff squash.1-5-9 .git/SQUASH_MSG "[OOPS] bad squash message" +' + +test_debug 'gitk --all' + +test_done -- cgit v1.2.3 From aec7b362ad07e1a2c58051c8db653dabffee8960 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 24 Sep 2007 00:51:43 +0200 Subject: git-merge: add support for branch..mergeoptions This enables per branch configuration of merge options. Currently, the most useful options to specify per branch are --squash, --summary/--no-summary and possibly --strategy, but all options are supported. Note: Options containing whitespace will _not_ be handled correctly. Luckily, the only option which can include whitespace is --message and it doesn't make much sense to give that option a default value. Signed-off-by: Lars Hjemli Signed-off-by: Junio C Hamano --- t/t7600-merge.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 't') diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh index dec6ea2271..110974cd01 100755 --- a/t/t7600-merge.sh +++ b/t/t7600-merge.sh @@ -341,4 +341,58 @@ test_expect_success 'merge c1 with c2 and c3 (squash)' ' test_debug 'gitk --all' +test_expect_success 'merge c1 with c2 (no-commit in config)' ' + git reset --hard c1 && + git config branch.master.mergeoptions "--no-commit" && + git merge c2 && + verify_merge file result.1-5 && + verify_head $c1 && + verify_mergeheads $c2 +' + +test_debug 'gitk --all' + +test_expect_success 'merge c1 with c2 (squash in config)' ' + git reset --hard c1 && + git config branch.master.mergeoptions "--squash" && + git merge c2 && + verify_merge file result.1-5 && + verify_head $c1 && + verify_no_mergehead && + verify_diff squash.1-5 .git/SQUASH_MSG "[OOPS] bad squash message" +' + +test_debug 'gitk --all' + +test_expect_success 'override config option -n' ' + git reset --hard c1 && + git config branch.master.mergeoptions "-n" && + test_tick && + git merge --summary c2 >diffstat.txt && + verify_merge file result.1-5 msg.1-5 && + verify_parents $c1 $c2 && + if ! grep -e "^ file | \+2 +-$" diffstat.txt + then + echo "[OOPS] diffstat was not generated" + fi +' + +test_debug 'gitk --all' + +test_expect_success 'override config option --summary' ' + git reset --hard c1 && + git config branch.master.mergeoptions "--summary" && + test_tick && + git merge -n c2 >diffstat.txt && + verify_merge file result.1-5 msg.1-5 && + verify_parents $c1 $c2 && + if grep -e "^ file | \+2 +-$" diffstat.txt + then + echo "[OOPS] diffstat was generated" + false + fi +' + +test_debug 'gitk --all' + test_done -- cgit v1.2.3 From d08af0ad745869a4fe36bc8df4f9804edfb74eb9 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 24 Sep 2007 00:51:44 +0200 Subject: git-merge: add support for --commit and --no-squash These options can be used to override --no-commit and --squash, which is needed since --no-commit and --squash now can be specified as default merge options in $GIT_DIR/config. The change also introduces slightly different behavior for --no-commit: when specified, it explicitly overrides --squash. Earlier, 'git merge --squash --no-commit' would result in a squashed merge (i.e. no $GIT_DIR/MERGE_HEAD was created) but with this patch the command will behave as if --squash hadn't been specified. Signed-off-by: Lars Hjemli Signed-off-by: Junio C Hamano --- t/t7600-merge.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 't') diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh index 110974cd01..b0ef488c29 100755 --- a/t/t7600-merge.sh +++ b/t/t7600-merge.sh @@ -395,4 +395,26 @@ test_expect_success 'override config option --summary' ' test_debug 'gitk --all' +test_expect_success 'merge c1 with c2 (override --no-commit)' ' + git reset --hard c1 && + git config branch.master.mergeoptions "--no-commit" && + test_tick && + git merge --commit c2 && + verify_merge file result.1-5 msg.1-5 && + verify_parents $c1 $c2 +' + +test_debug 'gitk --all' + +test_expect_success 'merge c1 with c2 (override --squash)' ' + git reset --hard c1 && + git config branch.master.mergeoptions "--squash" && + test_tick && + git merge --no-squash c2 && + verify_merge file result.1-5 msg.1-5 && + verify_parents $c1 $c2 +' + +test_debug 'gitk --all' + test_done -- cgit v1.2.3 From d66424c4ac661c69640765260235452499d80378 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Mon, 24 Sep 2007 00:51:45 +0200 Subject: git-merge: add --ff and --no-ff options These new options can be used to control the policy for fast-forward merges: --ff allows it (this is the default) while --no-ff will create a merge commit. Signed-off-by: Lars Hjemli Signed-off-by: Junio C Hamano --- t/t7600-merge.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 't') diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh index b0ef488c29..6424c6e2c0 100755 --- a/t/t7600-merge.sh +++ b/t/t7600-merge.sh @@ -417,4 +417,24 @@ test_expect_success 'merge c1 with c2 (override --squash)' ' test_debug 'gitk --all' +test_expect_success 'merge c0 with c1 (no-ff)' ' + git reset --hard c0 && + test_tick && + git merge --no-ff c1 && + verify_merge file result.1 && + verify_parents $c0 $c1 +' + +test_debug 'gitk --all' + +test_expect_success 'merge c0 with c1 (ff overrides no-ff)' ' + git reset --hard c0 && + git config branch.master.mergeoptions "--no-ff" && + git merge --ff c1 && + verify_merge file result.1 && + verify_head $c1 +' + +test_debug 'gitk --all' + test_done -- cgit v1.2.3 From 683b56791b4e8a29ff9bc98c7faff69d7854d845 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 23 Sep 2007 22:29:12 -0700 Subject: git-remote rm: add tests and minor fix-ups This fixes "git remote rm" which always exited with a failure, corrects indentation, and adds tests. Signed-off-by: Junio C Hamano --- t/t5505-remote.sh | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100755 t/t5505-remote.sh (limited to 't') diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh new file mode 100755 index 0000000000..636aec2f71 --- /dev/null +++ b/t/t5505-remote.sh @@ -0,0 +1,100 @@ +#!/bin/sh + +test_description='git remote porcelain-ish' + +. ./test-lib.sh + +GIT_CONFIG=.git/config +export GIT_CONFIG + +setup_repository () { + mkdir "$1" && ( + cd "$1" && + git init && + >file && + git add file && + git commit -m "Initial" && + git checkout -b side && + >elif && + git add elif && + git commit -m "Second" && + git checkout master + ) +} + +tokens_match () { + echo "$1" | tr ' ' '\012' | sort | sed -e '/^$/d' >expect && + echo "$2" | tr ' ' '\012' | sort | sed -e '/^$/d' >actual && + diff -u expect actual +} + +check_remote_track () { + actual=$(git remote show "$1" | sed -n -e '$p') && + shift && + tokens_match "$*" "$actual" +} + +check_tracking_branch () { + f="" && + r=$(git for-each-ref "--format=%(refname)" | + sed -ne "s|^refs/remotes/$1/||p") && + shift && + tokens_match "$*" "$r" +} + +test_expect_success setup ' + + setup_repository one && + setup_repository two && + ( + cd two && git branch another + ) && + git clone one test + +' + +test_expect_success 'remote information for the origin' ' +( + cd test && + tokens_match origin "$(git remote)" && + check_remote_track origin master side && + check_tracking_branch origin HEAD master side +) +' + +test_expect_success 'add another remote' ' +( + cd test && + git remote add -f second ../two && + tokens_match "origin second" "$(git remote)" && + check_remote_track origin master side && + check_remote_track second master side another && + check_tracking_branch second master side another && + git for-each-ref "--format=%(refname)" refs/remotes | + sed -e "/^refs\/remotes\/origin\//d" \ + -e "/^refs\/remotes\/second\//d" >actual && + >expect && + diff -u expect actual +) +' + +test_expect_success 'remove remote' ' +( + cd test && + git remote rm second +) +' + +test_expect_success 'remove remote' ' +( + cd test && + tokens_match origin "$(git remote)" && + check_remote_track origin master side && + git for-each-ref "--format=%(refname)" refs/remotes | + sed -e "/^refs\/remotes\/origin\//d" >actual && + >expect && + diff -u expect actual +) +' + +test_done -- cgit v1.2.3 From 85d81a757e495fe74d8a403f813d3748e832c112 Mon Sep 17 00:00:00 2001 From: Glenn Rempe Date: Mon, 24 Sep 2007 13:33:38 -0700 Subject: Fixed minor typo in t/t9001-send-email.sh test command line. The git-send-email command line in the test was missing a single hyphen. Signed-off-by: Glenn Rempe Signed-off-by: Junio C Hamano --- t/t9001-send-email.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index e9ea33c18d..83f9470202 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -30,7 +30,7 @@ test_expect_success 'Extract patches' ' ' test_expect_success 'Send patches' ' - git send-email -from="Example " --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors + git send-email --from="Example " --to=nobody@example.com --smtp-server="$(pwd)/fake.sendmail" $patches 2>errors ' cat >expected <<\EOF -- cgit v1.2.3 From be6ff208d8248c3f282df14fdf3c08db57e92007 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 25 Sep 2007 16:42:36 +0100 Subject: rebase -i: commit when continuing after "edit" When doing an "edit" on a commit, editing and git-adding some files, "git rebase -i" complained about a missing "author-script". The idea was that the user would call "git commit --amend" herself. But we can be nice and do that for the user. Noticed by Dmitry Potapov. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 718c9c1fa3..1af73a47c6 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -80,7 +80,7 @@ cat "$1".tmp action=pick for line in $FAKE_LINES; do case $line in - squash) + squash|edit) action="$line";; *) echo sed -n "${line}s/^pick/$action/p" @@ -297,4 +297,16 @@ test_expect_success 'ignore patch if in upstream' ' test $HEAD = $(git rev-parse HEAD^) ' +test_expect_success '--continue tries to commit, even for "edit"' ' + parent=$(git rev-parse HEAD^) && + test_tick && + FAKE_LINES="edit 1" git rebase -i HEAD^ && + echo edited > file7 && + git add file7 && + FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue && + test edited = $(git show HEAD:file7) && + git show HEAD | grep chouette && + test $parent = $(git rev-parse HEAD^) +' + test_done -- cgit v1.2.3 From 55246aac6717e86c14f31391ac903ed810d1a9a0 Mon Sep 17 00:00:00 2001 From: Michal Vitecek Date: Tue, 25 Sep 2007 16:38:46 +0200 Subject: Don't use "" for placeholders and suppress printing of empty user formats. This changes the interporate() to replace entries with NULL values by the empty string, and uses it to interpolate missing fields in custom format output used in git-log and friends. It is most useful to avoid output from %b format for a commit log message that lack any body text. Signed-off-by: Junio C Hamano --- t/t6006-rev-list-format.sh | 8 -------- t/t7500-commit.sh | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) (limited to 't') diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh index ad6d0b8c9d..1e4541afea 100755 --- a/t/t6006-rev-list-format.sh +++ b/t/t6006-rev-list-format.sh @@ -79,9 +79,7 @@ EOF test_format encoding %e <<'EOF' commit 131a310eb913d107dd3c09a65d1651175898735d - commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873 - EOF test_format subject %s <<'EOF' @@ -93,9 +91,7 @@ EOF test_format body %b <<'EOF' commit 131a310eb913d107dd3c09a65d1651175898735d - commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873 - EOF test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<'EOF' @@ -121,9 +117,7 @@ test_format complex-encoding %e <<'EOF' commit f58db70b055c5718631e5c61528b28b12090cdea iso8859-1 commit 131a310eb913d107dd3c09a65d1651175898735d - commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873 - EOF test_format complex-subject %s <<'EOF' @@ -142,9 +136,7 @@ and it will be encoded in iso8859-1. We should therefore include an iso8859 character: ¡bueno! commit 131a310eb913d107dd3c09a65d1651175898735d - commit 86c75cfd708a0e5868dc876ed5b8bb66c80b4873 - EOF test_done diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh index f11ada8617..abbf54ba63 100755 --- a/t/t7500-commit.sh +++ b/t/t7500-commit.sh @@ -81,7 +81,7 @@ test_expect_success 'explicit commit message should override template' ' git add foo && GIT_EDITOR=../t7500/add-content git commit --template "$TEMPLATE" \ -m "command line msg" && - commit_msg_is "command line msg" + commit_msg_is "command line msg" ' test_expect_success 'commit message from file should override template' ' @@ -90,7 +90,7 @@ test_expect_success 'commit message from file should override template' ' echo "standard input msg" | GIT_EDITOR=../t7500/add-content git commit \ --template "$TEMPLATE" --file - && - commit_msg_is "standard input msg" + commit_msg_is "standard input msg" ' test_done -- cgit v1.2.3 From 73697a0b572f7f216d8355d83bf69e9b42e9a077 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Tue, 25 Sep 2007 16:43:15 +0100 Subject: rebase -i: work on a detached HEAD Earlier, rebase -i refused to rebase a detached HEAD. Now it no longer does. Incidentally, this fixes "git gc --auto" shadowing the true exit status. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 1af73a47c6..f2214dd0fa 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -309,4 +309,12 @@ test_expect_success '--continue tries to commit, even for "edit"' ' test $parent = $(git rev-parse HEAD^) ' +test_expect_success 'rebase a detached HEAD' ' + grandparent=$(git rev-parse HEAD~2) && + git checkout $(git rev-parse HEAD) && + test_tick && + FAKE_LINES="2 1" git rebase -i HEAD~2 && + test $grandparent = $(git rev-parse HEAD~2) +' + test_done -- cgit v1.2.3 From 1abbe475ff17349839f72a024cf665b8ec86473f Mon Sep 17 00:00:00 2001 From: Josh England Date: Wed, 26 Sep 2007 15:31:01 -0600 Subject: post-checkout hook, tests, and docs Updated post-checkout hook to take a flag specifying whether the checkout is a branch checkout or a file checkout (from the index). Signed-off-by: Josh England Signed-off-by: Junio C Hamano --- t/t5403-post-checkout-hook.sh | 74 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100755 t/t5403-post-checkout-hook.sh (limited to 't') diff --git a/t/t5403-post-checkout-hook.sh b/t/t5403-post-checkout-hook.sh new file mode 100755 index 0000000000..487abf3fc6 --- /dev/null +++ b/t/t5403-post-checkout-hook.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# +# Copyright (c) 2006 Josh England +# + +test_description='Test the post-checkout hook.' +. ./test-lib.sh + +test_expect_success setup ' + echo Data for commit0. >a && + echo Data for commit0. >b && + git update-index --add a && + git update-index --add b && + tree0=$(git write-tree) && + commit0=$(echo setup | git commit-tree $tree0) && + git update-ref refs/heads/master $commit0 && + git-clone ./. clone1 && + git-clone ./. clone2 && + GIT_DIR=clone2/.git git branch -a new2 && + echo Data for commit1. >clone2/b && + GIT_DIR=clone2/.git git add clone2/b && + GIT_DIR=clone2/.git git commit -m new2 +' + +for clone in 1 2; do + cat >clone${clone}/.git/hooks/post-checkout <<'EOF' +#!/bin/sh +echo $@ > $GIT_DIR/post-checkout.args +EOF + chmod u+x clone${clone}/.git/hooks/post-checkout +done + +test_expect_success 'post-checkout runs as expected ' ' + GIT_DIR=clone1/.git git checkout master && + test -e clone1/.git/post-checkout.args +' + +test_expect_success 'post-checkout receives the right arguments with HEAD unchanged ' ' + old=$(awk "{print \$1}" clone1/.git/post-checkout.args) && + new=$(awk "{print \$2}" clone1/.git/post-checkout.args) && + flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) && + test $old = $new -a $flag == 1 +' + +test_expect_success 'post-checkout runs as expected ' ' + GIT_DIR=clone1/.git git checkout master && + test -e clone1/.git/post-checkout.args +' + +test_expect_success 'post-checkout args are correct with git checkout -b ' ' + GIT_DIR=clone1/.git git checkout -b new1 && + old=$(awk "{print \$1}" clone1/.git/post-checkout.args) && + new=$(awk "{print \$2}" clone1/.git/post-checkout.args) && + flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) && + test $old = $new -a $flag == 1 +' + +test_expect_success 'post-checkout receives the right args with HEAD changed ' ' + GIT_DIR=clone2/.git git checkout new2 && + old=$(awk "{print \$1}" clone2/.git/post-checkout.args) && + new=$(awk "{print \$2}" clone2/.git/post-checkout.args) && + flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) && + test $old != $new -a $flag == 1 +' + +test_expect_success 'post-checkout receives the right args when not switching branches ' ' + GIT_DIR=clone2/.git git checkout master b && + old=$(awk "{print \$1}" clone2/.git/post-checkout.args) && + new=$(awk "{print \$2}" clone2/.git/post-checkout.args) && + flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) && + test $old == $new -a $flag == 0 +' + +test_done -- cgit v1.2.3 From 81ab1cb43a872fc527b26388bc7e781c816d723b Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sun, 30 Sep 2007 00:34:23 +0100 Subject: rebase -i: squash should retain the authorship of the _first_ commit It was determined on the mailing list, that it makes more sense for a "squash" to keep the author of the first commit as the author for the result of the squash. Make it so. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 718c9c1fa3..6c92d61192 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -180,7 +180,7 @@ test_expect_success 'squash' ' ' test_expect_success 'retain authorship when squashing' ' - git show HEAD | grep "^Author: Nitfol" + git show HEAD | grep "^Author: Twerp Snog" ' test_expect_success 'preserve merges with -p' ' -- cgit v1.2.3 From cd547b4886c5338a70eb8a674bfc40eac5cab3d9 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 1 Oct 2007 00:59:39 +0100 Subject: fetch/push: readd rsync support We lost rsync support when transitioning from shell to C. Support it again (even if the transport is technically deprecated, some people just do not have any chance to use anything else). Also, add a test to t5510. Since rsync transport is not configured by default on most machines, and especially not such that you can write to rsync://127.0.0.1$(pwd)/, it is disabled by default; you can enable it by setting the environment variable TEST_RSYNC. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t5510-fetch.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 't') diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 439430f569..73a4e3cbc3 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -153,4 +153,39 @@ test_expect_success 'bundle should be able to create a full history' ' ' +test "$TEST_RSYNC" && { +test_expect_success 'fetch via rsync' ' + git pack-refs && + mkdir rsynced && + cd rsynced && + git init && + git fetch rsync://127.0.0.1$(pwd)/../.git master:refs/heads/master && + git gc --prune && + test $(git rev-parse master) = $(cd .. && git rev-parse master) && + git fsck --full +' + +test_expect_success 'push via rsync' ' + mkdir ../rsynced2 && + (cd ../rsynced2 && + git init) && + git push rsync://127.0.0.1$(pwd)/../rsynced2/.git master && + cd ../rsynced2 && + git gc --prune && + test $(git rev-parse master) = $(cd .. && git rev-parse master) && + git fsck --full +' + +test_expect_success 'push via rsync' ' + cd .. && + mkdir rsynced3 && + (cd rsynced3 && + git init) && + git push --all rsync://127.0.0.1$(pwd)/rsynced3/.git && + cd rsynced3 && + test $(git rev-parse master) = $(cd .. && git rev-parse master) && + git fsck --full +' +} + test_done -- cgit v1.2.3 From 54e1abce90ed44d0674772a735ac387ce3e264f2 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 3 Oct 2007 00:03:53 -0700 Subject: Add test case for ls-files --with-tree This tests basic functionality and also exercises a bug noticed by Keith Packard, (prune_cache followed by add_index_entry can trigger an attempt to realloc a pointer into the middle of an allocated buffer). Signed-off-by: Junio C Hamano --- t/t3060-ls-files-with-tree.sh | 71 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 t/t3060-ls-files-with-tree.sh (limited to 't') diff --git a/t/t3060-ls-files-with-tree.sh b/t/t3060-ls-files-with-tree.sh new file mode 100755 index 0000000000..68eb266d73 --- /dev/null +++ b/t/t3060-ls-files-with-tree.sh @@ -0,0 +1,71 @@ +#!/bin/sh +# +# Copyright (c) 2007 Carl D. Worth +# + +test_description='git ls-files test (--with-tree). + +This test runs git ls-files --with-tree and in particular in +a scenario known to trigger a crash with some versions of git. +' +. ./test-lib.sh + +test_expect_success setup ' + + # The bug we are exercising requires a fair number of entries + # in a sub-directory so that add_index_entry will trigger a + # realloc. + + echo file >expected && + mkdir sub && + bad= && + for n in 0 1 2 3 4 5 + do + for m in 0 1 2 3 4 5 6 7 8 9 + do + num=00$n$m && + >sub/file-$num && + echo file-$num >>expected || { + bad=t + break + } + done && test -z "$bad" || { + bad=t + break + } + done && test -z "$bad" && + git add . && + git commit -m "add a bunch of files" && + + # We remove them all so that we will have something to add + # back with --with-tree and so that we will definitely be + # under the realloc size to trigger the bug. + rm -rf sub && + git commit -a -m "remove them all" && + + # The bug also requires some entry before our directory so that + # prune_path will modify the_index.cache + + mkdir a_directory_that_sorts_before_sub && + >a_directory_that_sorts_before_sub/file && + mkdir sub && + >sub/file && + git add . +' + +# We have to run from a sub-directory to trigger prune_path +# Then we finally get to run our --with-tree test +cd sub + +test_expect_success 'git -ls-files --with-tree should succeed from subdir' ' + + git ls-files --with-tree=HEAD~1 >../output + +' + +cd .. +test_expect_success \ + 'git -ls-files --with-tree should add entries from named tree.' \ + 'diff -u expected output' + +test_done -- cgit v1.2.3 From 96b2d4fa927c5055adc5b1d08f10a5d7352e2989 Mon Sep 17 00:00:00 2001 From: Andy Parkins Date: Tue, 2 Oct 2007 12:02:57 +0100 Subject: Add a test script for for-each-ref, including test of date formatting Signed-off-by: Andy Parkins Signed-off-by: Junio C Hamano --- t/t6300-for-each-ref.sh | 151 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 t/t6300-for-each-ref.sh (limited to 't') diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh new file mode 100644 index 0000000000..d0809eb651 --- /dev/null +++ b/t/t6300-for-each-ref.sh @@ -0,0 +1,151 @@ +#!/bin/sh +# +# Copyright (c) 2007 Andy Parkins +# + +test_description='for-each-ref test' + +. ./test-lib.sh + +# Mon Jul 3 15:18:43 2006 +0000 +datestamp=1151939923 +setdate_and_increment () { + GIT_COMMITTER_DATE="$datestamp +0200" + datestamp=$(expr "$datestamp" + 1) + GIT_AUTHOR_DATE="$datestamp +0200" + datestamp=$(expr "$datestamp" + 1) + export GIT_COMMITTER_DATE GIT_AUTHOR_DATE +} + +test_expect_success 'Create sample commit with known timestamp' ' + setdate_and_increment && + echo "Using $datestamp" > one && + git add one && + git commit -m "Initial" && + setdate_and_increment && + git tag -a -m "Tagging at $datestamp" testtag +' + +test_expect_success 'Check atom names are valid' ' + bad= + for token in \ + refname objecttype objectsize objectname tree parent \ + numparent object type author authorname authoremail \ + authordate committer committername committeremail \ + committerdate tag tagger taggername taggeremail \ + taggerdate creator creatordate subject body contents + do + git for-each-ref --format="$token=%($token)" refs/heads || { + bad=$token + break + } + done + test -z "$bad" +' + +test_expect_failure 'Check invalid atoms names are errors' ' + git-for-each-ref --format="%(INVALID)" refs/heads +' + +test_expect_success 'Check format specifiers are ignored in naming date atoms' ' + git-for-each-ref --format="%(authordate)" refs/heads && + git-for-each-ref --format="%(authordate:default) %(authordate)" refs/heads && + git-for-each-ref --format="%(authordate) %(authordate:default)" refs/heads && + git-for-each-ref --format="%(authordate:default) %(authordate:default)" refs/heads +' + +test_expect_success 'Check valid format specifiers for date fields' ' + git-for-each-ref --format="%(authordate:default)" refs/heads && + git-for-each-ref --format="%(authordate:relative)" refs/heads && + git-for-each-ref --format="%(authordate:short)" refs/heads && + git-for-each-ref --format="%(authordate:local)" refs/heads && + git-for-each-ref --format="%(authordate:iso8601)" refs/heads && + git-for-each-ref --format="%(authordate:rfc2822)" refs/heads +' + +test_expect_failure 'Check invalid format specifiers are errors' ' + git-for-each-ref --format="%(authordate:INVALID)" refs/heads +' + +cat >expected <<\EOF +'refs/heads/master' 'Mon Jul 3 17:18:43 2006 +0200' 'Mon Jul 3 17:18:44 2006 +0200' +'refs/tags/testtag' 'Mon Jul 3 17:18:45 2006 +0200' +EOF + +test_expect_success 'Check unformatted date fields output' ' + (git for-each-ref --shell --format="%(refname) %(committerdate) %(authordate)" refs/heads && + git for-each-ref --shell --format="%(refname) %(taggerdate)" refs/tags) >actual && + git diff expected actual +' + +test_expect_success 'Check format "default" formatted date fields output' ' + f=default && + (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && + git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual && + git diff expected actual +' + +# Don't know how to do relative check because I can't know when this script +# is going to be run and can't fake the current time to git, and hence can't +# provide expected output. Instead, I'll just make sure that "relative" +# doesn't exit in error +# +#cat >expected <<\EOF +# +#EOF +# +test_expect_success 'Check format "relative" date fields output' ' + f=relative && + (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && + git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual +' + +cat >expected <<\EOF +'refs/heads/master' '2006-07-03' '2006-07-03' +'refs/tags/testtag' '2006-07-03' +EOF + +test_expect_success 'Check format "short" date fields output' ' + f=short && + (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && + git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual && + git diff expected actual +' + +cat >expected <<\EOF +'refs/heads/master' 'Mon Jul 3 15:18:43 2006' 'Mon Jul 3 15:18:44 2006' +'refs/tags/testtag' 'Mon Jul 3 15:18:45 2006' +EOF + +test_expect_success 'Check format "local" date fields output' ' + f=local && + (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && + git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual && + git diff expected actual +' + +cat >expected <<\EOF +'refs/heads/master' '2006-07-03 17:18:43 +0200' '2006-07-03 17:18:44 +0200' +'refs/tags/testtag' '2006-07-03 17:18:45 +0200' +EOF + +test_expect_success 'Check format "iso8601" date fields output' ' + f=iso8601 && + (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && + git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual && + git diff expected actual +' + +cat >expected <<\EOF +'refs/heads/master' 'Mon, 3 Jul 2006 17:18:43 +0200' 'Mon, 3 Jul 2006 17:18:44 +0200' +'refs/tags/testtag' 'Mon, 3 Jul 2006 17:18:45 +0200' +EOF + +test_expect_success 'Check format "rfc2822" date fields output' ' + f=rfc2822 && + (git for-each-ref --shell --format="%(refname) %(committerdate:$f) %(authordate:$f)" refs/heads && + git for-each-ref --shell --format="%(refname) %(taggerdate:$f)" refs/tags) >actual && + git diff expected actual +' + +test_done -- cgit v1.2.3 From 304b5af64f9b5a6b5e9455e2dcab381c568452b6 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Tue, 9 Oct 2007 09:35:22 -0700 Subject: Clean up "git log" format with DIFF_FORMAT_NO_OUTPUT This fixes an unnecessary empty line that we add to the log message when we generate diffs, but don't actually end up printing any due to having DIFF_FORMAT_NO_OUTPUT set. This can happen with pickaxe or with rename following. The reason is that we normally add an empty line between the commit and the diff, but we do that even for the case where we've then suppressed the actual printing of the diff. This also updates a couple of tests that assumed the extraneous empty line would exist at the end of output. Signed-off-by: Linus Torvalds Signed-off-by: Lars Hjemli Signed-off-by: Shawn O. Pearce --- t/t3900-i18n-commit.sh | 2 +- t/t4013/diff.log_-SF_master | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 't') diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh index fcbabe8ec3..94b1c24b0a 100755 --- a/t/t3900-i18n-commit.sh +++ b/t/t3900-i18n-commit.sh @@ -8,7 +8,7 @@ test_description='commit and log output encodings' . ./test-lib.sh compare_with () { - git show -s $1 | sed -e '1,/^$/d' -e 's/^ //' -e '$d' >current && + git show -s $1 | sed -e '1,/^$/d' -e 's/^ //' >current && git diff current "$2" } diff --git a/t/t4013/diff.log_-SF_master b/t/t4013/diff.log_-SF_master index 6162ed2018..c1599f2f52 100644 --- a/t/t4013/diff.log_-SF_master +++ b/t/t4013/diff.log_-SF_master @@ -4,5 +4,4 @@ Author: A U Thor Date: Mon Jun 26 00:02:00 2006 +0000 Third - $ -- cgit v1.2.3 From 2f27f8509edfe55f267ce9207dc42c12d4809a84 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Thu, 4 Oct 2007 15:32:53 +0200 Subject: fix t5403-post-checkout-hook.sh: built-in test in dash does not have "==" Signed-off-by: Alex Riesen Signed-off-by: Lars Hjemli Signed-off-by: Shawn O. Pearce --- t/t5403-post-checkout-hook.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 't') diff --git a/t/t5403-post-checkout-hook.sh b/t/t5403-post-checkout-hook.sh index 487abf3fc6..823239a251 100755 --- a/t/t5403-post-checkout-hook.sh +++ b/t/t5403-post-checkout-hook.sh @@ -39,7 +39,7 @@ test_expect_success 'post-checkout receives the right arguments with HEAD unchan old=$(awk "{print \$1}" clone1/.git/post-checkout.args) && new=$(awk "{print \$2}" clone1/.git/post-checkout.args) && flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) && - test $old = $new -a $flag == 1 + test $old = $new -a $flag = 1 ' test_expect_success 'post-checkout runs as expected ' ' @@ -52,7 +52,7 @@ test_expect_success 'post-checkout args are correct with git checkout -b ' ' old=$(awk "{print \$1}" clone1/.git/post-checkout.args) && new=$(awk "{print \$2}" clone1/.git/post-checkout.args) && flag=$(awk "{print \$3}" clone1/.git/post-checkout.args) && - test $old = $new -a $flag == 1 + test $old = $new -a $flag = 1 ' test_expect_success 'post-checkout receives the right args with HEAD changed ' ' @@ -60,7 +60,7 @@ test_expect_success 'post-checkout receives the right args with HEAD changed ' ' old=$(awk "{print \$1}" clone2/.git/post-checkout.args) && new=$(awk "{print \$2}" clone2/.git/post-checkout.args) && flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) && - test $old != $new -a $flag == 1 + test $old != $new -a $flag = 1 ' test_expect_success 'post-checkout receives the right args when not switching branches ' ' @@ -68,7 +68,7 @@ test_expect_success 'post-checkout receives the right args when not switching br old=$(awk "{print \$1}" clone2/.git/post-checkout.args) && new=$(awk "{print \$2}" clone2/.git/post-checkout.args) && flag=$(awk "{print \$3}" clone2/.git/post-checkout.args) && - test $old == $new -a $flag == 0 + test $old = $new -a $flag = 0 ' test_done -- cgit v1.2.3 From f539d0d6c1f0b4431c0711e290d1f5a7205ed6e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A4in=C3=B6=20J=C3=A4rvel=C3=A4?= Date: Tue, 9 Oct 2007 11:51:07 +0300 Subject: Added a test for fetching remote tags when there is not tags. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a user runs "git fetch -t", git crashes when it doesn't find any tags on the remote repository. Signed-off-by: Väinö Järvelä Signed-off-by: Lars Hjemli Signed-off-by: Shawn O. Pearce --- t/t5510-fetch.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 't') diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 73a4e3cbc3..40ebf2e2bf 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -67,6 +67,18 @@ test_expect_success "fetch test for-merge" ' cut -f -2 .git/FETCH_HEAD >actual && diff expected actual' +test_expect_success 'fetch tags when there is no tags' ' + + cd "$D" && + + mkdir notags && + cd notags && + git init && + + git fetch -t .. + +' + test_expect_success 'fetch following tags' ' cd "$D" && -- cgit v1.2.3 From 11f2441f05ace25f1dae833a804761f1ca7d5cbb Mon Sep 17 00:00:00 2001 From: Brian Ewins Date: Thu, 11 Oct 2007 20:32:27 +0100 Subject: Add a --dry-run option to git-push. The default behaviour of git-push is potentially confusing for new users, since it will push changes that are not on the current branch. Publishing patches that were still cooking on a development branch is hard to undo. It would also be nice to be able to verify the expansion of refspecs if you've edited them, so that you know what branches matched on the server. Adding a --dry-run flag allows the user to experiment safely and learn how to use git-push properly. Originally suggested by Steffen Prohaska. Signed-off-by: Brian Ewins Signed-off-by: Lars Hjemli Signed-off-by: Shawn O. Pearce --- t/t5516-fetch-push.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 't') diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index ca46aafe72..4fbd5b1f47 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -244,4 +244,14 @@ test_expect_success 'push with colon-less refspec (4)' ' ' +test_expect_success 'push with dry-run' ' + + mk_test heads/master && + cd testrepo && + old_commit=$(git show-ref -s --verify refs/heads/master) && + cd .. && + git push --dry-run testrepo && + check_push_result $old_commit heads/master +' + test_done -- cgit v1.2.3 From da0204df587ae76cd291bc7e495fc60d873c2f20 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 11 Oct 2007 01:47:55 +0100 Subject: fetch: if not fetching from default remote, ignore default merge When doing "git fetch " on a remote that does not have the branch referenced in branch..merge, git fetch failed. It failed because it tried to add the "merge" ref to the refs to be fetched. Fix that. And add a test case. Incidentally, this unconvered a bug in our own test suite, where "git pull " was expected to merge the ref given in the defaults, even if not pulling from the default remote. Signed-off-by: Johannes Schindelin Signed-off-by: Lars Hjemli Signed-off-by: Shawn O. Pearce --- t/t5510-fetch.sh | 8 ++++++++ t/t5700-clone-reference.sh | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 40ebf2e2bf..d217657146 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -200,4 +200,12 @@ test_expect_success 'push via rsync' ' ' } +test_expect_success 'fetch with a non-applying branch..merge' ' + git config branch.master.remote yeti && + git config branch.master.merge refs/heads/bigfoot && + git config remote.blub.url one && + git config remote.blub.fetch "refs/heads/*:refs/remotes/one/*" && + git fetch blub +' + test_done diff --git a/t/t5700-clone-reference.sh b/t/t5700-clone-reference.sh index 4e93aaab02..b6a54867b4 100755 --- a/t/t5700-clone-reference.sh +++ b/t/t5700-clone-reference.sh @@ -38,7 +38,7 @@ cd "$base_dir" test_expect_success 'pulling from reference' \ 'cd C && -git pull ../B' +git pull ../B master' cd "$base_dir" @@ -61,7 +61,7 @@ test_expect_success 'existence of info/alternates' \ cd "$base_dir" test_expect_success 'pulling from reference' \ -'cd D && git pull ../B' +'cd D && git pull ../B master' cd "$base_dir" -- cgit v1.2.3 From dd5c8af176bb935a0b01a7dc2d5e022565c3aac3 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 17 Oct 2007 00:37:36 +0100 Subject: Fix setup_git_directory_gently() with relative GIT_DIR & GIT_WORK_TREE There are a few programs, such as config and diff, which allow running without a git repository. Therefore, they have to call setup_git_directory_gently(). However, when GIT_DIR and GIT_WORK_TREE were set, and the current directory was a subdirectory of the work tree, setup_git_directory_gently() would return a bogus NULL prefix. This patch fixes that. Noticed by REPLeffect on IRC. Signed-off-by: Johannes Schindelin Signed-off-by: Shawn O. Pearce --- t/t1501-worktree.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 't') diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh index 732216184f..7ee3820ce9 100755 --- a/t/t1501-worktree.sh +++ b/t/t1501-worktree.sh @@ -103,4 +103,13 @@ test_expect_success 'repo finds its work tree from work tree, too' ' test sub/dir/tracked = "$(git ls-files)") ' +test_expect_success '_gently() groks relative GIT_DIR & GIT_WORK_TREE' ' + cd repo.git/work/sub/dir && + GIT_DIR=../../.. GIT_WORK_TREE=../.. GIT_PAGER= \ + git diff --exit-code tracked && + echo changed > tracked && + ! GIT_DIR=../../.. GIT_WORK_TREE=../.. GIT_PAGER= \ + git diff --exit-code tracked +' + test_done -- cgit v1.2.3 From 46eb449cbefac461659c42c4ba4b36de1959e7ca Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 17 Oct 2007 03:23:10 +0100 Subject: filter-branch: update current branch when rewritten Earlier, "git filter-branch -- HEAD" would not update the working tree after rewriting the branch. This commit fixes it. Signed-off-by: Johannes Schindelin Signed-off-by: Shawn O. Pearce --- t/t7003-filter-branch.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index e935b2000a..2089351f7d 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -41,7 +41,9 @@ test_expect_success 'rewrite, renaming a specific file' ' ' test_expect_success 'test that the file was renamed' ' - test d = $(git show HEAD:doh) + test d = $(git show HEAD:doh) && + test -f doh && + test d = $(cat doh) ' git tag oldD HEAD~4 -- cgit v1.2.3 From ca5e9495607c2abb4b665b75d3d96a457fa4c5dd Mon Sep 17 00:00:00 2001 From: Luke Lu Date: Tue, 16 Oct 2007 20:45:25 -0700 Subject: gitweb: speed up project listing on large work trees by limiting find depth Signed-off-by: Luke Lu Signed-off-by: Shawn O. Pearce --- t/t9500-gitweb-standalone-no-errors.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't') diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh index 642b836d64..f7bad5bb2f 100755 --- a/t/t9500-gitweb-standalone-no-errors.sh +++ b/t/t9500-gitweb-standalone-no-errors.sh @@ -18,6 +18,7 @@ gitweb_init () { our \$version = "current"; our \$GIT = "git"; our \$projectroot = "$(pwd)"; +our \$project_maxdepth = 8; our \$home_link_str = "projects"; our \$site_name = "[localhost]"; our \$site_header = ""; -- cgit v1.2.3 From d05ddec51e4e23923f8f6c633f0a125c9a27a391 Mon Sep 17 00:00:00 2001 From: Benoit Sigoure Date: Tue, 16 Oct 2007 16:36:49 +0200 Subject: git-svn: implement git svn create-ignore git svn create-ignore (to create one .gitignore per directory from the svn:ignore properties. This has the disadvantage of committing the .gitignore during the next dcommit, but when you import a repo with tons of ignores (>1000), using git svn show-ignore to build .git/info/exclude is *not* a good idea, because things like git-status will end up doing >1000 fnmatch *per file* in the repo, which leads to git-status taking more than 4s on my Core2Duo 2Ghz 2G RAM) * git-svn.perl (%cmd): Add the new command `create-ignore'. (&cmd_create_ignore): New. * t/t9101-git-svn-props.sh: Adjust the test-case for show-ignore and add a test case for create-ignore. [ew: added commit message from <05CAB148-56ED-4FF1-8AAB-4BA2A0B70C2C@lrde.epita.fr> ] Signed-off-by: Benoit Sigoure Acked-by: Eric Wong Signed-off-by: Shawn O. Pearce --- t/t9101-git-svn-props.sh | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 't') diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh index 5aac644223..796d80e90e 100755 --- a/t/t9101-git-svn-props.sh +++ b/t/t9101-git-svn-props.sh @@ -126,19 +126,20 @@ cat > show-ignore.expect <<\EOF # / /no-such-file* -# deeply +# /deeply/ /deeply/no-such-file* -# deeply/nested +# /deeply/nested/ /deeply/nested/no-such-file* -# deeply/nested/directory +# /deeply/nested/directory/ /deeply/nested/directory/no-such-file* EOF test_expect_success 'test show-ignore' " cd test_wc && mkdir -p deeply/nested/directory && + touch deeply/nested/directory/.keep && svn add deeply && svn up && svn propset -R svn:ignore 'no-such-file*' . @@ -148,4 +149,25 @@ test_expect_success 'test show-ignore' " cmp show-ignore.expect show-ignore.got " +cat >create-ignore.expect <<\EOF +/no-such-file* +EOF + +cat >create-ignore-index.expect <<\EOF +100644 8c52e5dfcd0a8b6b6bcfe6b41b89bcbf493718a5 0 .gitignore +100644 8c52e5dfcd0a8b6b6bcfe6b41b89bcbf493718a5 0 deeply/.gitignore +100644 8c52e5dfcd0a8b6b6bcfe6b41b89bcbf493718a5 0 deeply/nested/.gitignore +100644 8c52e5dfcd0a8b6b6bcfe6b41b89bcbf493718a5 0 deeply/nested/directory/.gitignore +EOF + +test_expect_success 'test create-ignore' " + git-svn fetch && git pull . remotes/git-svn && + git-svn create-ignore && + cmp ./.gitignore create-ignore.expect && + cmp ./deeply/.gitignore create-ignore.expect && + cmp ./deeply/nested/.gitignore create-ignore.expect && + cmp ./deeply/nested/directory/.gitignore create-ignore.expect && + git ls-files -s | grep gitignore | cmp - create-ignore-index.expect + " + test_done -- cgit v1.2.3 From 151534515682695348a8172f399f4bf025154a5f Mon Sep 17 00:00:00 2001 From: Benoit Sigoure Date: Tue, 16 Oct 2007 16:36:50 +0200 Subject: git-svn: add git svn propget This allows one to easily retrieve a single SVN property from within git-svn without requiring svn or remembering the URL of a repository * git-svn.perl (%cmd): Add the new command `propget'. ($cmd_dir_prefix): New global. (&get_svnprops): New helper. (&cmd_propget): New. Use &get_svnprops. * t/t9101-git-svn-props.sh: Add a test case for propget. [ew: make sure the rev-parse --show-prefix call doesn't break the `git-svn clone' command] Signed-off-by: Benoit Sigoure Acked-by: Eric Wong Signed-off-by: Shawn O. Pearce --- t/t9101-git-svn-props.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 't') diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh index 796d80e90e..61c879959c 100755 --- a/t/t9101-git-svn-props.sh +++ b/t/t9101-git-svn-props.sh @@ -170,4 +170,27 @@ test_expect_success 'test create-ignore' " git ls-files -s | grep gitignore | cmp - create-ignore-index.expect " +cat >prop.expect <<\EOF +no-such-file* + +EOF +cat >prop2.expect <<\EOF +8 +EOF + +# This test can be improved: since all the svn:ignore contain the same +# pattern, it can pass even though the propget did not execute on the +# right directory. +test_expect_success 'test propget' " + git-svn propget svn:ignore . | cmp - prop.expect && + cd deeply && + git-svn propget svn:ignore . | cmp - ../prop.expect && + git-svn propget svn:entry:committed-rev nested/directory/.keep \ + | cmp - ../prop2.expect && + git-svn propget svn:ignore .. | cmp - ../prop.expect && + git-svn propget svn:ignore nested/ | cmp - ../prop.expect && + git-svn propget svn:ignore ./nested | cmp - ../prop.expect && + git-svn propget svn:ignore .././deeply/nested | cmp - ../prop.expect + " + test_done -- cgit v1.2.3 From 51e057cf808eb1c277da08f42d0ccd611ea315cc Mon Sep 17 00:00:00 2001 From: Benoit Sigoure Date: Tue, 16 Oct 2007 16:36:51 +0200 Subject: git-svn: add git svn proplist This allows one to easily retrieve a list of svn properties from within git-svn without requiring svn or knowing the URL of a repository. * git-svn.perl (%cmd): Add the command `proplist'. (&cmd_proplist): New. * t/t9101-git-svn-props.sh: Test git svn proplist. Signed-off-by: Benoit Sigoure Acked-by: Eric Wong Signed-off-by: Shawn O. Pearce --- t/t9101-git-svn-props.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 't') diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh index 61c879959c..3c83127a0e 100755 --- a/t/t9101-git-svn-props.sh +++ b/t/t9101-git-svn-props.sh @@ -193,4 +193,25 @@ test_expect_success 'test propget' " git-svn propget svn:ignore .././deeply/nested | cmp - ../prop.expect " +cat >prop.expect <<\EOF +Properties on '.': + svn:entry:committed-date + svn:entry:committed-rev + svn:entry:last-author + svn:entry:uuid + svn:ignore +EOF +cat >prop2.expect <<\EOF +Properties on 'nested/directory/.keep': + svn:entry:committed-date + svn:entry:committed-rev + svn:entry:last-author + svn:entry:uuid +EOF + +test_expect_success 'test proplist' " + git-svn proplist . | cmp - prop.expect && + git-svn proplist nested/directory/.keep | cmp - prop2.expect + " + test_done -- cgit v1.2.3 From 552cecc21447efe9d5f9a86d55b5e428d56a0c53 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 17 Oct 2007 02:50:45 +0100 Subject: Teach "git reflog" a subcommand to delete single entries This commit implements the "delete" subcommand: git reflog delete master@{2} will delete the second reflog entry of the "master" branch. With this, it should be easy to implement "git stash pop" everybody seems to want these days. Signed-off-by: Johannes Schindelin Signed-off-by: Shawn O. Pearce --- t/t1410-reflog.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 't') diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh index e5bbc384f7..12a53edfdc 100755 --- a/t/t1410-reflog.sh +++ b/t/t1410-reflog.sh @@ -175,4 +175,30 @@ test_expect_success 'recover and check' ' ' +test_expect_success 'delete' ' + echo 1 > C && + test_tick && + git commit -m rat C && + + echo 2 > C && + test_tick && + git commit -m ox C && + + echo 3 > C && + test_tick && + git commit -m tiger C && + + test 5 = $(git reflog | wc -l) && + + git reflog delete master@{1} && + git reflog show master > output && + test 4 = $(wc -l < output) && + ! grep ox < output && + + git reflog delete master@{07.04.2005.15:15:00.-0700} && + git reflog show master > output && + test 3 = $(wc -l < output) && + ! grep dragon < output +' + test_done -- cgit v1.2.3 From cd8ae20195ae09c06d0854f1ebf92d1f1164c927 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Thu, 18 Oct 2007 02:31:30 -0400 Subject: git-blame shouldn't crash if run in an unmerged tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If we are in the middle of resolving a merge conflict there may be one or more files whose entries in the index represent an unmerged state (index entries in the higher-order stages). Attempting to run git-blame on any file in such a working directory resulted in "fatal: internal error: ce_mode is 0" as we use the magic marker for an unmerged entry is 0 (set up by things like diff-lib.c's do_diff_cache() and builtin-read-tree.c's read_tree_unmerged()) and the ce_match_stat_basic() function gets upset about this. I'm not entirely sure that the whole "ce_mode = 0" case is a good idea to begin with, and maybe the right thing to do is to remove that horrid freakish special case, but removing the internal error seems to be the simplest fix for now. Linus [sp: Thanks to Björn Steinbrink for the test case] Signed-off-by: Shawn O. Pearce --- t/t8004-blame.sh | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100755 t/t8004-blame.sh (limited to 't') diff --git a/t/t8004-blame.sh b/t/t8004-blame.sh new file mode 100755 index 0000000000..ba19ac127e --- /dev/null +++ b/t/t8004-blame.sh @@ -0,0 +1,73 @@ +#!/bin/sh + +# Based on a test case submitted by Björn Steinbrink. + +test_description='git blame on conflicted files' +. ./test-lib.sh + +test_expect_success 'setup first case' ' + # Create the old file + echo "Old line" > file1 && + git add file1 && + git commit --author "Old Line " -m file1.a && + + # Branch + git checkout -b foo && + + # Do an ugly move and change + git rm file1 && + echo "New line ..." > file2 && + echo "... and more" >> file2 && + git add file2 && + git commit --author "U Gly " -m ugly && + + # Back to master and change something + git checkout master && + echo " + +bla" >> file1 && + git commit --author "Old Line " -a -m file1.b && + + # Back to foo and merge master + git checkout foo && + if git merge master; then + echo needed conflict here + exit 1 + else + echo merge failed - resolving automatically + fi && + echo "New line ... +... and more + +bla +Even more" > file2 && + git rm file1 && + git commit --author "M Result " -a -m merged && + + # Back to master and change file1 again + git checkout master && + sed s/bla/foo/ X && + rm file1 && + mv X file1 && + git commit --author "No Bla " -a -m replace && + + # Try to merge into foo again + git checkout foo && + if git merge master; then + echo needed conflict here + exit 1 + else + echo merge failed - test is setup + fi +' + +test_expect_success \ + 'blame runs on unconflicted file while other file has conflicts' ' + git blame file2 +' + +test_expect_success 'blame runs on conflicted file in stages 1,3' ' + git blame file1 +' + +test_done -- cgit v1.2.3 From 09fba7a59d38d1cafaf33eadaf1d409c4113b30c Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 18 Oct 2007 02:17:46 -0400 Subject: t5516: test update of local refs on push The first test (updating local refs) should succeed without the prior commit, but the second one (not updating on error) used to fail before the prior commit was written. Signed-off-by: Jeff King Signed-off-by: Shawn O. Pearce --- t/t5516-fetch-push.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 't') diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index 4fbd5b1f47..86f9b5346a 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -254,4 +254,32 @@ test_expect_success 'push with dry-run' ' check_push_result $old_commit heads/master ' +test_expect_success 'push updates local refs' ' + + rm -rf parent child && + mkdir parent && cd parent && git init && + echo one >foo && git add foo && git commit -m one && + cd .. && + git clone parent child && cd child && + echo two >foo && git commit -a -m two && + git push && + test $(git rev-parse master) = $(git rev-parse remotes/origin/master) + +' + +test_expect_success 'push does not update local refs on failure' ' + + rm -rf parent child && + mkdir parent && cd parent && git init && + echo one >foo && git add foo && git commit -m one && + echo exit 1 >.git/hooks/pre-receive && + chmod +x .git/hooks/pre-receive && + cd .. && + git clone parent child && cd child && + echo two >foo && git commit -a -m two || exit 1 + git push && exit 1 + test $(git rev-parse master) != $(git rev-parse remotes/origin/master) + +' + test_done -- cgit v1.2.3 From d7b0a09316fe8dcb62ad247dbbb45c3c777667ad Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Thu, 18 Oct 2007 22:02:35 +0200 Subject: attr: fix segfault in gitattributes parsing code git may segfault if gitattributes contains an invalid entry. A test is added to t0020 that triggers the segfault. The parsing code is fixed to avoid the crash. Signed-off-by: Steffen Prohaska Signed-off-by: Shawn O. Pearce --- t/t0020-crlf.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 't') diff --git a/t/t0020-crlf.sh b/t/t0020-crlf.sh index 0807d9f01a..62bc4bb077 100755 --- a/t/t0020-crlf.sh +++ b/t/t0020-crlf.sh @@ -371,4 +371,11 @@ test_expect_success 'in-tree .gitattributes (4)' ' } ' +test_expect_success 'invalid .gitattributes (must not crash)' ' + + echo "three +crlf" >>.gitattributes && + git diff + +' + test_done -- cgit v1.2.3 From 5eb73581679abb41dcdf9ad7fa63fa156e078790 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 19 Oct 2007 05:04:00 -0400 Subject: send-pack: respect '+' on wildcard refspecs When matching source and destination refs, we were failing to pull the 'force' parameter from wildcard refspecs (but not explicit ones) and attach it to the ref struct. This adds a test for explicit and wildcard refspecs; the latter fails without this patch. Signed-off-by: Jeff King Signed-off-by: Shawn O. Pearce --- t/t5400-send-pack.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 't') diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh index 57c6397be1..2d0c07fd6a 100755 --- a/t/t5400-send-pack.sh +++ b/t/t5400-send-pack.sh @@ -123,4 +123,52 @@ test_expect_success \ git-branch -a >branches && ! grep -q origin/master branches ' +rewound_push_setup() { + rm -rf parent child && + mkdir parent && cd parent && + git-init && echo one >file && git-add file && git-commit -m one && + echo two >file && git-commit -a -m two && + cd .. && + git-clone parent child && cd child && git-reset --hard HEAD^ +} + +rewound_push_succeeded() { + cmp ../parent/.git/refs/heads/master .git/refs/heads/master +} + +rewound_push_failed() { + if rewound_push_succeeded + then + false + else + true + fi +} + +test_expect_success \ + 'pushing explicit refspecs respects forcing' ' + rewound_push_setup && + if git-send-pack ../parent/.git refs/heads/master:refs/heads/master + then + false + else + true + fi && rewound_push_failed && + git-send-pack ../parent/.git +refs/heads/master:refs/heads/master && + rewound_push_succeeded +' + +test_expect_success \ + 'pushing wildcard refspecs respects forcing' ' + rewound_push_setup && + if git-send-pack ../parent/.git refs/heads/*:refs/heads/* + then + false + else + true + fi && rewound_push_failed && + git-send-pack ../parent/.git +refs/heads/*:refs/heads/* && + rewound_push_succeeded +' + test_done -- cgit v1.2.3 From a0ae35ae2d92cc706f902227cb0f34e2a2f0fd50 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Fri, 19 Oct 2007 21:48:04 +0200 Subject: t0021-conversion.sh: Test that the clean filter really cleans content. This test uses a rot13 filter, which is its own inverse. It tested only that the content was the same as the original after both the 'clean' and the 'smudge' filter were applied. This way it would not detect whether any filter was run at all. Hence, here we add another test that checks that the repository contained content that was processed by the 'clean' filter. Signed-off-by: Johannes Sixt Signed-off-by: Shawn O. Pearce --- t/t0021-conversion.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t0021-conversion.sh b/t/t0021-conversion.sh index a839f4e074..cb860296ed 100755 --- a/t/t0021-conversion.sh +++ b/t/t0021-conversion.sh @@ -42,7 +42,12 @@ test_expect_success check ' git diff --raw --exit-code :test :test.i && id=$(git rev-parse --verify :test) && embedded=$(sed -ne "$script" test.i) && - test "z$id" = "z$embedded" + test "z$id" = "z$embedded" && + + git cat-file blob :test.t > test.r && + + ./rot13.sh < test.o > test.t && + cmp test.r test.t ' # If an expanded ident ever gets into the repository, we want to make sure that -- cgit v1.2.3 From 55db1df0c86b0fded61731647a8f1cd6e7dc9b04 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Wed, 24 Oct 2007 22:03:38 +0200 Subject: Add some fancy colors in the test library when terminal supports it. Signed-off-by: Pierre Habouzit Signed-off-by: Junio C Hamano --- t/test-lib.sh | 62 +++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 17 deletions(-) (limited to 't') diff --git a/t/test-lib.sh b/t/test-lib.sh index cc1253ccab..66efcdaacd 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -59,15 +59,11 @@ esac # ' # . ./test-lib.sh -error () { - echo "* error: $*" - trap - exit - exit 1 -} - -say () { - echo "* $*" -} +[ "x$TERM" != "xdumb" ] && + tput bold >/dev/null 2>&1 && + tput setaf 1 >/dev/null 2>&1 && + tput sgr0 >/dev/null 2>&1 && + color=t test "${test_description}" != "" || error "Test script did not set test_description." @@ -84,6 +80,8 @@ do exit 0 ;; -v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose) verbose=t; shift ;; + --no-color) + color=; shift ;; --no-python) # noop now... shift ;; @@ -92,6 +90,36 @@ do esac done +if test -n "$color"; then + say_color () { + case "$1" in + error) tput bold; tput setaf 1;; # bold red + skip) tput bold; tput setaf 2;; # bold green + pass) tput setaf 2;; # green + info) tput setaf 3;; # brown + *);; + esac + shift + echo "* $*" + tput sgr0 + } +else + say_color() { + shift + echo "* $*" + } +fi + +error () { + say_color error "error: $*" + trap - exit + exit 1 +} + +say () { + say_color info "$*" +} + exec 5>&1 if test "$verbose" = "t" then @@ -122,13 +150,13 @@ test_tick () { test_ok_ () { test_count=$(expr "$test_count" + 1) - say " ok $test_count: $@" + say_color "" " ok $test_count: $@" } test_failure_ () { test_count=$(expr "$test_count" + 1) test_failure=$(expr "$test_failure" + 1); - say "FAIL $test_count: $1" + say_color error "FAIL $test_count: $1" shift echo "$@" | sed -e 's/^/ /' test "$immediate" = "" || { trap - exit; exit 1; } @@ -158,9 +186,9 @@ test_skip () { done case "$to_skip" in t) - say >&3 "skipping test: $@" + say_color skip >&3 "skipping test: $@" test_count=$(expr "$test_count" + 1) - say "skip $test_count: $1" + say_color skip "skip $test_count: $1" : true ;; *) @@ -247,11 +275,11 @@ test_done () { # The Makefile provided will clean this test area so # we will leave things as they are. - say "passed all $test_count test(s)" + say_color pass "passed all $test_count test(s)" exit 0 ;; *) - say "failed $test_failure among $test_count test(s)" + say_color error "failed $test_failure among $test_count test(s)" exit 1 ;; esac @@ -296,8 +324,8 @@ do done case "$to_skip" in t) - say >&3 "skipping test $this_test altogether" - say "skip all tests in $this_test" + say_color skip >&3 "skipping test $this_test altogether" + say_color skip "skip all tests in $this_test" test_done esac done -- cgit v1.2.3 From 1ece127467c1d65062f17777b1eedcd84fd9ea69 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Wed, 24 Oct 2007 22:03:39 +0200 Subject: Support a --quiet option in the test-suite. This shuts down the "* ok ##: `test description`" messages. Signed-off-by: Pierre Habouzit Signed-off-by: Junio C Hamano --- t/test-lib.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/test-lib.sh b/t/test-lib.sh index 66efcdaacd..714de6e575 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -80,6 +80,8 @@ do exit 0 ;; -v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose) verbose=t; shift ;; + -q|--q|--qu|--qui|--quie|--quiet) + quiet=t; shift ;; --no-color) color=; shift ;; --no-python) @@ -97,7 +99,7 @@ if test -n "$color"; then skip) tput bold; tput setaf 2;; # bold green pass) tput setaf 2;; # green info) tput setaf 3;; # brown - *);; + *) test -n "$quiet" && return;; esac shift echo "* $*" @@ -105,6 +107,7 @@ if test -n "$color"; then } else say_color() { + test -z "$1" && test -n "$quiet" && return shift echo "* $*" } -- cgit v1.2.3 From 15387e32ff5116b82d3fe53df55b8c87eec83e01 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Fri, 26 Oct 2007 06:13:50 +0200 Subject: Test suite: reset TERM to its previous value after testing. Using konsole, I get no colored output at the end of "t7005-editor.sh" without this patch. Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- t/t7005-editor.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 't') diff --git a/t/t7005-editor.sh b/t/t7005-editor.sh index 28643b0da4..01cc0c02b1 100755 --- a/t/t7005-editor.sh +++ b/t/t7005-editor.sh @@ -4,6 +4,8 @@ test_description='GIT_EDITOR, core.editor, and stuff' . ./test-lib.sh +OLD_TERM="$TERM" + for i in GIT_EDITOR core_editor EDITOR VISUAL vi do cat >e-$i.sh <<-EOF @@ -88,4 +90,6 @@ do ' done +TERM="$OLD_TERM" + test_done -- cgit v1.2.3 From 97e1c51e15d94f523c67a499ecb633b0e20324cb Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Mon, 22 Oct 2007 07:48:36 +0200 Subject: Bisect: implement "bisect skip" to mark untestable revisions. When there are some "skip"ped revisions, we add the '--bisect-all' option to "git rev-list --bisect-vars". Then we filter out the "skip"ped revisions from the result of the rev-list command, and we modify the "bisect_rev" var accordingly. We don't always use "--bisect-all" because it is slower than "--bisect-vars" or "--bisect". When we cannot find for sure the first bad commit because of "skip"ped commits, we print the hash of each possible first bad commit and then we exit with code 2. Signed-off-by: Christian Couder Signed-off-by: Shawn O. Pearce --- t/t6030-bisect-porcelain.sh | 71 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 't') diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 03cdba5808..db82259afe 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -71,6 +71,63 @@ test_expect_success 'bisect start with one bad and good' ' git bisect next ' +# $HASH1 is good, $HASH4 is bad, we skip $HASH3 +# but $HASH2 is bad, +# so we should find $HASH2 as the first bad commit +test_expect_success 'bisect skip: successfull result' ' + git bisect reset && + git bisect start $HASH4 $HASH1 && + git bisect skip && + git bisect bad > my_bisect_log.txt && + grep "$HASH2 is first bad commit" my_bisect_log.txt && + git bisect reset +' + +# $HASH1 is good, $HASH4 is bad, we skip $HASH3 and $HASH2 +# so we should not be able to tell the first bad commit +# among $HASH2, $HASH3 and $HASH4 +test_expect_success 'bisect skip: cannot tell between 3 commits' ' + git bisect start $HASH4 $HASH1 && + git bisect skip || return 1 + + if git bisect skip > my_bisect_log.txt + then + echo Oops, should have failed. + false + else + test $? -eq 2 && + grep "first bad commit could be any of" my_bisect_log.txt && + ! grep $HASH1 my_bisect_log.txt && + grep $HASH2 my_bisect_log.txt && + grep $HASH3 my_bisect_log.txt && + grep $HASH4 my_bisect_log.txt && + git bisect reset + fi +' + +# $HASH1 is good, $HASH4 is bad, we skip $HASH3 +# but $HASH2 is good, +# so we should not be able to tell the first bad commit +# among $HASH3 and $HASH4 +test_expect_success 'bisect skip: cannot tell between 2 commits' ' + git bisect start $HASH4 $HASH1 && + git bisect skip || return 1 + + if git bisect good > my_bisect_log.txt + then + echo Oops, should have failed. + false + else + test $? -eq 2 && + grep "first bad commit could be any of" my_bisect_log.txt && + ! grep $HASH1 my_bisect_log.txt && + ! grep $HASH2 my_bisect_log.txt && + grep $HASH3 my_bisect_log.txt && + grep $HASH4 my_bisect_log.txt && + git bisect reset + fi +' + # We want to automatically find the commit that # introduced "Another" into hello. test_expect_success \ @@ -99,6 +156,20 @@ test_expect_success \ grep "$HASH4 is first bad commit" my_bisect_log.txt && git bisect reset' +# $HASH1 is good, $HASH5 is bad, we skip $HASH3 +# but $HASH4 is good, +# so we should find $HASH5 as the first bad commit +HASH5= +test_expect_success 'bisect skip: add line and then a new test' ' + add_line_into_file "5: Another new line." hello && + HASH5=$(git rev-parse --verify HEAD) && + git bisect start $HASH5 $HASH1 && + git bisect skip && + git bisect good > my_bisect_log.txt && + grep "$HASH5 is first bad commit" my_bisect_log.txt && + git bisect reset +' + # # test_done -- cgit v1.2.3 From 37f9fd0dde454db08d342e5ce7625e012507bb9b Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Mon, 22 Oct 2007 07:49:39 +0200 Subject: Bisect: add a "bisect replay" test case. Signed-off-by: Christian Couder Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- t/t6030-bisect-porcelain.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 't') diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index db82259afe..16d0c4a90e 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -167,6 +167,13 @@ test_expect_success 'bisect skip: add line and then a new test' ' git bisect skip && git bisect good > my_bisect_log.txt && grep "$HASH5 is first bad commit" my_bisect_log.txt && + git bisect log > log_to_replay.txt + git bisect reset +' + +test_expect_success 'bisect skip and bisect replay' ' + git bisect replay log_to_replay.txt > my_bisect_log.txt && + grep "$HASH5 is first bad commit" my_bisect_log.txt && git bisect reset ' -- cgit v1.2.3 From 71b0251cdd2cc35a983e21d4e71285db56d2a519 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Fri, 26 Oct 2007 05:39:37 +0200 Subject: Bisect run: "skip" current commit if script exit code is 125. This is incompatible with previous versions because an exit code of 125 used to mark current commit as "bad". But hopefully this exit code is not much used by test scripts or other programs. (126 and 127 are used by POSIX compliant shells to mean "found but not executable" and "command not found", respectively.) Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- t/t6030-bisect-porcelain.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 't') diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 16d0c4a90e..53956c08e2 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -177,6 +177,46 @@ test_expect_success 'bisect skip and bisect replay' ' git bisect reset ' +HASH6= +test_expect_success 'bisect run & skip: cannot tell between 2' ' + add_line_into_file "6: Yet a line." hello && + HASH6=$(git rev-parse --verify HEAD) && + echo "#"\!"/bin/sh" > test_script.sh && + echo "tail -1 hello | grep Ciao > /dev/null && exit 125" >> test_script.sh && + echo "grep line hello > /dev/null" >> test_script.sh && + echo "test \$? -ne 0" >> test_script.sh && + chmod +x test_script.sh && + git bisect start $HASH6 $HASH1 && + if git bisect run ./test_script.sh > my_bisect_log.txt + then + echo Oops, should have failed. + false + else + test $? -eq 2 && + grep "first bad commit could be any of" my_bisect_log.txt && + ! grep $HASH3 my_bisect_log.txt && + ! grep $HASH6 my_bisect_log.txt && + grep $HASH4 my_bisect_log.txt && + grep $HASH5 my_bisect_log.txt + fi +' + +HASH7= +test_expect_success 'bisect run & skip: find first bad' ' + git bisect reset && + add_line_into_file "7: Should be the last line." hello && + HASH7=$(git rev-parse --verify HEAD) && + echo "#"\!"/bin/sh" > test_script.sh && + echo "tail -1 hello | grep Ciao > /dev/null && exit 125" >> test_script.sh && + echo "tail -1 hello | grep day > /dev/null && exit 125" >> test_script.sh && + echo "grep Yet hello > /dev/null" >> test_script.sh && + echo "test \$? -ne 0" >> test_script.sh && + chmod +x test_script.sh && + git bisect start $HASH7 $HASH1 && + git bisect run ./test_script.sh > my_bisect_log.txt && + grep "$HASH6 is first bad commit" my_bisect_log.txt +' + # # test_done -- cgit v1.2.3 From beb474379315654566e78eea8a0e39c66ebcbb8a Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 13 Oct 2007 17:34:45 +0100 Subject: Add tests for parse-options.c Signed-off-by: Johannes Schindelin Signed-off-by: Shawn O. Pearce --- t/t0040-parse-options.sh | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100755 t/t0040-parse-options.sh (limited to 't') diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh new file mode 100755 index 0000000000..8e4d74b200 --- /dev/null +++ b/t/t0040-parse-options.sh @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Copyright (c) 2007 Johannes Schindelin +# + +test_description='our own option parser' + +. ./test-lib.sh + +cat > expect.err << EOF +usage: test-parse-options + + -b, --boolean get a boolean + -i, --integer get a integer + -j get a integer, too + +string options + -s, --string + get a string + --string2 get another string + +EOF + +test_expect_success 'test help' ' + ! test-parse-options -h > output 2> output.err && + test ! -s output && + git diff expect.err output.err +' + +cat > expect << EOF +boolean: 2 +integer: 1729 +string: 123 +EOF + +test_expect_success 'short options' ' + test-parse-options -s123 -b -i 1729 -b > output 2> output.err && + git diff expect output && + test ! -s output.err +' +cat > expect << EOF +boolean: 2 +integer: 1729 +string: 321 +EOF + +test_expect_success 'long options' ' + test-parse-options --boolean --integer 1729 --boolean --string2=321 \ + > output 2> output.err && + test ! -s output.err && + git diff expect output +' + +cat > expect << EOF +boolean: 1 +integer: 13 +string: 123 +arg 00: a1 +arg 01: b1 +arg 02: --boolean +EOF + +test_expect_success 'intermingled arguments' ' + test-parse-options a1 --string 123 b1 --boolean -j 13 -- --boolean \ + > output 2> output.err && + test ! -s output.err && + git diff expect output +' + +test_done -- cgit v1.2.3 From 7f275b91520d31bfbe43ec5a9bbaf8ac6e663ce0 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sun, 14 Oct 2007 17:54:06 +0100 Subject: parse-options: Allow abbreviated options when unambiguous When there is an option "--amend", the option parser now recognizes "--am" for that option, provided that there is no other option beginning with "--am". Signed-off-by: Johannes Schindelin Signed-off-by: Shawn O. Pearce --- t/t0040-parse-options.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 't') diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh index 8e4d74b200..ae49424aa0 100755 --- a/t/t0040-parse-options.sh +++ b/t/t0040-parse-options.sh @@ -67,4 +67,27 @@ test_expect_success 'intermingled arguments' ' git diff expect output ' +cat > expect << EOF +boolean: 0 +integer: 2 +string: (not set) +EOF + +test_expect_success 'unambiguously abbreviated option' ' + test-parse-options --int 2 --boolean --no-bo > output 2> output.err && + test ! -s output.err && + git diff expect output +' + +test_expect_success 'unambiguously abbreviated option with "="' ' + test-parse-options --int=2 > output 2> output.err && + test ! -s output.err && + git diff expect output +' + +test_expect_failure 'ambiguously abbreviated option' ' + test-parse-options --strin 123; + test $? != 129 +' + test_done -- cgit v1.2.3 From c3428da87f625d22b7f0ea1e1fb7028264943da3 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Sat, 13 Oct 2007 20:40:46 +0200 Subject: Make builtin-for-each-ref.c use parse-opts. Signed-off-by: Pierre Habouzit Signed-off-by: Shawn O. Pearce --- t/t6300-for-each-ref.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 t/t6300-for-each-ref.sh (limited to 't') diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh old mode 100644 new mode 100755 -- cgit v1.2.3 From f31dfa604c83fd998f7b57942a7bac4defc8c435 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Thu, 1 Nov 2007 15:01:58 +0100 Subject: Do no colorify test output if stdout is not a terminal like when the output is redirected into a file in a cron job. Signed-off-by: Junio C Hamano --- t/test-lib.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't') diff --git a/t/test-lib.sh b/t/test-lib.sh index 714de6e575..603a8cd5e7 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -60,6 +60,7 @@ esac # . ./test-lib.sh [ "x$TERM" != "xdumb" ] && + [ -t 1 ] && tput bold >/dev/null 2>&1 && tput setaf 1 >/dev/null 2>&1 && tput sgr0 >/dev/null 2>&1 && -- cgit v1.2.3 From fa9aff463da42feea68228ca51685cd9f4403e92 Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Thu, 1 Nov 2007 14:23:16 +0100 Subject: gitweb: Remove CGI::Carp::set_programname() call from t9500 gitweb test It does appear to do nothing; gitweb is run as standalone program and not as CGI script in this test. This call caused problems later. Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- t/t9500-gitweb-standalone-no-errors.sh | 1 - 1 file changed, 1 deletion(-) (limited to 't') diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh index f7bad5bb2f..1bf0988d9a 100755 --- a/t/t9500-gitweb-standalone-no-errors.sh +++ b/t/t9500-gitweb-standalone-no-errors.sh @@ -31,7 +31,6 @@ our \$projects_list = ""; our \$export_ok = ""; our \$strict_export = ""; -CGI::Carp::set_programname("gitweb/gitweb.cgi"); EOF cat >.git/description < Date: Thu, 1 Nov 2007 23:57:45 +0100 Subject: Make mailsplit and mailinfo strip whitespace from the start of the input Signed-off-by: Simon Sasburg Signed-off-by: Junio C Hamano --- t/t5100/sample.mbox | 3 +++ 1 file changed, 3 insertions(+) (limited to 't') diff --git a/t/t5100/sample.mbox b/t/t5100/sample.mbox index b80c981c16..070c1661b9 100644 --- a/t/t5100/sample.mbox +++ b/t/t5100/sample.mbox @@ -1,3 +1,6 @@ + + + From nobody Mon Sep 17 00:00:00 2001 From: A U Thor Date: Fri, 9 Jun 2006 00:44:16 -0700 -- cgit v1.2.3 From 9e54dc6c12b14c12094c3a0f0b1e437148bbc0bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 2 Nov 2007 11:33:07 -0400 Subject: Remove unecessary hard-coding of EDITOR=':' VISUAL=':' in some test suites. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit They are already set and exoprted by sourcing ./test-lib.sh in all test scripts. Signed-off-by: Kristian Høgsberg Signed-off-by: Junio C Hamano --- t/t3501-revert-cherry-pick.sh | 4 ++-- t/t3901-i18n-patch.sh | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 't') diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh index 552af1c4d2..2dbe04fb20 100755 --- a/t/t3501-revert-cherry-pick.sh +++ b/t/t3501-revert-cherry-pick.sh @@ -44,7 +44,7 @@ test_expect_success setup ' test_expect_success 'cherry-pick after renaming branch' ' git checkout rename2 && - EDITOR=: VISUAL=: git cherry-pick added && + git cherry-pick added && test -f opos && grep "Add extra line at the end" opos @@ -53,7 +53,7 @@ test_expect_success 'cherry-pick after renaming branch' ' test_expect_success 'revert after renaming branch' ' git checkout rename1 && - EDITOR=: VISUAL=: git revert added && + git revert added && test -f spoo && ! grep "Add extra line at the end" spoo diff --git a/t/t3901-i18n-patch.sh b/t/t3901-i18n-patch.sh index 28e9e372f3..235f372832 100755 --- a/t/t3901-i18n-patch.sh +++ b/t/t3901-i18n-patch.sh @@ -154,7 +154,7 @@ test_expect_success 'cherry-pick(U/U)' ' git reset --hard master && git cherry-pick side^ && git cherry-pick side && - EDITOR=: VISUAL=: git revert HEAD && + git revert HEAD && check_encoding 3 ' @@ -169,7 +169,7 @@ test_expect_success 'cherry-pick(L/L)' ' git reset --hard master && git cherry-pick side^ && git cherry-pick side && - EDITOR=: VISUAL=: git revert HEAD && + git revert HEAD && check_encoding 3 8859 ' @@ -184,7 +184,7 @@ test_expect_success 'cherry-pick(U/L)' ' git reset --hard master && git cherry-pick side^ && git cherry-pick side && - EDITOR=: VISUAL=: git revert HEAD && + git revert HEAD && check_encoding 3 ' @@ -200,7 +200,7 @@ test_expect_success 'cherry-pick(L/U)' ' git reset --hard master && git cherry-pick side^ && git cherry-pick side && - EDITOR=: VISUAL=: git revert HEAD && + git revert HEAD && check_encoding 3 8859 ' -- cgit v1.2.3 From 6232b3438d127def8cc0612e45422347578c6102 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 2 Nov 2007 17:25:24 -0700 Subject: cherry-pick/revert -m: add tests This adds a new test to check cherry-pick/revert of a merge commit. Signed-off-by: Junio C Hamano --- t/t3502-cherry-pick-merge.sh | 123 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100755 t/t3502-cherry-pick-merge.sh (limited to 't') diff --git a/t/t3502-cherry-pick-merge.sh b/t/t3502-cherry-pick-merge.sh new file mode 100755 index 0000000000..3274c6141b --- /dev/null +++ b/t/t3502-cherry-pick-merge.sh @@ -0,0 +1,123 @@ +#!/bin/sh + +test_description='cherry picking and reverting a merge + + b---c + / / + initial---a + +' + +. ./test-lib.sh + +test_expect_success setup ' + + >A && + >B && + git add A B && + git commit -m "Initial" && + git tag initial && + git branch side && + echo new line >A && + git commit -m "add line to A" A && + git tag a && + git checkout side && + echo new line >B && + git commit -m "add line to B" B && + git tag b && + git checkout master && + git merge side && + git tag c + +' + +test_expect_success 'cherry-pick a non-merge with -m should fail' ' + + git reset --hard && + git checkout a^0 && + ! git cherry-pick -m 1 b && + git diff --exit-code a + +' + +test_expect_success 'cherry pick a merge without -m should fail' ' + + git reset --hard && + git checkout a^0 && + ! git cherry-pick c && + git diff --exit-code a + +' + +test_expect_success 'cherry pick a merge (1)' ' + + git reset --hard && + git checkout a^0 && + git cherry-pick -m 1 c && + git diff --exit-code c + +' + +test_expect_success 'cherry pick a merge (2)' ' + + git reset --hard && + git checkout b^0 && + git cherry-pick -m 2 c && + git diff --exit-code c + +' + +test_expect_success 'cherry pick a merge relative to nonexistent parent should fail' ' + + git reset --hard && + git checkout b^0 && + ! git cherry-pick -m 3 c + +' + +test_expect_success 'revert a non-merge with -m should fail' ' + + git reset --hard && + git checkout c^0 && + ! git revert -m 1 b && + git diff --exit-code c + +' + +test_expect_success 'revert a merge without -m should fail' ' + + git reset --hard && + git checkout c^0 && + ! git revert c && + git diff --exit-code c + +' + +test_expect_success 'revert a merge (1)' ' + + git reset --hard && + git checkout c^0 && + git revert -m 1 c && + git diff --exit-code a + +' + +test_expect_success 'revert a merge (2)' ' + + git reset --hard && + git checkout c^0 && + git revert -m 2 c && + git diff --exit-code b + +' + +test_expect_success 'revert a merge relative to nonexistent parent should fail' ' + + git reset --hard && + git checkout c^0 && + ! git revert -m 3 c && + git diff --exit-code c + +' + +test_done -- cgit v1.2.3 From aacb8f10a70c07dfe1461684f098313f0edb371f Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 2 Nov 2007 17:55:31 -0700 Subject: test format-patch -s: make sure MIME content type is shown as needed Signed-off-by: Junio C Hamano --- t/t4021-format-patch-signer-mime.sh | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 t/t4021-format-patch-signer-mime.sh (limited to 't') diff --git a/t/t4021-format-patch-signer-mime.sh b/t/t4021-format-patch-signer-mime.sh new file mode 100755 index 0000000000..67a70fadab --- /dev/null +++ b/t/t4021-format-patch-signer-mime.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +test_description='format-patch -s should force MIME encoding as needed' + +. ./test-lib.sh + +test_expect_success setup ' + + >F && + git add F && + git commit -m initial && + echo new line >F && + + test_tick && + git commit -m "This adds some lines to F" F + +' + +test_expect_success 'format normally' ' + + git format-patch --stdout -1 >output && + ! grep Content-Type output + +' + +test_expect_success 'format with signoff without funny signer name' ' + + git format-patch -s --stdout -1 >output && + ! grep Content-Type output + +' + +test_expect_success 'format with non ASCII signer name' ' + + GIT_COMMITTER_NAME="$B$O$^$N(B $B$U$K$*$&(B" \ + git format-patch -s --stdout -1 >output && + grep Content-Type output + +' + +test_done + -- cgit v1.2.3 From 49e703afda0e4e67050fcc8e05b175987c83391c Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 2 Nov 2007 17:46:55 -0700 Subject: core.whitespace: add test for diff whitespace error highlighting This tests seletive enabling/disabling of whitespace error highlighting done by colored diff output. Signed-off-by: Junio C Hamano --- t/t4019-diff-wserror.sh | 76 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100755 t/t4019-diff-wserror.sh (limited to 't') diff --git a/t/t4019-diff-wserror.sh b/t/t4019-diff-wserror.sh new file mode 100755 index 0000000000..dbc895b9b7 --- /dev/null +++ b/t/t4019-diff-wserror.sh @@ -0,0 +1,76 @@ +#!/bin/sh + +test_description='diff whitespace error detection' + +. ./test-lib.sh + +test_expect_success setup ' + + git config diff.color.whitespace "blue reverse" && + >F && + git add F && + echo " Eight SP indent" >>F && + echo " HT and SP indent" >>F && + echo "With trailing SP " >>F && + echo "No problem" >>F + +' + +blue_grep='7;34m' ;# ESC [ 7 ; 3 4 m + +test_expect_success default ' + + git diff --color >output + grep "$blue_grep" output >error + grep -v "$blue_grep" output >normal + + grep Eight normal >/dev/null && + grep HT error >/dev/null && + grep With error >/dev/null && + grep No normal >/dev/null + +' + +test_expect_success 'without -trail' ' + + git config core.whitespace -trail + git diff --color >output + grep "$blue_grep" output >error + grep -v "$blue_grep" output >normal + + grep Eight normal >/dev/null && + grep HT error >/dev/null && + grep With normal >/dev/null && + grep No normal >/dev/null + +' + +test_expect_success 'without -space' ' + + git config core.whitespace -space + git diff --color >output + grep "$blue_grep" output >error + grep -v "$blue_grep" output >normal + + grep Eight normal >/dev/null && + grep HT normal >/dev/null && + grep With error >/dev/null && + grep No normal >/dev/null + +' + +test_expect_success 'with indent-non-tab only' ' + + git config core.whitespace indent,-trailing,-space + git diff --color >output + grep "$blue_grep" output >error + grep -v "$blue_grep" output >normal + + grep Eight error >/dev/null && + grep HT normal >/dev/null && + grep With normal >/dev/null && + grep No normal >/dev/null + +' + +test_done -- cgit v1.2.3 From e9c34c233f2e838c334f6e8a807ebc6a988e9509 Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Sat, 3 Nov 2007 00:41:18 +0100 Subject: gitweb: Add tests for overriding gitweb config with repo config Make blame view and snapshot support overridable by repository config. Test tree view with both features disabled, and with both features enabled. Test with features enabled also tests multiple formats snapshot support (in tree view). Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- t/t9500-gitweb-standalone-no-errors.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 't') diff --git a/t/t9500-gitweb-standalone-no-errors.sh b/t/t9500-gitweb-standalone-no-errors.sh index 1bf0988d9a..35fff3ddba 100755 --- a/t/t9500-gitweb-standalone-no-errors.sh +++ b/t/t9500-gitweb-standalone-no-errors.sh @@ -557,4 +557,27 @@ test_expect_success \ 'gitweb_run "p=.git;a=tree;opt=--no-merges"' test_debug 'cat gitweb.log' +# ---------------------------------------------------------------------- +# gitweb config and repo config + +cat >>gitweb_config.perl < Date: Sat, 3 Nov 2007 13:12:17 +0000 Subject: git-reset: do not be confused if there is nothing to reset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The purpose of the function update_index_from_diff() (which is the callback function we give do_diff_cache()) is to update those index entries which differ from the given commit. Since do_diff_cache() plays games with the in-memory index, this function discarded the cache and reread it. Then, back in the function read_from_tree() we wrote the index. Of course, this broke down when there were no changes and update_index_from_diff() was not called, and therefore the mangled index was not discarded. The solution is to move the index writing into the function update_index_from_diff(). Noticed by Björn Steinbrink. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7102-reset.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 't') diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index f64b1cbf75..cea9afb764 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -402,4 +402,11 @@ test_expect_success 'test resetting the index at give paths' ' ' +test_expect_success 'resetting an unmodified path is a no-op' ' + git reset --hard && + git reset -- file1 && + git diff-files --exit-code && + git diff-index --cached --exit-code HEAD +' + test_done -- cgit v1.2.3 From e90ecb68178b41357f40b058aa760c2338974c13 Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Sun, 4 Nov 2007 01:50:23 -0400 Subject: format-patch: Test --[no-]numbered and format.numbered Just because there wasn't a test for --numbered isn't a good reason not to test format.numbered. So now we test both. Signed-off-by: Brian Gernhardt Signed-off-by: Junio C Hamano --- t/t4021-format-patch-numbered.sh | 106 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100755 t/t4021-format-patch-numbered.sh (limited to 't') diff --git a/t/t4021-format-patch-numbered.sh b/t/t4021-format-patch-numbered.sh new file mode 100755 index 0000000000..43d64bbd82 --- /dev/null +++ b/t/t4021-format-patch-numbered.sh @@ -0,0 +1,106 @@ +#!/bin/sh +# +# Copyright (c) 2006 Brian C Gernhardt +# + +test_description='Format-patch numbering options' + +. ./test-lib.sh + +test_expect_success setup ' + + echo A > file && + git add file && + git commit -m First && + + echo B >> file && + git commit -a -m Second && + + echo C >> file && + git commit -a -m Third + +' + +# Each of these gets used multiple times. + +test_num_no_numbered() { + cnt=$(grep "^Subject: \[PATCH\]" $1 | wc -l) && + test $cnt = $2 +} + +test_single_no_numbered() { + test_num_no_numbered $1 1 +} + +test_no_numbered() { + test_num_no_numbered $1 2 +} + +test_single_numbered() { + grep "^Subject: \[PATCH 1/1\]" $1 +} + +test_numbered() { + grep "^Subject: \[PATCH 1/2\]" $1 && + grep "^Subject: \[PATCH 2/2\]" $1 +} + +test_expect_success 'Default: no numbered' ' + + git format-patch --stdout HEAD~2 >patch0 && + test_no_numbered patch0 + +' + +test_expect_success 'Use --numbered' ' + + git format-patch --numbered --stdout HEAD~2 >patch1 && + test_numbered patch1 + +' + +test_expect_success 'format.numbered = true' ' + + git config format.numbered true && + git format-patch --stdout HEAD~2 >patch2 && + test_numbered patch2 + +' + +test_expect_success 'format.numbered && single patch' ' + + git format-patch --stdout HEAD^ > patch3 && + test_single_numbered patch3 + +' + +test_expect_success 'format.numbered && --no-numbered' ' + + git format-patch --no-numbered --stdout HEAD~2 >patch4 && + test_no_numbered patch4 + +' + +test_expect_success 'format.numbered = auto' ' + + git config format.numbered auto + git format-patch --stdout HEAD~2 > patch5 && + test_numbered patch5 + +' + +test_expect_success 'format.numbered = auto && single patch' ' + + git format-patch --stdout HEAD^ > patch6 && + test_single_no_numbered patch6 + +' + +test_expect_success 'format.numbered = auto && --no-numbered' ' + + git format-patch --no-numbered --stdout HEAD~2 > patch7 && + test_no_numbered patch7 + +' + +test_done -- cgit v1.2.3 From 562ca192f94496611583688beb3725603ce51f89 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 1 Nov 2007 17:32:04 -0700 Subject: clean: require -f to do damage by default This makes the clean.requireForce configuration default to true. Too many people are burned by typing "git clean" by mistake when they meant to say "make clean". Signed-off-by: Junio C Hamano --- t/t7201-co.sh | 12 ++++++------ t/t7300-clean.sh | 9 +++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) (limited to 't') diff --git a/t/t7201-co.sh b/t/t7201-co.sh index ed2e9ee3c6..55558aba8b 100755 --- a/t/t7201-co.sh +++ b/t/t7201-co.sh @@ -77,7 +77,7 @@ test_expect_success "checkout with dirty tree without -m" ' test_expect_success "checkout -m with dirty tree" ' git checkout -f master && - git clean && + git clean -f && fill 0 1 2 3 4 5 6 7 8 >one && git checkout -m side && @@ -99,7 +99,7 @@ test_expect_success "checkout -m with dirty tree" ' test_expect_success "checkout -m with dirty tree, renamed" ' - git checkout -f master && git clean && + git checkout -f master && git clean -f && fill 1 2 3 4 5 7 8 >one && if git checkout renamer @@ -121,7 +121,7 @@ test_expect_success "checkout -m with dirty tree, renamed" ' test_expect_success 'checkout -m with merge conflict' ' - git checkout -f master && git clean && + git checkout -f master && git clean -f && fill 1 T 3 4 5 6 S 8 >one && if git checkout renamer @@ -144,7 +144,7 @@ test_expect_success 'checkout -m with merge conflict' ' test_expect_success 'checkout to detach HEAD' ' - git checkout -f renamer && git clean && + git checkout -f renamer && git clean -f && git checkout renamer^ && H=$(git rev-parse --verify HEAD) && M=$(git show-ref -s --verify refs/heads/master) && @@ -160,7 +160,7 @@ test_expect_success 'checkout to detach HEAD' ' test_expect_success 'checkout to detach HEAD with branchname^' ' - git checkout -f master && git clean && + git checkout -f master && git clean -f && git checkout renamer^ && H=$(git rev-parse --verify HEAD) && M=$(git show-ref -s --verify refs/heads/master) && @@ -176,7 +176,7 @@ test_expect_success 'checkout to detach HEAD with branchname^' ' test_expect_success 'checkout to detach HEAD with HEAD^0' ' - git checkout -f master && git clean && + git checkout -f master && git clean -f && git checkout HEAD^0 && H=$(git rev-parse --verify HEAD) && M=$(git show-ref -s --verify refs/heads/master) && diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index eb0847afe9..8697213e6b 100755 --- a/t/t7300-clean.sh +++ b/t/t7300-clean.sh @@ -7,6 +7,8 @@ test_description='git-clean basic tests' . ./test-lib.sh +git config clean.requireForce no + test_expect_success 'setup' ' mkdir -p src && @@ -139,6 +141,13 @@ test_expect_success 'git-clean -d -X' ' ' +test_expect_success 'clean.requireForce defaults to true' ' + + git config --unset clean.requireForce && + ! git-clean + +' + test_expect_success 'clean.requireForce' ' git config clean.requireForce true && -- cgit v1.2.3 From c2015b3ae0d52ccae33ee00c2b25b8402c66bdf0 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sun, 4 Nov 2007 21:26:22 +0100 Subject: Fix an infinite loop in sq_quote_buf(). sq_quote_buf() treats single-quotes and exclamation marks specially, but it incorrectly parsed the input for single-quotes and backslashes. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t5510-fetch.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 't') diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index d217657146..aad863db7a 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -208,4 +208,11 @@ test_expect_success 'fetch with a non-applying branch..merge' ' git fetch blub ' +# the strange name is: a\!'b +test_expect_success 'quoting of a strangely named repo' ' + ! git fetch "a\\!'\''b" > result 2>&1 && + cat result && + grep "fatal: '\''a\\\\!'\''b'\''" result +' + test_done -- cgit v1.2.3 From c74d9acf20ba0c69bbd67c5b0bb3bd3c2349cebe Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 5 Nov 2007 03:21:47 -0800 Subject: git-svn: fix dcommit clobbering when committing a series of diffs Our revision number sent to SVN is set to the last revision we committed if we've made any previous commits in a dcommit invocation. Although our SVN Editor code uses the delta of two (old) trees to generate information to send upstream, it'll still send complete resultant files upstream; even if the tree they're based against is out-of-date. The combination of sending a file that does not include the latest changes, but set with a revision number of a commit we just made will cause SVN to accept the resultant file even if it was generated against an old tree. More trouble was caused when fixing this because we were rebasing uncessarily at times. We used git-diff-tree to check the imported SVN revision against our HEAD, not the last tree we committed to SVN. The unnecessary rebasing caused merge commits upstream to SVN to fail. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/t9106-git-svn-dcommit-clobber-series.sh | 56 +++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 t/t9106-git-svn-dcommit-clobber-series.sh (limited to 't') diff --git a/t/t9106-git-svn-dcommit-clobber-series.sh b/t/t9106-git-svn-dcommit-clobber-series.sh new file mode 100755 index 0000000000..7eff4cdc05 --- /dev/null +++ b/t/t9106-git-svn-dcommit-clobber-series.sh @@ -0,0 +1,56 @@ +#!/bin/sh +# +# Copyright (c) 2007 Eric Wong +test_description='git-svn dcommit clobber series' +. ./lib-git-svn.sh + +test_expect_success 'initialize repo' " + mkdir import && + cd import && + awk 'BEGIN { for (i = 1; i < 64; i++) { print i } }' > file + svn import -m 'initial' . $svnrepo && + cd .. && + git svn init $svnrepo && + git svn fetch && + test -e file + " + +test_expect_success '(supposedly) non-conflicting change from SVN' " + test x\"\`sed -n -e 58p < file\`\" = x58 && + test x\"\`sed -n -e 61p < file\`\" = x61 && + svn co $svnrepo tmp && + cd tmp && + perl -i -p -e 's/^58\$/5588/' file && + perl -i -p -e 's/^61\$/6611/' file && + test x\"\`sed -n -e 58p < file\`\" = x5588 && + test x\"\`sed -n -e 61p < file\`\" = x6611 && + svn commit -m '58 => 5588, 61 => 6611' && + cd .. + " + +test_expect_success 'some unrelated changes to git' " + echo hi > life && + git update-index --add life && + git commit -m hi-life && + echo bye >> life && + git commit -m bye-life life + " + +test_expect_success 'change file but in unrelated area' " + test x\"\`sed -n -e 4p < file\`\" = x4 && + test x\"\`sed -n -e 7p < file\`\" = x7 && + perl -i -p -e 's/^4\$/4444/' file && + perl -i -p -e 's/^7\$/7777/' file && + test x\"\`sed -n -e 4p < file\`\" = x4444 && + test x\"\`sed -n -e 7p < file\`\" = x7777 && + git commit -m '4 => 4444, 7 => 7777' file && + git svn dcommit && + svn up tmp && + cd tmp && + test x\"\`sed -n -e 4p < file\`\" = x4444 && + test x\"\`sed -n -e 7p < file\`\" = x7777 && + test x\"\`sed -n -e 58p < file\`\" = x5588 && + test x\"\`sed -n -e 61p < file\`\" = x6611 + " + +test_done -- cgit v1.2.3 From fb159580a1628947f0a088e24cfe6fe4c81d99d0 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 5 Nov 2007 03:21:48 -0800 Subject: git-svn: t9114: verify merge commit message in test It's possible that we end up with an incorrect commit message in this test after making changes to fix the clobber bug in dcommit. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/t9114-git-svn-dcommit-merge.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 't') diff --git a/t/t9114-git-svn-dcommit-merge.sh b/t/t9114-git-svn-dcommit-merge.sh index d6ca955081..225060b88b 100755 --- a/t/t9114-git-svn-dcommit-merge.sh +++ b/t/t9114-git-svn-dcommit-merge.sh @@ -86,4 +86,9 @@ test_expect_success 'verify post-merge ancestry' " git cat-file commit refs/heads/svn^ | grep '^friend$' " +test_expect_success 'verify merge commit message' " + git rev-list --pretty=raw -1 refs/heads/svn | \ + grep \" Merge branch 'merge' into svn\" + " + test_done -- cgit v1.2.3 From ae3e76c2991ddd5fd72cff22cd39d5d297e63504 Mon Sep 17 00:00:00 2001 From: Shawn Bohrer Date: Sun, 4 Nov 2007 22:28:12 -0600 Subject: Add more tests for git-clean Signed-off-by: Shawn Bohrer Signed-off-by: Junio C Hamano --- t/t7300-clean.sh | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) (limited to 't') diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index eb0847afe9..2327436187 100755 --- a/t/t7300-clean.sh +++ b/t/t7300-clean.sh @@ -37,6 +37,93 @@ test_expect_success 'git-clean' ' ' +test_expect_success 'git-clean src/' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + git-clean src/ && + test -f Makefile && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test -f a.out && + test ! -f src/part3.c && + test -f docs/manual.txt && + test -f obj.o && + test -f build/lib.so + +' + +test_expect_success 'git-clean src/ src/' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + git-clean src/ src/ && + test -f Makefile && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test -f a.out && + test ! -f src/part3.c && + test -f docs/manual.txt && + test -f obj.o && + test -f build/lib.so + +' + +test_expect_success 'git-clean with prefix' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + (cd src/ && git-clean) && + test -f Makefile && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test -f a.out && + test ! -f src/part3.c && + test -f docs/manual.txt && + test -f obj.o && + test -f build/lib.so + +' +test_expect_success 'git-clean -d with prefix and path' ' + + mkdir -p build docs src/feature && + touch a.out src/part3.c src/feature/file.c docs/manual.txt obj.o build/lib.so && + (cd src/ && git-clean -d feature/) && + test -f Makefile && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test -f a.out && + test -f src/part3.c && + test ! -f src/feature/file.c && + test -f docs/manual.txt && + test -f obj.o && + test -f build/lib.so + +' + +test_expect_success 'git-clean symbolic link' ' + + mkdir -p build docs && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so && + ln -s docs/manual.txt src/part4.c + git-clean && + test -f Makefile && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test ! -f a.out && + test ! -f src/part3.c && + test ! -f src/part4.c && + test -f docs/manual.txt && + test -f obj.o && + test -f build/lib.so + +' + test_expect_success 'git-clean -n' ' mkdir -p build docs && @@ -71,6 +158,24 @@ test_expect_success 'git-clean -d' ' ' +test_expect_success 'git-clean -d src/ examples/' ' + + mkdir -p build docs examples && + touch a.out src/part3.c docs/manual.txt obj.o build/lib.so examples/1.c && + git-clean -d src/ examples/ && + test -f Makefile && + test -f README && + test -f src/part1.c && + test -f src/part2.c && + test -f a.out && + test ! -f src/part3.c && + test ! -f examples/1.c && + test -f docs/manual.txt && + test -f obj.o && + test -f build/lib.so + +' + test_expect_success 'git-clean -x' ' mkdir -p build docs && -- cgit v1.2.3 From 9f12bec4386fc96e5b617268822cbb75e4c76101 Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Sun, 4 Nov 2007 10:31:26 -0500 Subject: t3502: Disambiguate between file and rev by adding -- On a case insensitive file system, this test fails because git-diff doesn't know if it is asking for the file "A" or the tag "a". Adding "--" at the end of the ambiguous commands allows the test to finish properly. Signed-off-by: Brian Gernhardt Signed-off-by: Junio C Hamano --- t/t3502-cherry-pick-merge.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 't') diff --git a/t/t3502-cherry-pick-merge.sh b/t/t3502-cherry-pick-merge.sh index 3274c6141b..7c92e261fc 100755 --- a/t/t3502-cherry-pick-merge.sh +++ b/t/t3502-cherry-pick-merge.sh @@ -36,7 +36,7 @@ test_expect_success 'cherry-pick a non-merge with -m should fail' ' git reset --hard && git checkout a^0 && ! git cherry-pick -m 1 b && - git diff --exit-code a + git diff --exit-code a -- ' @@ -45,7 +45,7 @@ test_expect_success 'cherry pick a merge without -m should fail' ' git reset --hard && git checkout a^0 && ! git cherry-pick c && - git diff --exit-code a + git diff --exit-code a -- ' @@ -98,7 +98,7 @@ test_expect_success 'revert a merge (1)' ' git reset --hard && git checkout c^0 && git revert -m 1 c && - git diff --exit-code a + git diff --exit-code a -- ' @@ -107,7 +107,7 @@ test_expect_success 'revert a merge (2)' ' git reset --hard && git checkout c^0 && git revert -m 2 c && - git diff --exit-code b + git diff --exit-code b -- ' -- cgit v1.2.3 From 243e0614e0f8783599b20106b50eee56d0a17332 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 5 Nov 2007 13:15:21 +0000 Subject: parse-options: abbreviation engine fix. When an option could be an ambiguous abbreviation of two options, the code used to error out. Even if an exact match would have occured later. Test and original patch by Pierre Habouzit. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t0040-parse-options.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 't') diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh index ae49424aa0..462fdf262f 100755 --- a/t/t0040-parse-options.sh +++ b/t/t0040-parse-options.sh @@ -18,6 +18,7 @@ string options -s, --string get a string --string2 get another string + --st get another string (pervert ordering) EOF @@ -90,4 +91,16 @@ test_expect_failure 'ambiguously abbreviated option' ' test $? != 129 ' +cat > expect << EOF +boolean: 0 +integer: 0 +string: 123 +EOF + +test_expect_success 'non ambiguous option (after two options it abbreviates)' ' + test-parse-options --st 123 > output 2> output.err && + test ! -s output.err && + git diff expect output +' + test_done -- cgit v1.2.3 From cdf4a751fa728273030651a769f9f45212ff50c9 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 3 Nov 2007 14:33:01 +0000 Subject: builtin-reset: do not call "ls-files --unmerged" Since reset is a builtin now, it can use the full power of libgit.a and check for unmerged entries itself. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7102-reset.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 't') diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index cea9afb764..506767d2d7 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -59,6 +59,15 @@ test_expect_success 'giving a non existing revision should fail' ' check_changes 3ec39651e7f44ea531a5de18a9fa791c0fd370fc ' +test_expect_success 'reset --soft with unmerged index should fail' ' + touch .git/MERGE_HEAD && + echo "100644 44c5b5884550c17758737edcced463447b91d42b 1 un" | + git update-index --index-info && + ! git reset --soft HEAD && + rm .git/MERGE_HEAD && + git rm --cached -- un +' + test_expect_success \ 'giving paths with options different than --mixed should fail' ' ! git reset --soft -- first && -- cgit v1.2.3 From 620a6cd42ed5ea94684b22714181bf03871733dd Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sat, 3 Nov 2007 15:21:21 +0000 Subject: builtin-reset: avoid forking "update-index --refresh" Instead of forking update-index, call refresh_cache() directly. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7102-reset.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 't') diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh index 506767d2d7..e5c9f30c73 100755 --- a/t/t7102-reset.sh +++ b/t/t7102-reset.sh @@ -418,4 +418,14 @@ test_expect_success 'resetting an unmodified path is a no-op' ' git diff-index --cached --exit-code HEAD ' +cat > expect << EOF +file2: needs update +EOF + +test_expect_success '--mixed refreshes the index' ' + echo 123 >> file2 && + git reset --mixed HEAD > output && + git diff --exit-code expect output +' + test_done -- cgit v1.2.3 From 4c324c00501c2da41987498f8c966b022306b244 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Sun, 4 Nov 2007 20:46:48 +0100 Subject: upload-pack: Use finish_{command,async}() instead of waitpid(). upload-pack spawns two processes, rev-list and pack-objects, and carefully monitors their status so that it can report failure to the remote end. This change removes the complicated procedures on the grounds of the following observations: - If everything is OK, rev-list closes its output pipe end, upon which pack-objects (which reads from the pipe) sees EOF and terminates itself, closing its output (and error) pipes. upload-pack reads from both until it sees EOF in both. It collects the exit codes of the child processes (which indicate success) and terminates successfully. - If rev-list sees an error, it closes its output and terminates with failure. pack-objects sees EOF in its input and terminates successfully. Again upload-pack reads its inputs until EOF. When it now collects the exit codes of its child processes, it notices the failure of rev-list and signals failure to the remote end. - If pack-objects sees an error, it terminates with failure. Since this breaks the pipe to rev-list, rev-list is killed with SIGPIPE. upload-pack reads its input until EOF, then collects the exit codes of the child processes, notices their failures, and signals failure to the remote end. - If upload-pack itself dies unexpectedly, pack-objects is killed with SIGPIPE, and subsequently also rev-list. The upshot of this is that precise monitoring of child processes is not required because both terminate if either one of them dies unexpectedly. This allows us to use finish_command() and finish_async() instead of an explicit waitpid(2) call. The change is smaller than it looks because most of it only reduces the indentation of a large part of the inner loop. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t5530-upload-pack-error.sh | 75 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 t/t5530-upload-pack-error.sh (limited to 't') diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh new file mode 100755 index 0000000000..cc8949e3ef --- /dev/null +++ b/t/t5530-upload-pack-error.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +test_description='errors in upload-pack' + +. ./test-lib.sh + +D=`pwd` + +corrupt_repo () { + object_sha1=$(git rev-parse "$1") && + ob=$(expr "$object_sha1" : "\(..\)") && + ject=$(expr "$object_sha1" : "..\(..*\)") && + rm -f ".git/objects/$ob/$ject" +} + +test_expect_success 'setup and corrupt repository' ' + + echo file >file && + git add file && + git rev-parse :file && + git commit -a -m original && + test_tick && + echo changed >file && + git commit -a -m changed && + corrupt_repo HEAD:file + +' + +test_expect_failure 'fsck fails' ' + + git fsck +' + +test_expect_success 'upload-pack fails due to error in pack-objects' ' + + ! echo "0032want $(git rev-parse HEAD) +00000009done +0000" | git-upload-pack . > /dev/null 2> output.err && + grep "pack-objects died" output.err +' + +test_expect_success 'corrupt repo differently' ' + + git hash-object -w file && + corrupt_repo HEAD^^{tree} + +' + +test_expect_failure 'fsck fails' ' + + git fsck +' +test_expect_success 'upload-pack fails due to error in rev-list' ' + + ! echo "0032want $(git rev-parse HEAD) +00000009done +0000" | git-upload-pack . > /dev/null 2> output.err && + grep "waitpid (async) failed" output.err +' + +test_expect_success 'create empty repository' ' + + mkdir foo && + cd foo && + git init + +' + +test_expect_failure 'fetch fails' ' + + git fetch .. master + +' + +test_done -- cgit v1.2.3 From 4d8b1dc850bafdf2304a525a768fbfc7aa5361ae Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Sun, 4 Nov 2007 01:11:15 +0100 Subject: Add tests for git tag These tests check whether git-tag properly sends a comment into the editor, and whether it reuses previous annotation when overwriting an existing tag. Signed-off-by: Mike Hommey Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 't') diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 0d07bc39c7..096fe33b07 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -1004,4 +1004,20 @@ test_expect_failure \ 'verify signed tag fails when public key is not present' \ 'git-tag -v signed-tag' +test_expect_success \ + 'message in editor has initial comment' ' + GIT_EDITOR=cat git tag -a initial-comment > actual || true && + test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0 +' + +get_tag_header reuse $commit commit $time >expect +echo "An annotation to be reused" >> expect +test_expect_success \ + 'overwriting an annoted tag should use its previous body' ' + git tag -a -m "An annotation to be reused" reuse && + GIT_EDITOR=true git tag -f -a reuse && + get_tag_msg reuse >actual && + git diff expect actual +' + test_done -- cgit v1.2.3 From 7c2c6ee7e0259d591acb3d9841cf5417e6b7a8eb Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 6 Nov 2007 20:29:20 -0500 Subject: Reteach builtin-ls-remote to understand remotes Prior to being made a builtin git-ls-remote understood that when it was given a remote name we wanted it to resolve that to the pre-configured URL and connect to that location. That changed when it was converted to a builtin and many of my automation tools broke. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- t/t5512-ls-remote.sh | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 t/t5512-ls-remote.sh (limited to 't') diff --git a/t/t5512-ls-remote.sh b/t/t5512-ls-remote.sh new file mode 100755 index 0000000000..6ec5f7c48b --- /dev/null +++ b/t/t5512-ls-remote.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +test_description='git ls-remote' + +. ./test-lib.sh + +test_expect_success setup ' + + >file && + git add file && + test_tick && + git commit -m initial && + git tag mark && + git show-ref --tags -d | sed -e "s/ / /" >expected.tag && + ( + echo "$(git rev-parse HEAD) HEAD" + git show-ref -d | sed -e "s/ / /" + ) >expected.all && + + git remote add self $(pwd)/.git + +' + +test_expect_success 'ls-remote --tags .git' ' + + git ls-remote --tags .git >actual && + diff -u expected.tag actual + +' + +test_expect_success 'ls-remote .git' ' + + git ls-remote .git >actual && + diff -u expected.all actual + +' + +test_expect_success 'ls-remote --tags self' ' + + git ls-remote --tags self >actual && + diff -u expected.tag actual + +' + +test_expect_success 'ls-remote self' ' + + git ls-remote self >actual && + diff -u expected.all actual + +' + +test_done -- cgit v1.2.3 From 6b945b9beee4cd01a58d875c0f83d018b4830ca0 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 2 Nov 2007 17:55:31 -0700 Subject: test format-patch -s: make sure MIME content type is shown as needed Signed-off-by: Junio C Hamano --- t/t4021-format-patch-signer-mime.sh | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 t/t4021-format-patch-signer-mime.sh (limited to 't') diff --git a/t/t4021-format-patch-signer-mime.sh b/t/t4021-format-patch-signer-mime.sh new file mode 100755 index 0000000000..67a70fadab --- /dev/null +++ b/t/t4021-format-patch-signer-mime.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +test_description='format-patch -s should force MIME encoding as needed' + +. ./test-lib.sh + +test_expect_success setup ' + + >F && + git add F && + git commit -m initial && + echo new line >F && + + test_tick && + git commit -m "This adds some lines to F" F + +' + +test_expect_success 'format normally' ' + + git format-patch --stdout -1 >output && + ! grep Content-Type output + +' + +test_expect_success 'format with signoff without funny signer name' ' + + git format-patch -s --stdout -1 >output && + ! grep Content-Type output + +' + +test_expect_success 'format with non ASCII signer name' ' + + GIT_COMMITTER_NAME="$B$O$^$N(B $B$U$K$*$&(B" \ + git format-patch -s --stdout -1 >output && + grep Content-Type output + +' + +test_done + -- cgit v1.2.3 From 6738c8194286fa0017f72cb57628dcae9ec07b27 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 8 Nov 2007 01:38:12 -0800 Subject: send-pack: segfault fix on forced push When pushing to overwrite a ref that points at a commit we do not even have, the recent "terse push" patch tried to get a unique abbreviation for the non-existent (from our point of view) object, which resulted in strcpy(buf, NULL) and segfaulted. Signed-off-by: Junio C Hamano --- t/t5405-send-pack-rewind.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 t/t5405-send-pack-rewind.sh (limited to 't') diff --git a/t/t5405-send-pack-rewind.sh b/t/t5405-send-pack-rewind.sh new file mode 100755 index 0000000000..86abc62271 --- /dev/null +++ b/t/t5405-send-pack-rewind.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +test_description='forced push to replace commit we do not have' + +. ./test-lib.sh + +test_expect_success setup ' + + >file1 && git add file1 && test_tick && + git commit -m Initial && + + mkdir another && ( + cd another && + git init && + git fetch .. master:master + ) && + + >file2 && git add file2 && test_tick && + git commit -m Second + +' + +test_expect_success 'non forced push should die not segfault' ' + + ( + cd another && + git push .. master:master + test $? = 1 + ) + +' + +test_expect_success 'forced push should succeed' ' + + ( + cd another && + git push .. +master:master + ) + +' + +test_done -- cgit v1.2.3 From d9c8344b467bb97b8dca8d811c99d4735eca88f2 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Fri, 9 Nov 2007 00:41:39 +0100 Subject: stop t1400 hiding errors in tests The last rm in the test was lacking an "&&" before it, which caused the errors in the commands be silently hidden. Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- t/t1400-update-ref.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index ce045b2a57..a90824ba8a 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -205,7 +205,7 @@ test_expect_success \ echo $h_TEST >.git/MERGE_HEAD && GIT_AUTHOR_DATE="2005-05-26 23:45" \ GIT_COMMITTER_DATE="2005-05-26 23:45" git-commit -F M && - h_MERGED=$(git rev-parse --verify HEAD) + h_MERGED=$(git rev-parse --verify HEAD) && rm -f M' cat >expect < Date: Thu, 8 Nov 2007 18:19:08 +0000 Subject: rebase: operate on a detached HEAD The interactive version of rebase does all the operations on a detached HEAD, so that after a successful rebase, @{1} is the pre-rebase state. The reflogs of "HEAD" still show all the actions in detail. This teaches the non-interactive version to do the same. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3402-rebase-merge.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t3402-rebase-merge.sh b/t/t3402-rebase-merge.sh index 0779aaa9ab..7b7d07269a 100755 --- a/t/t3402-rebase-merge.sh +++ b/t/t3402-rebase-merge.sh @@ -48,9 +48,14 @@ test_expect_success 'reference merge' ' git merge -s recursive "reference merge" HEAD master ' +PRE_REBASE=$(git rev-parse test-rebase) test_expect_success rebase ' git checkout test-rebase && - git rebase --merge master + GIT_TRACE=1 git rebase --merge master +' + +test_expect_success 'test-rebase@{1} is pre rebase' ' + test $PRE_REBASE = $(git rev-parse test-rebase@{1}) ' test_expect_success 'merge and rebase should match' ' -- cgit v1.2.3 From 5aa5cd460ccb6b18a1fcd53d566dadf049ceaf63 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 10 Nov 2007 01:49:34 -0800 Subject: git-commit: a bit more tests Add tests for -s (sign-off) and multiple -m options Signed-off-by: Junio C Hamano --- t/t7501-commit.sh | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 't') diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index b151b51a34..4dc35bdf55 100644 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -163,4 +163,73 @@ test_expect_success 'partial commit that involves removal (3)' ' ' +author="The Real Author " +test_expect_success 'amend commit to fix author' ' + + oldtick=$GIT_AUTHOR_DATE && + test_tick && + git reset --hard && + git cat-file -p HEAD | + sed -e "s/author.*/author $author $oldtick/" \ + -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \ + expected && + git commit --amend --author="$author" && + git cat-file -p HEAD > current && + diff expected current + +' + +test_expect_success 'sign off (1)' ' + + echo 1 >positive && + git add positive && + git commit -s -m "thank you" && + git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && + ( + echo thank you + echo + git var GIT_COMMITTER_IDENT | + sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" + ) >expected && + diff -u expected actual + +' + +test_expect_success 'sign off (2)' ' + + echo 2 >positive && + git add positive && + existing="Signed-off-by: Watch This " && + git commit -s -m "thank you + +$existing" && + git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && + ( + echo thank you + echo + echo $existing + git var GIT_COMMITTER_IDENT | + sed -e "s/>.*/>/" -e "s/^/Signed-off-by: /" + ) >expected && + diff -u expected actual + +' + +test_expect_success 'multiple -m' ' + + >negative && + git add negative && + git commit -m "one" -m "two" -m "three" && + git cat-file commit HEAD | sed -e "1,/^\$/d" >actual && + ( + echo one + echo + echo two + echo + echo three + ) >expected && + diff -u expected actual + +' + test_done -- cgit v1.2.3 From c899a57c28ee7cf251f856b575128de21b5a9a12 Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Sat, 10 Nov 2007 17:47:54 +0100 Subject: for-each-ref: fix setup of option-parsing for --sort The option value for --sort is already a pointer to a pointer to struct ref_sort, so just use it. Signed-off-by: Lars Hjemli Signed-off-by: Junio C Hamano --- t/t6300-for-each-ref.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 't') diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh index d0809eb651..c722635050 100755 --- a/t/t6300-for-each-ref.sh +++ b/t/t6300-for-each-ref.sh @@ -148,4 +148,26 @@ test_expect_success 'Check format "rfc2822" date fields output' ' git diff expected actual ' +cat >expected <<\EOF +refs/heads/master +refs/tags/testtag +EOF + +test_expect_success 'Verify ascending sort' ' + git-for-each-ref --format="%(refname)" --sort=refname >actual && + git diff expected actual +' + + +cat >expected <<\EOF +refs/tags/testtag +refs/heads/master +EOF + +test_expect_success 'Verify descending sort' ' + git-for-each-ref --format="%(refname)" --sort=-refname >actual && + git diff expected actual +' + + test_done -- cgit v1.2.3 From 570f32266943d3a96d7ed64844986d847209364d Mon Sep 17 00:00:00 2001 From: Michele Ballabio Date: Sat, 10 Nov 2007 15:17:25 +0100 Subject: test-lib.sh: move error line after error() declaration This patch removes a spurious "command not found" error and actually makes the "Test script did not set test_description." string follow the command line option "--no-color". Signed-off-by: Michele Ballabio Signed-off-by: Junio C Hamano --- t/test-lib.sh | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 't') diff --git a/t/test-lib.sh b/t/test-lib.sh index 603a8cd5e7..90b6844d00 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -66,9 +66,6 @@ esac tput sgr0 >/dev/null 2>&1 && color=t -test "${test_description}" != "" || -error "Test script did not set test_description." - while test "$#" -ne 0 do case "$1" in @@ -77,8 +74,7 @@ do -i|--i|--im|--imm|--imme|--immed|--immedi|--immedia|--immediat|--immediate) immediate=t; shift ;; -h|--h|--he|--hel|--help) - echo "$test_description" - exit 0 ;; + help=t; shift ;; -v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose) verbose=t; shift ;; -q|--q|--qu|--qui|--quie|--quiet) @@ -124,6 +120,15 @@ say () { say_color info "$*" } +test "${test_description}" != "" || +error "Test script did not set test_description." + +if test "$help" = "t" +then + echo "$test_description" + exit 0 +fi + exec 5>&1 if test "$verbose" = "t" then -- cgit v1.2.3 From 859a4dbcadd200ae955fe36d0c4fb3f4bce0e032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Vanicat?= Date: Sun, 11 Nov 2007 13:28:08 +0100 Subject: Make GIT_INDEX_FILE apply to git-commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, when committing, git-commit ignore the value of GIT_INDEX_FILE, and always use $GIT_DIR/index. This patch fix it. Signed-off-by: Rémi Vanicat Signed-off-by: Junio C Hamano --- t/t7500-commit.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 't') diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh index f11ada8617..26bd8ee469 100755 --- a/t/t7500-commit.sh +++ b/t/t7500-commit.sh @@ -93,4 +93,36 @@ test_expect_success 'commit message from file should override template' ' commit_msg_is "standard input msg" ' +test_expect_success 'using alternate GIT_INDEX_FILE (1)' ' + + cp .git/index saved-index && + ( + echo some new content >file && + GIT_INDEX_FILE=.git/another_index && + export GIT_INDEX_FILE && + git add file && + git commit -m "commit using another index" && + git diff-index --exit-code HEAD && + git diff-files --exit-code + ) && + cmp .git/index saved-index >/dev/null + +' + +test_expect_success 'using alternate GIT_INDEX_FILE (2)' ' + + cp .git/index saved-index && + ( + rm -f .git/no-such-index && + GIT_INDEX_FILE=.git/no-such-index && + export GIT_INDEX_FILE && + git commit -m "commit using nonexistent index" && + test -z "$(git ls-files)" && + test -z "$(git ls-tree HEAD)" + + ) && + cmp .git/index saved-index >/dev/null + +' + test_done -- cgit v1.2.3 From e70f3202512a022898657047b59b46355be1631b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinbrink?= Date: Sun, 11 Nov 2007 18:38:11 +0100 Subject: t7005-editor.sh: Don't invoke real vi when it is in GIT_EXEC_PATH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The git wrapper executable always prepends the GIT_EXEC_PATH build variable to the current PATH, so prepending "." to the PATH is not enough to give precedence to the fake vi executable. The --exec-path option allows to prepend a directory to PATH even before GIT_EXEC_PATH (which is added anyway), so we can use that instead. Signed-off-by: Björn Steinbrink Signed-off-by: Junio C Hamano --- t/t7005-editor.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 't') diff --git a/t/t7005-editor.sh b/t/t7005-editor.sh index 28643b0da4..ed416e14e0 100755 --- a/t/t7005-editor.sh +++ b/t/t7005-editor.sh @@ -13,7 +13,6 @@ do done unset vi mv e-vi.sh vi -PATH=".:$PATH" unset EDITOR VISUAL GIT_EDITOR test_expect_success setup ' @@ -59,7 +58,7 @@ do ;; esac test_expect_success "Using $i" ' - git commit --amend && + git --exec-path=. commit --amend && git show -s --pretty=oneline | sed -e "s/^[0-9a-f]* //" >actual && diff actual expect @@ -81,7 +80,7 @@ do ;; esac test_expect_success "Using $i (override)" ' - git commit --amend && + git --exec-path=. commit --amend && git show -s --pretty=oneline | sed -e "s/^[0-9a-f]* //" >actual && diff actual expect -- cgit v1.2.3 From fed1b5cac0cc3ae324dc004181a276ea16589951 Mon Sep 17 00:00:00 2001 From: David Symonds Date: Fri, 9 Nov 2007 20:12:28 +1100 Subject: git-checkout: Test for relative path use. Signed-off-by: David Symonds Signed-off-by: Junio C Hamano --- t/t2008-checkout-subdir.sh | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100755 t/t2008-checkout-subdir.sh (limited to 't') diff --git a/t/t2008-checkout-subdir.sh b/t/t2008-checkout-subdir.sh new file mode 100755 index 0000000000..f78945ed8e --- /dev/null +++ b/t/t2008-checkout-subdir.sh @@ -0,0 +1,82 @@ +#!/bin/sh +# +# Copyright (c) 2007 David Symonds + +test_description='git checkout from subdirectories' + +. ./test-lib.sh + +test_expect_success setup ' + + echo "base" > file0 && + git add file0 && + mkdir dir1 && + echo "hello" > dir1/file1 && + git add dir1/file1 && + mkdir dir2 && + echo "bonjour" > dir2/file2 && + git add dir2/file2 && + test_tick && + git commit -m "populate tree" + +' + +test_expect_success 'remove and restore with relative path' ' + + ( + cd dir1 && + rm ../file0 && + git checkout HEAD -- ../file0 && + test "base" = "$(cat ../file0)" && + rm ../dir2/file2 && + git checkout HEAD -- ../dir2/file2 && + test "bonjour" = "$(cat ../dir2/file2)" && + rm ../file0 ./file1 && + git checkout HEAD -- .. && + test "base" = "$(cat ../file0)" && + test "hello" = "$(cat file1)" + ) + +' + +test_expect_success 'checkout with empty prefix' ' + + rm file0 && + git checkout HEAD -- file0 && + test "base" = "$(cat file0)" + +' + +test_expect_success 'checkout with simple prefix' ' + + rm dir1/file1 && + git checkout HEAD -- dir1 && + test "hello" = "$(cat dir1/file1)" && + rm dir1/file1 && + git checkout HEAD -- dir1/file1 && + test "hello" = "$(cat dir1/file1)" + +' + +# This is not expected to work as ls-files was not designed +# to deal with such. Enable it when ls-files is updated. +: test_expect_success 'checkout with complex relative path' ' + + rm file1 && + git checkout HEAD -- ../dir1/../dir1/file1 && test -f ./file1 + +' + +test_expect_failure 'relative path outside tree should fail' \ + 'git checkout HEAD -- ../../Makefile' + +test_expect_failure 'incorrect relative path to file should fail (1)' \ + 'git checkout HEAD -- ../file0' + +test_expect_failure 'incorrect relative path should fail (2)' \ + '( cd dir1 && git checkout HEAD -- ./file0 )' + +test_expect_failure 'incorrect relative path should fail (3)' \ + '( cd dir1 && git checkout HEAD -- ../../file0 )' + +test_done -- cgit v1.2.3 From fb6e4e1f3f048898677f3cf177bfcaf60123bd5c Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 8 Nov 2007 08:03:06 +0100 Subject: Do git reset --hard HEAD when using git rebase --skip When you have a merge conflict and want to bypass the commit causing it, you don't want to care about the dirty state of the working tree. Also, don't git reset --hard HEAD in the rebase-skip test, so that the lack of support for this is detected. Signed-off-by: Mike Hommey Signed-off-by: Junio C Hamano --- t/t3403-rebase-skip.sh | 2 -- 1 file changed, 2 deletions(-) (limited to 't') diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh index eab053c3e0..becabfc33c 100755 --- a/t/t3403-rebase-skip.sh +++ b/t/t3403-rebase-skip.sh @@ -36,7 +36,6 @@ test_expect_failure 'rebase with git am -3 (default)' ' ' test_expect_success 'rebase --skip with am -3' ' - git reset --hard HEAD && git rebase --skip ' test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge' @@ -44,7 +43,6 @@ test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge' test_expect_failure 'rebase with --merge' 'git rebase --merge master' test_expect_success 'rebase --skip with --merge' ' - git reset --hard HEAD && git rebase --skip ' -- cgit v1.2.3 From 4191c35671f6392173221bea3994f8b305f4f3a8 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Sun, 11 Nov 2007 02:29:47 -0500 Subject: git-fetch: avoid local fetching from alternate (again) Back in e3c6f240fd9c5bdeb33f2d47adc859f37935e2df Junio taught git-fetch to avoid copying objects when we are fetching from a repository that is already registered as an alternate object database. In such a case there is no reason to copy any objects as we can already obtain them through the alternate. However we need to ensure the objects are all reachable, so we run `git rev-list --objects $theirs --not --all` to verify this. If any object is missing or unreadable then we need to fetch/copy the objects from the remote. When a missing object is detected the git-rev-list process will exit with a non-zero exit status, making this condition quite easy to detect. Although git-fetch is currently a builtin (and so is rev-list) we cannot invoke the traverse_objects() API at this point in the transport code. The object walker within traverse_objects() calls die() as soon as it finds an object it cannot read. If that happens we want to resume the fetch process by calling do_fetch_pack(). To get around this we spawn git-rev-list into a background process to prevent a die() from killing the foreground fetch process, thus allowing the fetch process to resume into do_fetch_pack() if copying is necessary. We aren't interested in the output of rev-list (a list of SHA-1 object names that are reachable) or its errors (a "spurious" error about an object not being found as we need to copy it) so we redirect both stdout and stderr to /dev/null. We run this git-rev-list based check before any fetch as we may already have the necessary objects local from a prior fetch. If we don't then its very likely the first $theirs object listed on the command line won't exist locally and git-rev-list will die very quickly, allowing us to start the network transfer. This test even on remote URLs may save bandwidth if someone runs `git pull origin`, sees a merge conflict, resets out, then redoes the same pull just a short time later. If the remote hasn't changed between the two pulls and the local repository hasn't had git-gc run in it then there is probably no need to perform network transfer as all of the objects are local. Documentation for the new quickfetch function was suggested and written by Junio, based on his original comment in git-fetch.sh. Signed-off-by: Shawn O. Pearce --- t/t5502-quickfetch.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 't') diff --git a/t/t5502-quickfetch.sh b/t/t5502-quickfetch.sh index b4760f2dc0..16eadd6b68 100755 --- a/t/t5502-quickfetch.sh +++ b/t/t5502-quickfetch.sh @@ -86,4 +86,37 @@ test_expect_success 'quickfetch should not leave a corrupted repository' ' ' +test_expect_success 'quickfetch should not copy from alternate' ' + + ( + mkdir quickclone && + cd quickclone && + git init-db && + (cd ../.git/objects && pwd) >.git/objects/info/alternates && + git remote add origin .. && + git fetch -k -k + ) && + obj_cnt=$( ( + cd quickclone && + git count-objects | sed -e "s/ *objects,.*//" + ) ) && + pck_cnt=$( ( + cd quickclone && + git count-objects -v | sed -n -e "/packs:/{ + s/packs:// + p + q + }" + ) ) && + origin_master=$( ( + cd quickclone && + git rev-parse origin/master + ) ) && + echo "loose objects: $obj_cnt, packfiles: $pck_cnt" && + test $obj_cnt -eq 0 && + test $pck_cnt -eq 0 && + test z$origin_master = z$(git rev-parse master) + +' + test_done -- cgit v1.2.3 From 25487bde2ab756a423489fc942b37c1550555b93 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 11 Nov 2007 18:44:16 -0800 Subject: t2200: test more cases of "add -u" Signed-off-by: Junio C Hamano --- t/t2200-add-update.sh | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh index eb1ced3c37..24f892f793 100755 --- a/t/t2200-add-update.sh +++ b/t/t2200-add-update.sh @@ -1,6 +1,6 @@ #!/bin/sh -test_description='git add -u with path limiting +test_description='git add -u This test creates a working tree state with three files: @@ -9,7 +9,10 @@ This test creates a working tree state with three files: dir/other (untracked) and issues a git add -u with path limiting on "dir" to add -only the updates to dir/sub.' +only the updates to dir/sub. + +Also tested are "git add -u" without limiting, and "git add -u" +without contents changes.' . ./test-lib.sh @@ -85,4 +88,27 @@ test_expect_success 'replace a file with a symlink' ' ' +test_expect_success 'add everything changed' ' + + git add -u && + test -z "$(git diff-files)" + +' + +test_expect_success 'touch and then add -u' ' + + touch check && + git add -u && + test -z "$(git diff-files)" + +' + +test_expect_success 'touch and then add explicitly' ' + + touch check && + git add check && + test -z "$(git diff-files)" + +' + test_done -- cgit v1.2.3 From c8cfa3e4a5b1d1d4c870c82d2dbf162f570f0561 Mon Sep 17 00:00:00 2001 From: Benoit Sigoure Date: Sun, 11 Nov 2007 19:41:41 +0100 Subject: git-svn: prevent dcommitting if the index is dirty. dcommit uses rebase to sync the history with what has just been pushed to SVN. Trying to dcommit with a dirty index is troublesome for rebase, so now the user will get an error message if he attempts to dcommit with a dirty index. Signed-off-by: Benoit Sigoure Acked-by: Eric Wong Signed-off-by: Junio C Hamano --- t/t9106-git-svn-dcommit-clobber-series.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 't') diff --git a/t/t9106-git-svn-dcommit-clobber-series.sh b/t/t9106-git-svn-dcommit-clobber-series.sh index 7eff4cdc05..d59acc8d1a 100755 --- a/t/t9106-git-svn-dcommit-clobber-series.sh +++ b/t/t9106-git-svn-dcommit-clobber-series.sh @@ -53,4 +53,10 @@ test_expect_success 'change file but in unrelated area' " test x\"\`sed -n -e 61p < file\`\" = x6611 " +test_expect_failure 'attempt to dcommit with a dirty index' ' + echo foo >>file && + git add file && + git svn dcommit +' + test_done -- cgit v1.2.3 From cfbe7ab333d68790eb37341e30f040f99cef6af7 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sun, 11 Nov 2007 23:37:42 -0800 Subject: git-svn: support for funky branch and project names over HTTP(S) SVN requires that paths be URI-escaped for HTTP(S) repositories. file:// and svn:// repositories do not need these rules. Additionally, accessing individual paths inside repositories (check_path() and get_log() do NOT require escapes to function and in fact it breaks things). Noticed-by: Michael J. Cohen Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- t/t9118-git-svn-funky-branch-names.sh | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 t/t9118-git-svn-funky-branch-names.sh (limited to 't') diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh new file mode 100755 index 0000000000..640bb066f3 --- /dev/null +++ b/t/t9118-git-svn-funky-branch-names.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# +# Copyright (c) 2007 Eric Wong +# + +test_description='git-svn funky branch names' +. ./lib-git-svn.sh + +test_expect_success 'setup svnrepo' " + mkdir project project/trunk project/branches project/tags && + echo foo > project/trunk/foo && + svn import -m '$test_description' project \"$svnrepo/pr ject\" && + rm -rf project && + svn cp -m 'fun' \"$svnrepo/pr ject/trunk\" \ + \"$svnrepo/pr ject/branches/fun plugin\" && + svn cp -m 'more fun!' \"$svnrepo/pr ject/branches/fun plugin\" \ + \"$svnrepo/pr ject/branches/more fun plugin!\" && + start_httpd + " + +test_expect_success 'test clone with funky branch names' " + git svn clone -s \"$svnrepo/pr ject\" project && + cd project && + git rev-parse 'refs/remotes/fun%20plugin' && + git rev-parse 'refs/remotes/more%20fun%20plugin!' && + cd .. + " + +test_expect_success 'test dcommit to funky branch' " + cd project && + git reset --hard 'refs/remotes/more%20fun%20plugin!' && + echo hello >> foo && + git commit -m 'hello' -- foo && + git svn dcommit && + cd .. + " + +stop_httpd + +test_done -- cgit v1.2.3 From 3f735b66543a2221c218fc522272d62a333ebfec Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Mon, 12 Nov 2007 13:11:46 +0000 Subject: rebase: fix "rebase --continue" breakage The --skip case was handled properly when rebasing without --merge, but the --continue case was not. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3403-rebase-skip.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 't') diff --git a/t/t3403-rebase-skip.sh b/t/t3403-rebase-skip.sh index eab053c3e0..2ee5a00ea7 100755 --- a/t/t3403-rebase-skip.sh +++ b/t/t3403-rebase-skip.sh @@ -39,6 +39,19 @@ test_expect_success 'rebase --skip with am -3' ' git reset --hard HEAD && git rebase --skip ' + +test_expect_success 'rebase moves back to skip-reference' ' + test refs/heads/skip-reference = $(git symbolic-ref HEAD) && + git branch post-rebase && + git reset --hard pre-rebase && + ! git rebase master && + echo "hello" > hello && + git add hello && + git rebase --continue && + test refs/heads/skip-reference = $(git symbolic-ref HEAD) && + git reset --hard post-rebase +' + test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge' test_expect_failure 'rebase with --merge' 'git rebase --merge master' @@ -51,6 +64,10 @@ test_expect_success 'rebase --skip with --merge' ' test_expect_success 'merge and reference trees equal' \ 'test -z "`git diff-tree skip-merge skip-reference`"' +test_expect_success 'moved back to branch correctly' ' + test refs/heads/skip-merge = $(git symbolic-ref HEAD) +' + test_debug 'gitk --all & sleep 1' test_done -- cgit v1.2.3 From 6fa92bf3cdbfdd8c9c56ef40a5170a859442b166 Mon Sep 17 00:00:00 2001 From: Alex Riesen Date: Mon, 12 Nov 2007 22:38:23 +0100 Subject: Add a test checking if send-pack updated local tracking branches correctly Signed-off-by: Alex Riesen Signed-off-by: Junio C Hamano --- t/t5404-tracking-branches.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 t/t5404-tracking-branches.sh (limited to 't') diff --git a/t/t5404-tracking-branches.sh b/t/t5404-tracking-branches.sh new file mode 100755 index 0000000000..20718d4679 --- /dev/null +++ b/t/t5404-tracking-branches.sh @@ -0,0 +1,40 @@ +#!/bin/sh + +test_description='tracking branch update checks for git push' + +. ./test-lib.sh + +test_expect_success 'setup' ' + echo 1 >file && + git add file && + git commit -m 1 && + git branch b1 && + git branch b2 && + git clone . aa && + git checkout b1 && + echo b1 >>file && + git commit -a -m b1 && + git checkout b2 && + echo b2 >>file && + git commit -a -m b2 +' + +test_expect_success 'check tracking branches updated correctly after push' ' + cd aa && + b1=$(git rev-parse origin/b1) && + b2=$(git rev-parse origin/b2) && + git checkout -b b1 origin/b1 && + echo aa-b1 >>file && + git commit -a -m aa-b1 && + git checkout -b b2 origin/b2 && + echo aa-b2 >>file && + git commit -a -m aa-b2 && + git checkout master && + echo aa-master >>file && + git commit -a -m aa-master && + git push && + test "$(git rev-parse origin/b1)" = "$b1" && + test "$(git rev-parse origin/b2)" = "$b2" +' + +test_done -- cgit v1.2.3 From 8e806adb65dc4a0df91a0ebd54b76bb24ff1263e Mon Sep 17 00:00:00 2001 From: Andy Whitcroft Date: Fri, 9 Nov 2007 23:32:41 +0000 Subject: Add tests for git push'es mirror mode Add some tests for git push --mirror mode. Signed-off-by: Andy Whitcroft Signed-off-by: Junio C Hamano --- t/t5517-push-mirror.sh | 228 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100755 t/t5517-push-mirror.sh (limited to 't') diff --git a/t/t5517-push-mirror.sh b/t/t5517-push-mirror.sh new file mode 100755 index 0000000000..ed3fec192a --- /dev/null +++ b/t/t5517-push-mirror.sh @@ -0,0 +1,228 @@ +#!/bin/sh + +test_description='pushing to a mirror repository' + +. ./test-lib.sh + +D=`pwd` + +invert () { + if "$@"; then + return 1 + else + return 0 + fi +} + +mk_repo_pair () { + rm -rf master mirror && + mkdir mirror && + ( + cd mirror && + git init + ) && + mkdir master && + ( + cd master && + git init && + git config remote.up.url ../mirror + ) +} + + +# BRANCH tests +test_expect_success 'push mirror creates new branches' ' + + mk_repo_pair && + ( + cd master && + echo one >foo && git add foo && git commit -m one && + git push --mirror up + ) && + master_master=$(cd master && git show-ref -s --verify refs/heads/master) && + mirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) && + test "$master_master" = "$mirror_master" + +' + +test_expect_success 'push mirror updates existing branches' ' + + mk_repo_pair && + ( + cd master && + echo one >foo && git add foo && git commit -m one && + git push --mirror up && + echo two >foo && git add foo && git commit -m two && + git push --mirror up + ) && + master_master=$(cd master && git show-ref -s --verify refs/heads/master) && + mirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) && + test "$master_master" = "$mirror_master" + +' + +test_expect_success 'push mirror force updates existing branches' ' + + mk_repo_pair && + ( + cd master && + echo one >foo && git add foo && git commit -m one && + git push --mirror up && + echo two >foo && git add foo && git commit -m two && + git push --mirror up && + git reset --hard HEAD^ + git push --mirror up + ) && + master_master=$(cd master && git show-ref -s --verify refs/heads/master) && + mirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) && + test "$master_master" = "$mirror_master" + +' + +test_expect_success 'push mirror removes branches' ' + + mk_repo_pair && + ( + cd master && + echo one >foo && git add foo && git commit -m one && + git branch remove master && + git push --mirror up && + git branch -D remove + git push --mirror up + ) && + ( + cd mirror && + invert git show-ref -s --verify refs/heads/remove + ) + +' + +test_expect_success 'push mirror adds, updates and removes branches together' ' + + mk_repo_pair && + ( + cd master && + echo one >foo && git add foo && git commit -m one && + git branch remove master && + git push --mirror up && + git branch -D remove && + git branch add master && + echo two >foo && git add foo && git commit -m two && + git push --mirror up + ) && + master_master=$(cd master && git show-ref -s --verify refs/heads/master) && + master_add=$(cd master && git show-ref -s --verify refs/heads/add) && + mirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) && + mirror_add=$(cd mirror && git show-ref -s --verify refs/heads/add) && + test "$master_master" = "$mirror_master" && + test "$master_add" = "$mirror_add" && + ( + cd mirror && + invert git show-ref -s --verify refs/heads/remove + ) + +' + + +# TAG tests +test_expect_success 'push mirror creates new tags' ' + + mk_repo_pair && + ( + cd master && + echo one >foo && git add foo && git commit -m one && + git tag -f tmaster master && + git push --mirror up + ) && + master_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) && + mirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) && + test "$master_master" = "$mirror_master" + +' + +test_expect_success 'push mirror updates existing tags' ' + + mk_repo_pair && + ( + cd master && + echo one >foo && git add foo && git commit -m one && + git tag -f tmaster master && + git push --mirror up && + echo two >foo && git add foo && git commit -m two && + git tag -f tmaster master && + git push --mirror up + ) && + master_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) && + mirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) && + test "$master_master" = "$mirror_master" + +' + +test_expect_success 'push mirror force updates existing tags' ' + + mk_repo_pair && + ( + cd master && + echo one >foo && git add foo && git commit -m one && + git tag -f tmaster master && + git push --mirror up && + echo two >foo && git add foo && git commit -m two && + git tag -f tmaster master && + git push --mirror up && + git reset --hard HEAD^ + git tag -f tmaster master && + git push --mirror up + ) && + master_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) && + mirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) && + test "$master_master" = "$mirror_master" + +' + +test_expect_success 'push mirror removes tags' ' + + mk_repo_pair && + ( + cd master && + echo one >foo && git add foo && git commit -m one && + git tag -f tremove master && + git push --mirror up && + git tag -d tremove + git push --mirror up + ) && + ( + cd mirror && + invert git show-ref -s --verify refs/tags/tremove + ) + +' + +test_expect_success 'push mirror adds, updates and removes tags together' ' + + mk_repo_pair && + ( + cd master && + echo one >foo && git add foo && git commit -m one && + git tag -f tmaster master && + git tag -f tremove master && + git push --mirror up && + git tag -d tremove && + git tag tadd master && + echo two >foo && git add foo && git commit -m two && + git tag -f tmaster master && + git push --mirror up + ) && + master_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) && + master_add=$(cd master && git show-ref -s --verify refs/tags/tadd) && + mirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) && + mirror_add=$(cd mirror && git show-ref -s --verify refs/tags/tadd) && + test "$master_master" = "$mirror_master" && + test "$master_add" = "$mirror_add" && + ( + cd mirror && + invert git show-ref -s --verify refs/tags/tremove + ) + +' + +test_done -- cgit v1.2.3 From 9d87442f03c9e3fea7e24e2821fc0342f8efe1d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinbrink?= Date: Mon, 12 Nov 2007 16:15:39 +0100 Subject: git-commit: Add tests for invalid usage of -a/--interactive with paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-commit was/is broken in that it accepts paths together with -a or --interactive, which it shouldn't. There tests check those usage errors. Signed-off-by: Björn Steinbrink Signed-off-by: Junio C Hamano --- t/t7501-commit.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 't') diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index b151b51a34..7f25689bb7 100644 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -33,6 +33,16 @@ test_expect_failure \ "invalid options 2" \ "git-commit -C HEAD -m illegal" +test_expect_failure \ + "using paths with -a" \ + "echo King of the bongo >file && + git-commit -m foo -a file" + +test_expect_failure \ + "using paths with --interactive" \ + "echo bong-o-bong >file && + echo 7 | git-commit -m foo --interactive file" + test_expect_failure \ "using invalid commit with -C" \ "git-commit -C bogus" -- cgit v1.2.3 From aac5bf0b48c5f23cf482ca7958fa6815fe6502ed Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 13 Nov 2007 13:05:50 -0800 Subject: t/t3404: fix test for a bogus todo file. The test wants to see if there are still remaining tasks, but checked a wrong file. Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 6c92d61192..984146b5c2 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -149,7 +149,7 @@ test_expect_success 'stop on conflicting pick' ' diff -u expect .git/.dotest-merge/patch && diff -u expect2 file1 && test 4 = $(grep -v "^#" < .git/.dotest-merge/done | wc -l) && - test 0 = $(grep -v "^#" < .git/.dotest-merge/todo | wc -l) + test 0 = $(grep -v "^#" < .git/.dotest-merge/git-rebase-todo | wc -l) ' test_expect_success 'abort' ' -- cgit v1.2.3 From b57321f57b324320bdcf9f453ec4788da166f8f4 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 14 Nov 2007 01:54:43 -0800 Subject: git-clean: honor core.excludesfile git-clean did not honor core.excludesfile configuration variable, although some other commands such as git-add and git-status did. Fix this inconsistency. Original report and patch from Shun'ichi Fuji. Rewritten by me and bugs and tests are mine. Signed-off-by: Junio C Hamano --- t/t7300-clean.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 't') diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index eb0847afe9..0ed4ae2827 100755 --- a/t/t7300-clean.sh +++ b/t/t7300-clean.sh @@ -177,4 +177,15 @@ test_expect_success 'clean.requireForce and -f' ' ' +test_expect_success 'core.excludesfile' ' + + echo excludes >excludes && + echo included >included && + git config core.excludesfile excludes && + output=$(git clean -n excludes included 2>&1) && + expr "$output" : ".*included" >/dev/null && + ! expr "$output" : ".*excludes" >/dev/null + +' + test_done -- cgit v1.2.3 From 4d1012c3709e356107d0fb0e3bf5a39e0d5c209d Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 11 Nov 2007 23:35:23 +0000 Subject: Fix rev-list when showing objects involving submodules The function mark_tree_uninteresting() assumed that the tree entries are blob when they are not trees. This is not so. Since we do not traverse into submodules (yet), the gitlinks should be ignored. In general, we should try to start moving away from using the "S_ISLNK()" like things for internal git state. It was a mistake to just assume the numbers all were same across all systems in the first place. This implementation converts to the "object_type", and then uses a case statement. Noticed by Ilari on IRC. Test script taken from an earlier version by Dscho. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- t/t6008-rev-list-submodule.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 t/t6008-rev-list-submodule.sh (limited to 't') diff --git a/t/t6008-rev-list-submodule.sh b/t/t6008-rev-list-submodule.sh new file mode 100755 index 0000000000..88e96fb91b --- /dev/null +++ b/t/t6008-rev-list-submodule.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# +# Copyright (c) 2007 Johannes E. Schindelin +# + +test_description='git rev-list involving submodules that this repo has' + +. ./test-lib.sh + +test_expect_success 'setup' ' + : > file && + git add file && + test_tick && + git commit -m initial && + echo 1 > file && + test_tick && + git commit -m second file && + echo 2 > file && + test_tick && + git commit -m third file && + + rm .git/index && + + : > super-file && + git add super-file && + git submodule add . sub && + git symbolic-ref HEAD refs/heads/super && + test_tick && + git commit -m super-initial && + echo 1 > super-file && + test_tick && + git commit -m super-first super-file && + echo 2 > super-file && + test_tick && + git commit -m super-second super-file +' + +test_expect_success "Ilari's test" ' + git rev-list --objects super master ^super^ +' + +test_done -- cgit v1.2.3 From 63405283c3c6c55cca465ba21128ec1b354ee799 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 13 Nov 2007 21:04:56 +0100 Subject: t5300-pack-object.sh: Split the big verify-pack test into smaller parts. This makes it easier to spot which of the tests failed. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t5300-pack-object.sh | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 't') diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index ba7579c251..f1106e6542 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -187,49 +187,51 @@ test_expect_success \ test-3-${packname_3}.idx' test_expect_success \ - 'corrupt a pack and see if verify catches' \ + 'verify-pack catches mismatched .idx and .pack files' \ 'cat test-1-${packname_1}.idx >test-3.idx && cat test-2-${packname_2}.pack >test-3.pack && if git verify-pack test-3.idx then false else :; - fi && + fi' - : PACK_SIGNATURE && - cat test-1-${packname_1}.pack >test-3.pack && +test_expect_success \ + 'verify-pack catches a corrupted pack signature' \ + 'cat test-1-${packname_1}.pack >test-3.pack && dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=2 && if git verify-pack test-3.idx then false else :; - fi && + fi' - : PACK_VERSION && - cat test-1-${packname_1}.pack >test-3.pack && +test_expect_success \ + 'verify-pack catches a corrupted pack version' \ + 'cat test-1-${packname_1}.pack >test-3.pack && dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=7 && if git verify-pack test-3.idx then false else :; - fi && + fi' - : TYPE/SIZE byte of the first packed object data && - cat test-1-${packname_1}.pack >test-3.pack && +test_expect_success \ + 'verify-pack catches a corrupted type/size of the 1st packed object data' \ + 'cat test-1-${packname_1}.pack >test-3.pack && dd if=/dev/zero of=test-3.pack count=1 bs=1 conv=notrunc seek=12 && if git verify-pack test-3.idx then false else :; - fi && + fi' - : sum of the index file itself && - l=`wc -c test-3.pack && dd if=/dev/zero of=test-3.idx count=20 bs=1 conv=notrunc seek=$l && if git verify-pack test-3.pack then false else :; - fi && - - :' + fi' test_expect_success \ 'build pack index for an existing pack' \ -- cgit v1.2.3 From 41ec097aea91b4be038b1c4bbbe1bcb9d4e7aa53 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 13 Nov 2007 21:04:57 +0100 Subject: t7501-commit.sh: Not all seds understand option -i Use mv instead. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t7501-commit.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index 9dba104b1f..31a6f63399 100644 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -79,7 +79,8 @@ test_expect_success \ cat >editor <<\EOF #!/bin/sh -sed -i -e "s/a file/an amend commit/g" $1 +sed -e "s/a file/an amend commit/g" < $1 > $1- +mv $1- $1 EOF chmod 755 editor @@ -98,7 +99,8 @@ test_expect_success \ cat >editor <<\EOF #!/bin/sh -sed -i -e "s/amend/older/g" $1 +sed -e "s/amend/older/g" < $1 > $1- +mv $1- $1 EOF chmod 755 editor -- cgit v1.2.3 From 8ed2fca458d085f12c3c6808ef4ddab6aa40ef14 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 13 Nov 2007 21:04:58 +0100 Subject: t5302-pack-index: Skip tests of 64-bit offsets if necessary. There are platforms where off_t is not 64 bits wide. In this case many tests are doomed to fail. Let's skip them. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t5302-pack-index.sh | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh index 4f58c4c3f9..d93abc4c75 100755 --- a/t/t5302-pack-index.sh +++ b/t/t5302-pack-index.sh @@ -61,17 +61,33 @@ test_expect_success \ test_expect_success \ 'index v2: force some 64-bit offsets with pack-objects' \ - 'pack3=$(git pack-objects --index-version=2,0x40000 test-3 &1) || + ! echo "$msg" | grep "pack too large .* off_t" +then + have_64bits=t +else + say "skipping tests concerning 64-bit offsets" +fi + +test "$have_64bits" && +test_expect_success \ + 'index v2: verify a pack with some 64-bit offsets' \ + 'git verify-pack -v "test-3-${pack3}.pack"' +test "$have_64bits" && test_expect_failure \ '64-bit offsets: should be different from previous index v2 results' \ 'cmp "test-2-${pack2}.idx" "test-3-${pack3}.idx"' +test "$have_64bits" && test_expect_success \ 'index v2: force some 64-bit offsets with index-pack' \ 'git-index-pack --index-version=2,0x40000 -o 3.idx "test-1-${pack1}.pack"' +test "$have_64bits" && test_expect_success \ '64-bit offsets: index-pack result should match pack-objects one' \ 'cmp "test-3-${pack3}.idx" "3.idx"' @@ -113,6 +129,7 @@ test_expect_failure \ '[index v1] 6) newly created pack is BAD !' \ 'git verify-pack -v "test-4-${pack1}.pack"' +test "$have_64bits" && test_expect_success \ '[index v2] 1) stream pack to repository' \ 'rm -f .git/objects/pack/* && @@ -122,6 +139,7 @@ test_expect_success \ cmp "test-1-${pack1}.pack" ".git/objects/pack/pack-${pack1}.pack" && cmp "test-3-${pack1}.idx" ".git/objects/pack/pack-${pack1}.idx"' +test "$have_64bits" && test_expect_success \ '[index v2] 2) create a stealth corruption in a delta base reference' \ '# this test assumes a delta smaller than 16 bytes at the end of the pack @@ -134,14 +152,17 @@ test_expect_success \ bs=1 count=20 conv=notrunc && git cat-file blob "$delta_sha1" > blob_4 )' +test "$have_64bits" && test_expect_failure \ '[index v2] 3) corrupted delta happily returned wrong data' \ 'cmp blob_3 blob_4' +test "$have_64bits" && test_expect_failure \ '[index v2] 4) confirm that the pack is actually corrupted' \ 'git fsck --full $commit' +test "$have_64bits" && test_expect_failure \ '[index v2] 5) pack-objects refuses to reuse corrupted data' \ 'git pack-objects test-5 Date: Tue, 13 Nov 2007 21:04:59 +0100 Subject: Skip t3902-quoted.sh if the file system does not support funny names. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t3902-quoted.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 't') diff --git a/t/t3902-quoted.sh b/t/t3902-quoted.sh index 245fb3babd..73da45f18c 100755 --- a/t/t3902-quoted.sh +++ b/t/t3902-quoted.sh @@ -20,6 +20,13 @@ LF=' ' DQ='"' +echo foo > "Name and an${HT}HT" +test -f "Name and an${HT}HT" || { + # since FAT/NTFS does not allow tabs in filenames, skip this test + say 'Your filesystem does not allow tabs in filenames, test skipped.' + test_done +} + for_each_name () { for name in \ Name "Name and a${LF}LF" "Name and an${HT}HT" "Name${DQ}" \ -- cgit v1.2.3 From 5f9ffff308845e2439670ec3cb2c12f4865cf430 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Thu, 15 Nov 2007 12:24:17 -0500 Subject: rehabilitate some t5302 tests on 32-bit off_t machines Commit 8ed2fca458d085f12c3c6808ef4ddab6aa40ef14 was a bit draconian in skipping certain tests which should be perfectly valid even on platform with a 32-bit off_t. Signed-off-by: Nicolas Pitre Signed-off-by: Junio C Hamano --- t/t5302-pack-index.sh | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 't') diff --git a/t/t5302-pack-index.sh b/t/t5302-pack-index.sh index d93abc4c75..2a2878b572 100755 --- a/t/t5302-pack-index.sh +++ b/t/t5302-pack-index.sh @@ -129,17 +129,15 @@ test_expect_failure \ '[index v1] 6) newly created pack is BAD !' \ 'git verify-pack -v "test-4-${pack1}.pack"' -test "$have_64bits" && test_expect_success \ '[index v2] 1) stream pack to repository' \ 'rm -f .git/objects/pack/* && - git-index-pack --index-version=2,0x40000 --stdin < "test-1-${pack1}.pack" && + git-index-pack --index-version=2 --stdin < "test-1-${pack1}.pack" && git prune-packed && git count-objects | ( read nr rest && test "$nr" -eq 1 ) && cmp "test-1-${pack1}.pack" ".git/objects/pack/pack-${pack1}.pack" && - cmp "test-3-${pack1}.idx" ".git/objects/pack/pack-${pack1}.idx"' + cmp "test-2-${pack1}.idx" ".git/objects/pack/pack-${pack1}.idx"' -test "$have_64bits" && test_expect_success \ '[index v2] 2) create a stealth corruption in a delta base reference' \ '# this test assumes a delta smaller than 16 bytes at the end of the pack @@ -152,17 +150,14 @@ test_expect_success \ bs=1 count=20 conv=notrunc && git cat-file blob "$delta_sha1" > blob_4 )' -test "$have_64bits" && test_expect_failure \ '[index v2] 3) corrupted delta happily returned wrong data' \ 'cmp blob_3 blob_4' -test "$have_64bits" && test_expect_failure \ '[index v2] 4) confirm that the pack is actually corrupted' \ 'git fsck --full $commit' -test "$have_64bits" && test_expect_failure \ '[index v2] 5) pack-objects refuses to reuse corrupted data' \ 'git pack-objects test-5 Date: Fri, 16 Nov 2007 01:15:41 -0800 Subject: Fix per-directory exclude handing for "git add" In "dir_struct", each exclusion element in the exclusion stack records a base string (pointer to the beginning with length) so that we can tell where it came from, but this pointer is just pointing at the parameter that is given by the caller to the push_exclude_per_directory() function. While read_directory_recursive() runs, calls to excluded() makes use the data in the exclusion elements, including this base string. The caller of read_directory_recursive() is not supposed to free the buffer it gave to push_exclude_per_directory() earlier, until it returns. The test case Bruce Stephens gave in the mailing list discussion was simplified and added to the t3700 test. Signed-off-by: Junio C Hamano --- t/t3700-add.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 't') diff --git a/t/t3700-add.sh b/t/t3700-add.sh index a328bf57eb..287e058e37 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -104,9 +104,33 @@ test_expect_success 'add ignored ones with -f' ' git ls-files --error-unmatch d.ig/d.if d.ig/d.ig ' +test_expect_success 'add ignored ones with -f' ' + rm -f .git/index && + git add -f d.?? && + git ls-files --error-unmatch d.ig/d.if d.ig/d.ig +' + +test_expect_success '.gitignore with subdirectory' ' + + rm -f .git/index && + mkdir -p sub/dir && + echo "!dir/a.*" >sub/.gitignore && + >sub/a.ig && + >sub/dir/a.ig && + git add sub/dir && + git ls-files --error-unmatch sub/dir/a.ig && + rm -f .git/index && + ( + cd sub/dir && + git add . + ) && + git ls-files --error-unmatch sub/dir/a.ig +' + mkdir 1 1/2 1/3 touch 1/2/a 1/3/b 1/2/c test_expect_success 'check correct prefix detection' ' + rm -f .git/index && git add 1/2/a 1/3/b 1/2/c ' -- cgit v1.2.3 From 947a604b01a8e81b3d0341d38fbf891289f3c0bb Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Thu, 15 Nov 2007 08:18:07 +0100 Subject: Bisect reset: remove bisect refs that may have been packed. If refs were ever packed in the middle of bisection, the bisect refs were not removed from the "packed-refs" file. This patch fixes this problem by using "git update-ref -d $ref $hash" in "bisect_clean_state". Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- t/t6030-bisect-porcelain.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 't') diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index 53956c08e2..f09db6244e 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -71,6 +71,18 @@ test_expect_success 'bisect start with one bad and good' ' git bisect next ' +test_expect_success 'bisect reset removes packed refs' ' + git bisect reset && + git bisect start && + git bisect good $HASH1 && + git bisect bad $HASH3 && + git pack-refs --all --prune && + git bisect next && + git bisect reset && + test -z "$(git for-each-ref "refs/bisect/*")" && + test -z "$(git for-each-ref "refs/heads/bisect")" +' + # $HASH1 is good, $HASH4 is bad, we skip $HASH3 # but $HASH2 is bad, # so we should find $HASH2 as the first bad commit -- cgit v1.2.3 From 2587d6796605273de3a5ec7ba44ee1c1ac2b9302 Mon Sep 17 00:00:00 2001 From: Wincent Colaiuta Date: Fri, 16 Nov 2007 14:25:10 +0100 Subject: Fix t9101 test failure caused by Subversion "auto-props" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a user has an "auto-prop" in his/her ~/.subversion/config file for automatically setting the svn:keyword Id property on all ".c" files (a reasonably common configuration in the Subversion world) then one of the "svn propset" operations in the very first test would become a no-op, which in turn would make the next commit a no-op. This then caused the 25th test ('test propget') to fail because it expects a certain number of commits to have taken place but the actual number of commits was off by one. Björn Steinbrink identified the "auto-prop" feature as the cause of the failure. This patch avoids it by passing the "--no-auto-prop" flag to "svn import" when setting up the test repository, thus ensuring that the "svn propset" operation is no longer a no-op, regardless of the users' settings in their config. Signed-off-by: Wincent Colaiuta Signed-off-by: Junio C Hamano --- t/t9101-git-svn-props.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t9101-git-svn-props.sh b/t/t9101-git-svn-props.sh index 622ea1c0df..02c41697de 100755 --- a/t/t9101-git-svn-props.sh +++ b/t/t9101-git-svn-props.sh @@ -48,7 +48,7 @@ EOF printf "\r\n" > empty_crlf a_empty_crlf=`git-hash-object -w empty_crlf` - svn import -m 'import for git-svn' . "$svnrepo" >/dev/null + svn import --no-auto-props -m 'import for git-svn' . "$svnrepo" >/dev/null cd .. rm -rf import -- cgit v1.2.3 From 0e06cc8b823144be16a9fc1f703126b68d20d3b5 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 16 Nov 2007 01:15:41 -0800 Subject: Fix per-directory exclude handing for "git add" In "dir_struct", each exclusion element in the exclusion stack records a base string (pointer to the beginning with length) so that we can tell where it came from, but this pointer is just pointing at the parameter that is given by the caller to the push_exclude_per_directory() function. While read_directory_recursive() runs, calls to excluded() makes use the data in the exclusion elements, including this base string. The caller of read_directory_recursive() is not supposed to free the buffer it gave to push_exclude_per_directory() earlier, until it returns. The test case Bruce Stephens gave in the mailing list discussion was simplified and added to the t3700 test. Signed-off-by: Junio C Hamano --- t/t3700-add.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 't') diff --git a/t/t3700-add.sh b/t/t3700-add.sh index a328bf57eb..287e058e37 100755 --- a/t/t3700-add.sh +++ b/t/t3700-add.sh @@ -104,9 +104,33 @@ test_expect_success 'add ignored ones with -f' ' git ls-files --error-unmatch d.ig/d.if d.ig/d.ig ' +test_expect_success 'add ignored ones with -f' ' + rm -f .git/index && + git add -f d.?? && + git ls-files --error-unmatch d.ig/d.if d.ig/d.ig +' + +test_expect_success '.gitignore with subdirectory' ' + + rm -f .git/index && + mkdir -p sub/dir && + echo "!dir/a.*" >sub/.gitignore && + >sub/a.ig && + >sub/dir/a.ig && + git add sub/dir && + git ls-files --error-unmatch sub/dir/a.ig && + rm -f .git/index && + ( + cd sub/dir && + git add . + ) && + git ls-files --error-unmatch sub/dir/a.ig +' + mkdir 1 1/2 1/3 touch 1/2/a 1/3/b 1/2/c test_expect_success 'check correct prefix detection' ' + rm -f .git/index && git add 1/2/a 1/3/b 1/2/c ' -- cgit v1.2.3 From 481f0ee60eef2c34b891e5d04b7e6e5a955eedf4 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 11 Nov 2007 23:35:23 +0000 Subject: Fix rev-list when showing objects involving submodules The function mark_tree_uninteresting() assumed that the tree entries are blob when they are not trees. This is not so. Since we do not traverse into submodules (yet), the gitlinks should be ignored. In general, we should try to start moving away from using the "S_ISLNK()" like things for internal git state. It was a mistake to just assume the numbers all were same across all systems in the first place. This implementation converts to the "object_type", and then uses a case statement. Noticed by Ilari on IRC. Test script taken from an earlier version by Dscho. Signed-off-by: Linus Torvalds Signed-off-by: Junio C Hamano --- t/t6008-rev-list-submodule.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 t/t6008-rev-list-submodule.sh (limited to 't') diff --git a/t/t6008-rev-list-submodule.sh b/t/t6008-rev-list-submodule.sh new file mode 100755 index 0000000000..88e96fb91b --- /dev/null +++ b/t/t6008-rev-list-submodule.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# +# Copyright (c) 2007 Johannes E. Schindelin +# + +test_description='git rev-list involving submodules that this repo has' + +. ./test-lib.sh + +test_expect_success 'setup' ' + : > file && + git add file && + test_tick && + git commit -m initial && + echo 1 > file && + test_tick && + git commit -m second file && + echo 2 > file && + test_tick && + git commit -m third file && + + rm .git/index && + + : > super-file && + git add super-file && + git submodule add . sub && + git symbolic-ref HEAD refs/heads/super && + test_tick && + git commit -m super-initial && + echo 1 > super-file && + test_tick && + git commit -m super-first super-file && + echo 2 > super-file && + test_tick && + git commit -m super-second super-file +' + +test_expect_success "Ilari's test" ' + git rev-list --objects super master ^super^ +' + +test_done -- cgit v1.2.3 From eb9d2b91cf12b92ab45855702965f3bc384462f9 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 16 Nov 2007 23:02:08 +0100 Subject: Fix and improve t7004 (git-tag tests) Brown paper bag fix to avoid using non portable sed syntax. The test by itself didn't catch what it was supposed to, anyways. The new test first checks if git-tag correctly errors out when the user exited the editor without editing the file. Then it checks if what the user was presented in the editor was any useful, which we define as the following: * It begins with a single blank line, where the invoked editor would typically place the editing curser at, so that the user can immediately start typing; * It has some instruction but that comes after that initial blank line, all lines prefixed with "#". We specifically do not check for the wording of this instruction. * And it has nothing else, as the expected behaviour is "Hey you did not leave any message". Signed-off-by: Mike Hommey Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 096fe33b07..5f7e388d7a 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -1004,10 +1004,20 @@ test_expect_failure \ 'verify signed tag fails when public key is not present' \ 'git-tag -v signed-tag' +test_expect_failure \ + 'git-tag -a fails if tag annotation is empty' ' + GIT_EDITOR=cat git tag -a initial-comment +' + test_expect_success \ 'message in editor has initial comment' ' - GIT_EDITOR=cat git tag -a initial-comment > actual || true && - test $(sed -n "/^\(#\|\$\)/p" actual | wc -l) -gt 0 + GIT_EDITOR=cat git tag -a initial-comment > actual + # check the first line --- should be empty + first=$(sed -e 1q expect -- cgit v1.2.3 From 8736a8489080509516f5f4cc1cc74de33150f397 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sat, 17 Nov 2007 07:54:27 -0500 Subject: send-pack: track errors for each ref Instead of keeping the 'ret' variable, we instead have a status flag for each ref that tracks what happened to it. We then print the ref status after all of the refs have been examined. This paves the way for three improvements: - updating tracking refs only for non-error refs - incorporating remote rejection into the printed status - printing errors in a different order than we processed (e.g., consolidating non-ff errors near the end with a special message) Signed-off-by: Jeff King Acked-by: Alex Riesen Acked-by: Daniel Barkalow Signed-off-by: Junio C Hamano --- t/t5404-tracking-branches.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 't') diff --git a/t/t5404-tracking-branches.sh b/t/t5404-tracking-branches.sh index 20718d4679..799e47e5ba 100755 --- a/t/t5404-tracking-branches.sh +++ b/t/t5404-tracking-branches.sh @@ -19,7 +19,7 @@ test_expect_success 'setup' ' git commit -a -m b2 ' -test_expect_success 'check tracking branches updated correctly after push' ' +test_expect_success 'prepare pushable branches' ' cd aa && b1=$(git rev-parse origin/b1) && b2=$(git rev-parse origin/b2) && @@ -31,8 +31,16 @@ test_expect_success 'check tracking branches updated correctly after push' ' git commit -a -m aa-b2 && git checkout master && echo aa-master >>file && - git commit -a -m aa-master && - git push && + git commit -a -m aa-master +' + +test_expect_success 'mixed-success push returns error' '! git push' + +test_expect_success 'check tracking branches updated correctly after push' ' + test "$(git rev-parse origin/master)" = "$(git rev-parse master)" +' + +test_expect_success 'check tracking branches not updated for failed refs' ' test "$(git rev-parse origin/b1)" = "$b1" && test "$(git rev-parse origin/b2)" = "$b2" ' -- cgit v1.2.3 From 1f0e2a1a65477c2b8eb8812e5bf0ad07bf03738e Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sat, 17 Nov 2007 07:55:15 -0500 Subject: send-pack: check ref->status before updating tracking refs Previously, we manually checked the 'NONE' and 'UPTODATE' conditions. Now that we have ref->status, we can easily say "only update if we pushed successfully". This adds a test for and fixes a regression introduced in ed31df31 where deleted refs did not have their tracking branches removed. This was due to a bogus per-ref error test that is superseded by the more accurate ref->status flag. Signed-off-by: Jeff King Completely-Acked-By: Alex "Sleepy" Riesen Acked-by: Daniel Barkalow Signed-off-by: Junio C Hamano --- t/t5404-tracking-branches.sh | 5 +++++ 1 file changed, 5 insertions(+) (limited to 't') diff --git a/t/t5404-tracking-branches.sh b/t/t5404-tracking-branches.sh index 799e47e5ba..1493a92c06 100755 --- a/t/t5404-tracking-branches.sh +++ b/t/t5404-tracking-branches.sh @@ -45,4 +45,9 @@ test_expect_success 'check tracking branches not updated for failed refs' ' test "$(git rev-parse origin/b2)" = "$b2" ' +test_expect_success 'deleted branches have their tracking branches removed' ' + git push origin :b1 && + test "$(git rev-parse origin/b1)" = "origin/b1" +' + test_done -- cgit v1.2.3 From ca74c458a3908314cf29b96f1c43fe2b2597de76 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sat, 17 Nov 2007 07:56:03 -0500 Subject: send-pack: assign remote errors to each ref This lets us show remote errors (e.g., a denied hook) along with the usual push output. There is a slightly clever optimization in receive_status that bears explanation. We need to correlate the returned status and our ref objects, which naively could be an O(m*n) operation. However, since the current implementation of receive-pack returns the errors to us in the same order that we sent them, we optimistically look for the next ref to be looked up to come after the last one we have found. So it should be an O(m+n) merge if the receive-pack behavior holds, but we fall back to a correct but slower behavior if it should change. Signed-off-by: Jeff King Acked-by: Daniel Barkalow Signed-off-by: Junio C Hamano --- t/t5406-remote-rejects.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 t/t5406-remote-rejects.sh (limited to 't') diff --git a/t/t5406-remote-rejects.sh b/t/t5406-remote-rejects.sh new file mode 100755 index 0000000000..46b2cb4e46 --- /dev/null +++ b/t/t5406-remote-rejects.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +test_description='remote push rejects are reported by client' + +. ./test-lib.sh + +test_expect_success 'setup' ' + mkdir .git/hooks && + (echo "#!/bin/sh" ; echo "exit 1") >.git/hooks/update && + chmod +x .git/hooks/update && + echo 1 >file && + git add file && + git commit -m 1 && + git clone . child && + cd child && + echo 2 >file && + git commit -a -m 2 +' + +test_expect_success 'push reports error' '! git push 2>stderr' + +test_expect_success 'individual ref reports error' 'grep rejected stderr' + +test_done -- cgit v1.2.3 From 41337e22f0513c8a0ed603e30feb1fecaeb1649e Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 17 Nov 2007 12:47:16 -0800 Subject: git-svn: add tests for command-line usage of init and clone commands Some patches broke these commands in certain cases and were only caught by manual testing. Signed-off-by: Eric Wong --- t/t9117-git-svn-init-clone.sh | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 t/t9117-git-svn-init-clone.sh (limited to 't') diff --git a/t/t9117-git-svn-init-clone.sh b/t/t9117-git-svn-init-clone.sh new file mode 100755 index 0000000000..d482b407f2 --- /dev/null +++ b/t/t9117-git-svn-init-clone.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# +# Copyright (c) 2007 Eric Wong +# + +test_description='git-svn init/clone tests' + +. ./lib-git-svn.sh + +# setup, run inside tmp so we don't have any conflicts with $svnrepo +set -e +rm -r .git +mkdir tmp +cd tmp + +test_expect_success 'setup svnrepo' " + mkdir project project/trunk project/branches project/tags && + echo foo > project/trunk/foo && + svn import -m '$test_description' project $svnrepo/project && + rm -rf project + " + +test_expect_success 'basic clone' " + test ! -d trunk && + git svn clone $svnrepo/project/trunk && + test -d trunk/.git/svn && + test -e trunk/foo && + rm -rf trunk + " + +test_expect_success 'clone to target directory' " + test ! -d target && + git svn clone $svnrepo/project/trunk target && + test -d target/.git/svn && + test -e target/foo && + rm -rf target + " + +test_expect_success 'clone with --stdlayout' " + test ! -d project && + git svn clone -s $svnrepo/project && + test -d project/.git/svn && + test -e project/foo && + rm -rf project + " + +test_expect_success 'clone to target directory with --stdlayout' " + test ! -d target && + git svn clone -s $svnrepo/project target && + test -d target/.git/svn && + test -e target/foo && + rm -rf target + " + +test_done -- cgit v1.2.3 From fede44b2e18c1e5985197913e8dcf5753f4eb99e Mon Sep 17 00:00:00 2001 From: David D Kilzer Date: Sat, 10 Nov 2007 22:10:33 -0800 Subject: git-svn log: fix ascending revision ranges Fixed typo in Git::SVN::Log::git_svn_log_cmd(). Previously a command like "git-svn log -r1:4" would only show a commit log separator. Added tests for ascending and descending revision ranges. Signed-off-by: David D Kilzer Acked-by: Eric Wong --- t/t9116-git-svn-log.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 't') diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh index 0d4e6b3f04..618d7e9c00 100755 --- a/t/t9116-git-svn-log.sh +++ b/t/t9116-git-svn-log.sh @@ -45,4 +45,18 @@ test_expect_success 'run log against a from trunk' " git svn log -r3 a | grep ^r3 " +printf 'r2 \nr4 \n' > expected-range-r2-r4 + +test_expect_success 'test ascending revision range' " + git reset --hard trunk && + git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r2-r4 - + " + +printf 'r4 \nr2 \n' > expected-range-r4-r2 + +test_expect_success 'test descending revision range' " + git reset --hard trunk && + git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4-r2 - + " + test_done -- cgit v1.2.3 From 60f3ff12573e411476f7a32ab13bbb9b8063c8f7 Mon Sep 17 00:00:00 2001 From: David D Kilzer Date: Sat, 10 Nov 2007 22:10:34 -0800 Subject: git-svn log: include commit log for the smallest revision in a range The "svn log -rM:N" command shows commit logs inclusive in the range [M,N]. Previously "git-svn log" always excluded the commit log for the smallest revision in a range, whether the range was ascending or descending. With this patch, the smallest revision in a range is always shown. Updated tests for ascending and descending revision ranges. Signed-off-by: David D Kilzer Acked-by: Eric Wong --- t/t9116-git-svn-log.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 't') diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh index 618d7e9c00..500089208d 100755 --- a/t/t9116-git-svn-log.sh +++ b/t/t9116-git-svn-log.sh @@ -45,18 +45,18 @@ test_expect_success 'run log against a from trunk' " git svn log -r3 a | grep ^r3 " -printf 'r2 \nr4 \n' > expected-range-r2-r4 +printf 'r1 \nr2 \nr4 \n' > expected-range-r1-r2-r4 test_expect_success 'test ascending revision range' " git reset --hard trunk && - git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r2-r4 - + git svn log -r 1:4 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r1-r2-r4 - " -printf 'r4 \nr2 \n' > expected-range-r4-r2 +printf 'r4 \nr2 \nr1 \n' > expected-range-r4-r2-r1 test_expect_success 'test descending revision range' " git reset --hard trunk && - git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4-r2 - + git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4-r2-r1 - " test_done -- cgit v1.2.3 From 111947ef8cd3071faadb527c20047efd4330138a Mon Sep 17 00:00:00 2001 From: David D Kilzer Date: Sun, 11 Nov 2007 22:56:52 -0800 Subject: git-svn log: handle unreachable revisions like "svn log" When unreachable revisions are given to "svn log", it displays all commit logs in the given range that exist in the current tree. (If no commit logs are found in the current tree, it simply prints a single commit log separator.) This patch makes "git-svn log" behave the same way. Ten tests added to t/t9116-git-svn-log.sh. Signed-off-by: David D Kilzer Acked-by: Eric Wong --- t/t9116-git-svn-log.sh | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 't') diff --git a/t/t9116-git-svn-log.sh b/t/t9116-git-svn-log.sh index 500089208d..902ed4145d 100755 --- a/t/t9116-git-svn-log.sh +++ b/t/t9116-git-svn-log.sh @@ -30,6 +30,12 @@ test_expect_success 'setup repository and import' " git reset --hard trunk && echo aye >> README && git commit -a -m aye && + git svn dcommit && + git reset --hard b && + echo spy >> README && + git commit -a -m spy && + echo try >> README && + git commit -a -m try && git svn dcommit " @@ -59,4 +65,64 @@ test_expect_success 'test descending revision range' " git svn log -r 4:1 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4-r2-r1 - " +printf 'r1 \nr2 \n' > expected-range-r1-r2 + +test_expect_success 'test ascending revision range with unreachable revision' " + git reset --hard trunk && + git svn log -r 1:3 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r1-r2 - + " + +printf 'r2 \nr1 \n' > expected-range-r2-r1 + +test_expect_success 'test descending revision range with unreachable revision' " + git reset --hard trunk && + git svn log -r 3:1 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r2-r1 - + " + +printf 'r2 \n' > expected-range-r2 + +test_expect_success 'test ascending revision range with unreachable upper boundary revision and 1 commit' " + git reset --hard trunk && + git svn log -r 2:3 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r2 - + " + +test_expect_success 'test descending revision range with unreachable upper boundary revision and 1 commit' " + git reset --hard trunk && + git svn log -r 3:2 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r2 - + " + +printf 'r4 \n' > expected-range-r4 + +test_expect_success 'test ascending revision range with unreachable lower boundary revision and 1 commit' " + git reset --hard trunk && + git svn log -r 3:4 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4 - + " + +test_expect_success 'test descending revision range with unreachable lower boundary revision and 1 commit' " + git reset --hard trunk && + git svn log -r 4:3 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4 - + " + +printf -- '------------------------------------------------------------------------\n' > expected-separator + +test_expect_success 'test ascending revision range with unreachable boundary revisions and no commits' " + git reset --hard trunk && + git svn log -r 5:6 | diff -u expected-separator - + " + +test_expect_success 'test descending revision range with unreachable boundary revisions and no commits' " + git reset --hard trunk && + git svn log -r 6:5 | diff -u expected-separator - + " + +test_expect_success 'test ascending revision range with unreachable boundary revisions and 1 commit' " + git reset --hard trunk && + git svn log -r 3:5 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4 - + " + +test_expect_success 'test descending revision range with unreachable boundary revisions and 1 commit' " + git reset --hard trunk && + git svn log -r 5:3 | grep '^r[0-9]' | cut -d'|' -f1 | diff -u expected-range-r4 - + " + test_done -- cgit v1.2.3 From 47d996a20c3347bb9efbb44e8ed2d615cfdffba3 Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sun, 11 Nov 2007 15:35:07 +0100 Subject: push: support pushing HEAD to real branch name This teaches "push HEAD" to resolve HEAD on the local side to its real branch name, e.g. master, and then act as if the real branch name was specified. So we have a shorthand for pushing the current branch. Besides HEAD, no other symbolic ref is resolved. Thanks to Daniel Barkalow for suggesting this implementation, which is much simpler than the implementation proposed before. Signed-off-by: Steffen Prohaska Signed-off-by: Junio C Hamano --- t/t5516-fetch-push.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 't') diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index 86f9b5346a..b0ff48816e 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -244,6 +244,23 @@ test_expect_success 'push with colon-less refspec (4)' ' ' +test_expect_success 'push with HEAD' ' + + mk_test heads/master && + git checkout master && + git push testrepo HEAD && + check_push_result $the_commit heads/master + +' + +test_expect_success 'push with HEAD nonexisting at remote' ' + + mk_test heads/master && + git checkout -b local master && + git push testrepo HEAD && + check_push_result $the_commit heads/local +' + test_expect_success 'push with dry-run' ' mk_test heads/master && -- cgit v1.2.3 From ae36bdcf5147b1b54de852eda111ad76a3040726 Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sun, 11 Nov 2007 15:01:47 +0100 Subject: push: use same rules as git-rev-parse to resolve refspecs This commit changes the rules for resolving refspecs to match the rules for resolving refs in rev-parse. git-rev-parse uses clear rules to resolve a short ref to its full name, which are well documented. The rules for resolving refspecs documented in git-send-pack were less strict and harder to understand. This commit replaces them by the rules of git-rev-parse. The unified rules are easier to understand and better resolve ambiguous cases. You can now push from a repository containing several branches ending on the same short name. Note, this may break existing setups. For example, "master" will no longer resolve to "origin/master" even when there is no other "master" elsewhere. Signed-off-by: Steffen Prohaska Signed-off-by: Junio C Hamano --- t/t5516-fetch-push.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index b0ff48816e..fd5f284e9a 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -145,11 +145,21 @@ test_expect_success 'push with no ambiguity (1)' ' test_expect_success 'push with no ambiguity (2)' ' mk_test remotes/origin/master && - git push testrepo master:master && + git push testrepo master:origin/master && check_push_result $the_commit remotes/origin/master ' +test_expect_success 'push with colon-less refspec, no ambiguity' ' + + mk_test heads/master heads/t/master && + git branch -f t/master master && + git push testrepo master && + check_push_result $the_commit heads/master && + check_push_result $the_first_commit heads/t/master + +' + test_expect_success 'push with weak ambiguity (1)' ' mk_test heads/master remotes/origin/master && -- cgit v1.2.3 From 605b4978a105e2f40a353513f616be7d20f91c15 Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sun, 11 Nov 2007 15:01:48 +0100 Subject: refactor fetch's ref matching to use refname_match() The old rules used by fetch were coded as a series of ifs. The old rules are: 1) match full refname if it starts with "refs/" or matches "HEAD" 2) verify that full refname starts with "refs/" 3) match abbreviated name in "refs/" if it starts with "heads/", "tags/", or "remotes/". 4) match abbreviated name in "refs/heads/" This is replaced by the new rules a) match full refname b) match abbreviated name prefixed with "refs/" c) match abbreviated name prefixed with "refs/heads/" The details of the new rules are different from the old rules. We no longer verify that the full refname starts with "refs/". The new rule (a) matches any full string. The old rules (1) and (2) were stricter. Now, the caller is responsible for using sensible full refnames. This should be the case for the current code. The new rule (b) is less strict than old rule (3). The new rule accepts abbreviated names that start with a non-standard prefix below "refs/". Despite this modifications the new rules should handle all cases as expected. Two tests are added to verify that fetch does not resolve short tags or HEAD in remotes. We may even think about loosening the rules a bit more and unify them with the rev-parse rules. This would be done by replacing ref_ref_fetch_rules with ref_ref_parse_rules. Note, the two new test would break. Signed-off-by: Steffen Prohaska Signed-off-by: Junio C Hamano --- t/t5510-fetch.sh | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 't') diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index aad863db7a..20257428eb 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -95,6 +95,31 @@ test_expect_success 'fetch following tags' ' ' +test_expect_failure 'fetch must not resolve short tag name' ' + + cd "$D" && + + mkdir five && + cd five && + git init && + + git fetch .. anno:five + +' + +test_expect_failure 'fetch must not resolve short remote name' ' + + cd "$D" && + git-update-ref refs/remotes/six/HEAD HEAD + + mkdir six && + cd six && + git init && + + git fetch .. six:six + +' + test_expect_success 'create bundle 1' ' cd "$D" && echo >file updated again by origin && -- cgit v1.2.3 From 396865859918e9c7bf8ce74aae137c57da134610 Mon Sep 17 00:00:00 2001 From: Carlos Rica Date: Fri, 9 Nov 2007 14:42:56 +0100 Subject: Make builtin-tag.c use parse_options. Also, this removes those tests ensuring that repeated -m options don't allocate memory more than once, because now this is done after parsing options, using the last one when more are given. The same for -F. Signed-off-by: Carlos Rica Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 't') diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 5f7e388d7a..736f22e4a9 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -339,20 +339,14 @@ test_expect_success \ ' test_expect_success \ - 'trying to create tags giving many -m or -F options should fail' ' + 'trying to create tags giving both -m or -F options should fail' ' echo "message file 1" >msgfile1 && echo "message file 2" >msgfile2 && ! tag_exists msgtag && - ! git-tag -m "message 1" -m "message 2" msgtag && - ! tag_exists msgtag && - ! git-tag -F msgfile1 -F msgfile2 msgtag && - ! tag_exists msgtag && ! git-tag -m "message 1" -F msgfile1 msgtag && ! tag_exists msgtag && ! git-tag -F msgfile1 -m "message 1" msgtag && ! tag_exists msgtag && - ! git-tag -F msgfile1 -m "message 1" -F msgfile2 msgtag && - ! tag_exists msgtag && ! git-tag -m "message 1" -F msgfile1 -m "message 2" msgtag && ! tag_exists msgtag ' -- cgit v1.2.3 From b7f30e0a972ab90a0f7720a7d6411822eb796ea3 Mon Sep 17 00:00:00 2001 From: "David D. Kilzer" Date: Sun, 18 Nov 2007 20:14:55 -0800 Subject: git-send-email: show all headers when sending mail As a git newbie, it was confusing to set an In-Reply-To header but then not see it printed when the git-send-email command was run. This patch prints all headers that would be sent to sendmail or an SMTP server instead of only printing From, Subject, Cc, To. It also removes the now-extraneous Date header after the "Log says" line. Added test to t/t9001-send-email.sh. Signed-off-by: David D. Kilzer Signed-off-by: Junio C Hamano --- t/t9001-send-email.sh | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 't') diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 83f9470202..659f9c758f 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -41,4 +41,41 @@ test_expect_success \ 'Verify commandline' \ 'diff commandline expected' +cat >expected-show-all-headers <<\EOF +0001-Second.patch +(mbox) Adding cc: A from line 'From: A ' +Dry-OK. Log says: +Server: relay.example.com +MAIL FROM: +RCPT TO:,,, +From: Example +To: to@example.com +Cc: cc@example.com, A +Subject: [PATCH 1/1] Second. +Date: DATE-STRING +Message-Id: MESSAGE-ID-STRING +X-Mailer: X-MAILER-STRING +In-Reply-To: +References: + +Result: OK +EOF + +test_expect_success 'Show all headers' ' + git send-email \ + --dry-run \ + --from="Example " \ + --to=to@example.com \ + --cc=cc@example.com \ + --bcc=bcc@example.com \ + --in-reply-to="" \ + --smtp-server relay.example.com \ + $patches | + sed -e "s/^\(Date:\).*/\1 DATE-STRING/" \ + -e "s/^\(Message-Id:\).*/\1 MESSAGE-ID-STRING/" \ + -e "s/^\(X-Mailer:\).*/\1 X-MAILER-STRING/" \ + >actual-show-all-headers && + diff -u expected-show-all-headers actual-show-all-headers +' + test_done -- cgit v1.2.3 From fce0499fad13815d936c1068b7a064030f543b3d Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Tue, 20 Nov 2007 06:39:53 +0100 Subject: Bisect reset: do nothing when not bisecting. Before this patch, using "git bisect reset" when not bisecting did a "git checkout master" for no good reason. This also happened using "git bisect replay" when not bisecting because "bisect_replay" starts by calling "bisect_reset". Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- t/t6030-bisect-porcelain.sh | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh index f09db6244e..2ba4b00e52 100755 --- a/t/t6030-bisect-porcelain.sh +++ b/t/t6030-bisect-porcelain.sh @@ -71,6 +71,31 @@ test_expect_success 'bisect start with one bad and good' ' git bisect next ' +test_expect_success 'bisect reset: back in the master branch' ' + git bisect reset && + echo "* master" > branch.expect && + git branch > branch.output && + cmp branch.expect branch.output +' + +test_expect_success 'bisect reset: back in another branch' ' + git checkout -b other && + git bisect start && + git bisect good $HASH1 && + git bisect bad $HASH3 && + git bisect reset && + echo " master" > branch.expect && + echo "* other" >> branch.expect && + git branch > branch.output && + cmp branch.expect branch.output +' + +test_expect_success 'bisect reset when not bisecting' ' + git bisect reset && + git branch > branch.output && + cmp branch.expect branch.output +' + test_expect_success 'bisect reset removes packed refs' ' git bisect reset && git bisect start && @@ -179,7 +204,7 @@ test_expect_success 'bisect skip: add line and then a new test' ' git bisect skip && git bisect good > my_bisect_log.txt && grep "$HASH5 is first bad commit" my_bisect_log.txt && - git bisect log > log_to_replay.txt + git bisect log > log_to_replay.txt && git bisect reset ' -- cgit v1.2.3 From 8d92f24852420c425f3ee499d3c3be01be4dc15c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Wed, 21 Nov 2007 00:57:33 -0800 Subject: t9106: fix a race condition that caused svn to miss modifications carbonated beverage noticed this test was occasionally failing. Signed-off-by: Eric Wong --- t/t9106-git-svn-dcommit-clobber-series.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't') diff --git a/t/t9106-git-svn-dcommit-clobber-series.sh b/t/t9106-git-svn-dcommit-clobber-series.sh index d59acc8d1a..745254665d 100755 --- a/t/t9106-git-svn-dcommit-clobber-series.sh +++ b/t/t9106-git-svn-dcommit-clobber-series.sh @@ -22,6 +22,7 @@ test_expect_success '(supposedly) non-conflicting change from SVN' " cd tmp && perl -i -p -e 's/^58\$/5588/' file && perl -i -p -e 's/^61\$/6611/' file && + poke file && test x\"\`sed -n -e 58p < file\`\" = x5588 && test x\"\`sed -n -e 61p < file\`\" = x6611 && svn commit -m '58 => 5588, 61 => 6611' && -- cgit v1.2.3 From e6fefa926de3fcc1f0424e1b901347379ed51935 Mon Sep 17 00:00:00 2001 From: "David D. Kilzer" Date: Wed, 21 Nov 2007 11:57:18 -0800 Subject: git-svn info: implement info command Implement "git-svn info" for files and directories based on the "svn info" command. Note that the -r/--revision argument is not supported yet. Added 18 tests in t/t9119-git-svn-info.sh. [ew: small fix to work without arguments on all working directories] Signed-off-by: David D. Kilzer Acked-by: Eric Wong --- t/t9119-git-svn-info.sh | 275 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 t/t9119-git-svn-info.sh (limited to 't') diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh new file mode 100644 index 0000000000..fbde8c81b5 --- /dev/null +++ b/t/t9119-git-svn-info.sh @@ -0,0 +1,275 @@ +#!/bin/sh +# +# Copyright (c) 2007 David D. Kilzer + +test_description='git-svn info' + +. ./lib-git-svn.sh + +ptouch() { + perl -w -e ' + use strict; + die "ptouch requires exactly 2 arguments" if @ARGV != 2; + die "$ARGV[0] does not exist" if ! -e $ARGV[0]; + my @s = stat $ARGV[0]; + utime $s[8], $s[9], $ARGV[1]; + ' "$1" "$2" +} + +test_expect_success 'setup repository and import' " + mkdir info && + cd info && + echo FIRST > A && + echo one > file && + ln -s file symlink-file && + mkdir directory && + touch directory/.placeholder && + ln -s directory symlink-directory && + svn import -m 'initial' . $svnrepo && + cd .. && + mkdir gitwc && + cd gitwc && + git-svn init $svnrepo && + git-svn fetch && + cd .. && + svn co $svnrepo svnwc && + ptouch svnwc/file gitwc/file && + ptouch svnwc/directory gitwc/directory && + ptouch svnwc/symlink-file gitwc/symlink-file && + ptouch svnwc/symlink-directory gitwc/symlink-directory + " + +test_expect_success 'info' " + (cd svnwc; svn info) > expected.info && + (cd gitwc; git-svn info) > actual.info && + git-diff expected.info actual.info + " + +test_expect_success 'info .' " + (cd svnwc; svn info .) > expected.info-dot && + (cd gitwc; git-svn info .) > actual.info-dot && + git-diff expected.info-dot actual.info-dot + " + +test_expect_success 'info file' " + (cd svnwc; svn info file) > expected.info-file && + (cd gitwc; git-svn info file) > actual.info-file && + git-diff expected.info-file actual.info-file + " + +test_expect_success 'info directory' " + (cd svnwc; svn info directory) > expected.info-directory && + (cd gitwc; git-svn info directory) > actual.info-directory && + git-diff expected.info-directory actual.info-directory + " + +test_expect_success 'info symlink-file' " + (cd svnwc; svn info symlink-file) > expected.info-symlink-file && + (cd gitwc; git-svn info symlink-file) > actual.info-symlink-file && + git-diff expected.info-symlink-file actual.info-symlink-file + " + +test_expect_success 'info symlink-directory' " + (cd svnwc; svn info symlink-directory) \ + > expected.info-symlink-directory && + (cd gitwc; git-svn info symlink-directory) \ + > actual.info-symlink-directory && + git-diff expected.info-symlink-directory actual.info-symlink-directory + " + +test_expect_success 'info added-file' " + echo two > gitwc/added-file && + cd gitwc && + git add added-file && + cd .. && + cp gitwc/added-file svnwc/added-file && + ptouch gitwc/added-file svnwc/added-file && + cd svnwc && + svn add added-file > /dev/null && + cd .. && + (cd svnwc; svn info added-file) > expected.info-added-file && + (cd gitwc; git-svn info added-file) > actual.info-added-file && + git-diff expected.info-added-file actual.info-added-file + " + +test_expect_success 'info added-directory' " + mkdir gitwc/added-directory svnwc/added-directory && + ptouch gitwc/added-directory svnwc/added-directory && + touch gitwc/added-directory/.placeholder && + cd svnwc && + svn add added-directory > /dev/null && + cd .. && + cd gitwc && + git add added-directory && + cd .. && + (cd svnwc; svn info added-directory) \ + > expected.info-added-directory && + (cd gitwc; git-svn info added-directory) \ + > actual.info-added-directory && + git-diff expected.info-added-directory actual.info-added-directory + " + +test_expect_success 'info added-symlink-file' " + cd gitwc && + ln -s added-file added-symlink-file && + git add added-symlink-file && + cd .. && + cd svnwc && + ln -s added-file added-symlink-file && + svn add added-symlink-file > /dev/null && + cd .. && + ptouch gitwc/added-symlink-file svnwc/added-symlink-file && + (cd svnwc; svn info added-symlink-file) \ + > expected.info-added-symlink-file && + (cd gitwc; git-svn info added-symlink-file) \ + > actual.info-added-symlink-file && + git-diff expected.info-added-symlink-file \ + actual.info-added-symlink-file + " + +test_expect_success 'info added-symlink-directory' " + cd gitwc && + ln -s added-directory added-symlink-directory && + git add added-symlink-directory && + cd .. && + cd svnwc && + ln -s added-directory added-symlink-directory && + svn add added-symlink-directory > /dev/null && + cd .. && + ptouch gitwc/added-symlink-directory svnwc/added-symlink-directory && + (cd svnwc; svn info added-symlink-directory) \ + > expected.info-added-symlink-directory && + (cd gitwc; git-svn info added-symlink-directory) \ + > actual.info-added-symlink-directory && + git-diff expected.info-added-symlink-directory \ + actual.info-added-symlink-directory + " + +# The next few tests replace the "Text Last Updated" value with a +# placeholder since git doesn't have a way to know the date that a +# now-deleted file was last checked out locally. Internally it +# simply reuses the Last Changed Date. + +test_expect_success 'info deleted-file' " + cd gitwc && + git rm -f file > /dev/null && + cd .. && + cd svnwc && + svn rm --force file > /dev/null && + cd .. && + (cd svnwc; svn info file) | + sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ + > expected.info-deleted-file && + (cd gitwc; git-svn info file) | + sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ + > actual.info-deleted-file && + git-diff expected.info-deleted-file actual.info-deleted-file + " + +test_expect_success 'info deleted-directory' " + cd gitwc && + git rm -r -f directory > /dev/null && + cd .. && + cd svnwc && + svn rm --force directory > /dev/null && + cd .. && + (cd svnwc; svn info directory) | + sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ + > expected.info-deleted-directory && + (cd gitwc; git-svn info directory) | + sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ + > actual.info-deleted-directory && + git-diff expected.info-deleted-directory actual.info-deleted-directory + " + +test_expect_success 'info deleted-symlink-file' " + cd gitwc && + git rm -f symlink-file > /dev/null && + cd .. && + cd svnwc && + svn rm --force symlink-file > /dev/null && + cd .. && + (cd svnwc; svn info symlink-file) | + sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ + > expected.info-deleted-symlink-file && + (cd gitwc; git-svn info symlink-file) | + sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ + > actual.info-deleted-symlink-file && + git-diff expected.info-deleted-symlink-file \ + actual.info-deleted-symlink-file + " + +test_expect_success 'info deleted-symlink-directory' " + cd gitwc && + git rm -f symlink-directory > /dev/null && + cd .. && + cd svnwc && + svn rm --force symlink-directory > /dev/null && + cd .. && + (cd svnwc; svn info symlink-directory) | + sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ + > expected.info-deleted-symlink-directory && + (cd gitwc; git-svn info symlink-directory) | + sed -e 's/^\(Text Last Updated:\).*/\1 TEXT-LAST-UPDATED-STRING/' \ + > actual.info-deleted-symlink-directory && + git-diff expected.info-deleted-symlink-directory \ + actual.info-deleted-symlink-directory + " + +# NOTE: git does not have the concept of replaced objects, +# so we can't test for files in that state. + +test_expect_success 'info unknown-file' " + echo two > gitwc/unknown-file && + cp gitwc/unknown-file svnwc/unknown-file && + ptouch gitwc/unknown-file svnwc/unknown-file && + (cd svnwc; svn info unknown-file) 2> expected.info-unknown-file && + (cd gitwc; git-svn info unknown-file) 2> actual.info-unknown-file && + git-diff expected.info-unknown-file actual.info-unknown-file + " + +test_expect_success 'info unknown-directory' " + mkdir gitwc/unknown-directory svnwc/unknown-directory && + ptouch gitwc/unknown-directory svnwc/unknown-directory && + touch gitwc/unknown-directory/.placeholder && + (cd svnwc; svn info unknown-directory) \ + 2> expected.info-unknown-directory && + (cd gitwc; git-svn info unknown-directory) \ + 2> actual.info-unknown-directory && + git-diff expected.info-unknown-directory actual.info-unknown-directory + " + +test_expect_success 'info unknown-symlink-file' " + cd gitwc && + ln -s unknown-file unknown-symlink-file && + cd .. && + cd svnwc && + ln -s unknown-file unknown-symlink-file && + cd .. && + ptouch gitwc/unknown-symlink-file svnwc/unknown-symlink-file && + (cd svnwc; svn info unknown-symlink-file) \ + 2> expected.info-unknown-symlink-file && + (cd gitwc; git-svn info unknown-symlink-file) \ + 2> actual.info-unknown-symlink-file && + git-diff expected.info-unknown-symlink-file \ + actual.info-unknown-symlink-file + " + +test_expect_success 'info unknown-symlink-directory' " + cd gitwc && + ln -s unknown-directory unknown-symlink-directory && + cd .. && + cd svnwc && + ln -s unknown-directory unknown-symlink-directory && + cd .. && + ptouch gitwc/unknown-symlink-directory \ + svnwc/unknown-symlink-directory && + (cd svnwc; svn info unknown-symlink-directory) \ + 2> expected.info-unknown-symlink-directory && + (cd gitwc; git-svn info unknown-symlink-directory) \ + 2> actual.info-unknown-symlink-directory && + git-diff expected.info-unknown-symlink-directory \ + actual.info-unknown-symlink-directory + " + +test_done -- cgit v1.2.3 From 8b014d7157d29ce76b0f631e19c6e2ce9aeb2366 Mon Sep 17 00:00:00 2001 From: "David D. Kilzer" Date: Wed, 21 Nov 2007 11:57:19 -0800 Subject: git-svn: info --url [path] Return the svn URL for the given path, or return the svn repository URL if no path is given. Added 18 tests to t/t9119-git-svn-info.sh. Signed-off-by: David D. Kilzer Acked-by: Eric Wong --- t/t9119-git-svn-info.sh | 93 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) (limited to 't') diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh index fbde8c81b5..439bd93c88 100644 --- a/t/t9119-git-svn-info.sh +++ b/t/t9119-git-svn-info.sh @@ -45,30 +45,51 @@ test_expect_success 'info' " git-diff expected.info actual.info " +test_expect_success 'info --url' ' + test $(cd gitwc; git-svn info --url) = $svnrepo + ' + test_expect_success 'info .' " (cd svnwc; svn info .) > expected.info-dot && (cd gitwc; git-svn info .) > actual.info-dot && git-diff expected.info-dot actual.info-dot " +test_expect_success 'info --url .' ' + test $(cd gitwc; git-svn info --url .) = $svnrepo + ' + test_expect_success 'info file' " (cd svnwc; svn info file) > expected.info-file && (cd gitwc; git-svn info file) > actual.info-file && git-diff expected.info-file actual.info-file " +test_expect_success 'info --url file' ' + test $(cd gitwc; git-svn info --url file) = "$svnrepo/file" + ' + test_expect_success 'info directory' " (cd svnwc; svn info directory) > expected.info-directory && (cd gitwc; git-svn info directory) > actual.info-directory && git-diff expected.info-directory actual.info-directory " +test_expect_success 'info --url directory' ' + test $(cd gitwc; git-svn info --url directory) = "$svnrepo/directory" + ' + test_expect_success 'info symlink-file' " (cd svnwc; svn info symlink-file) > expected.info-symlink-file && (cd gitwc; git-svn info symlink-file) > actual.info-symlink-file && git-diff expected.info-symlink-file actual.info-symlink-file " +test_expect_success 'info --url symlink-file' ' + test $(cd gitwc; git-svn info --url symlink-file) \ + = "$svnrepo/symlink-file" + ' + test_expect_success 'info symlink-directory' " (cd svnwc; svn info symlink-directory) \ > expected.info-symlink-directory && @@ -77,6 +98,11 @@ test_expect_success 'info symlink-directory' " git-diff expected.info-symlink-directory actual.info-symlink-directory " +test_expect_success 'info --url symlink-directory' ' + test $(cd gitwc; git-svn info --url symlink-directory) \ + = "$svnrepo/symlink-directory" + ' + test_expect_success 'info added-file' " echo two > gitwc/added-file && cd gitwc && @@ -92,6 +118,11 @@ test_expect_success 'info added-file' " git-diff expected.info-added-file actual.info-added-file " +test_expect_success 'info --url added-file' ' + test $(cd gitwc; git-svn info --url added-file) \ + = "$svnrepo/added-file" + ' + test_expect_success 'info added-directory' " mkdir gitwc/added-directory svnwc/added-directory && ptouch gitwc/added-directory svnwc/added-directory && @@ -109,6 +140,11 @@ test_expect_success 'info added-directory' " git-diff expected.info-added-directory actual.info-added-directory " +test_expect_success 'info --url added-directory' ' + test $(cd gitwc; git-svn info --url added-directory) \ + = "$svnrepo/added-directory" + ' + test_expect_success 'info added-symlink-file' " cd gitwc && ln -s added-file added-symlink-file && @@ -127,6 +163,11 @@ test_expect_success 'info added-symlink-file' " actual.info-added-symlink-file " +test_expect_success 'info --url added-symlink-file' ' + test $(cd gitwc; git-svn info --url added-symlink-file) \ + = "$svnrepo/added-symlink-file" + ' + test_expect_success 'info added-symlink-directory' " cd gitwc && ln -s added-directory added-symlink-directory && @@ -145,6 +186,11 @@ test_expect_success 'info added-symlink-directory' " actual.info-added-symlink-directory " +test_expect_success 'info --url added-symlink-directory' ' + test $(cd gitwc; git-svn info --url added-symlink-directory) \ + = "$svnrepo/added-symlink-directory" + ' + # The next few tests replace the "Text Last Updated" value with a # placeholder since git doesn't have a way to know the date that a # now-deleted file was last checked out locally. Internally it @@ -166,6 +212,11 @@ test_expect_success 'info deleted-file' " git-diff expected.info-deleted-file actual.info-deleted-file " +test_expect_success 'info --url file (deleted)' ' + test $(cd gitwc; git-svn info --url file) \ + = "$svnrepo/file" + ' + test_expect_success 'info deleted-directory' " cd gitwc && git rm -r -f directory > /dev/null && @@ -182,6 +233,11 @@ test_expect_success 'info deleted-directory' " git-diff expected.info-deleted-directory actual.info-deleted-directory " +test_expect_success 'info --url directory (deleted)' ' + test $(cd gitwc; git-svn info --url directory) \ + = "$svnrepo/directory" + ' + test_expect_success 'info deleted-symlink-file' " cd gitwc && git rm -f symlink-file > /dev/null && @@ -199,6 +255,11 @@ test_expect_success 'info deleted-symlink-file' " actual.info-deleted-symlink-file " +test_expect_success 'info --url symlink-file (deleted)' ' + test $(cd gitwc; git-svn info --url symlink-file) \ + = "$svnrepo/symlink-file" + ' + test_expect_success 'info deleted-symlink-directory' " cd gitwc && git rm -f symlink-directory > /dev/null && @@ -216,6 +277,11 @@ test_expect_success 'info deleted-symlink-directory' " actual.info-deleted-symlink-directory " +test_expect_success 'info --url symlink-directory (deleted)' ' + test $(cd gitwc; git-svn info --url symlink-directory) \ + = "$svnrepo/symlink-directory" + ' + # NOTE: git does not have the concept of replaced objects, # so we can't test for files in that state. @@ -228,6 +294,12 @@ test_expect_success 'info unknown-file' " git-diff expected.info-unknown-file actual.info-unknown-file " +test_expect_success 'info --url unknown-file' ' + test -z $(cd gitwc; git-svn info --url unknown-file \ + 2> ../actual.info--url-unknown-file) && + git-diff expected.info-unknown-file actual.info--url-unknown-file + ' + test_expect_success 'info unknown-directory' " mkdir gitwc/unknown-directory svnwc/unknown-directory && ptouch gitwc/unknown-directory svnwc/unknown-directory && @@ -239,6 +311,13 @@ test_expect_success 'info unknown-directory' " git-diff expected.info-unknown-directory actual.info-unknown-directory " +test_expect_success 'info --url unknown-directory' ' + test -z $(cd gitwc; git-svn info --url unknown-directory \ + 2> ../actual.info--url-unknown-directory) && + git-diff expected.info-unknown-directory \ + actual.info--url-unknown-directory + ' + test_expect_success 'info unknown-symlink-file' " cd gitwc && ln -s unknown-file unknown-symlink-file && @@ -255,6 +334,13 @@ test_expect_success 'info unknown-symlink-file' " actual.info-unknown-symlink-file " +test_expect_success 'info --url unknown-symlink-file' ' + test -z $(cd gitwc; git-svn info --url unknown-symlink-file \ + 2> ../actual.info--url-unknown-symlink-file) && + git-diff expected.info-unknown-symlink-file \ + actual.info--url-unknown-symlink-file + ' + test_expect_success 'info unknown-symlink-directory' " cd gitwc && ln -s unknown-directory unknown-symlink-directory && @@ -272,4 +358,11 @@ test_expect_success 'info unknown-symlink-directory' " actual.info-unknown-symlink-directory " +test_expect_success 'info --url unknown-symlink-directory' ' + test -z $(cd gitwc; git-svn info --url unknown-symlink-directory \ + 2> ../actual.info--url-unknown-symlink-directory) && + git-diff expected.info-unknown-symlink-directory \ + actual.info--url-unknown-symlink-directory + ' + test_done -- cgit v1.2.3 From f8b6809d52992ad14d035bcf7c8d8cfe00ef45a0 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 21 Nov 2007 23:06:44 -0800 Subject: Fix "quote" misconversion for rewrite diff output. 663af3422a648e87945e4d8c0cc3e13671f2bbde (Full rework of quote_c_style and write_name_quoted.) mistakenly used puts() when writing out a fixed string when it did not want to add a terminating LF. Signed-off-by: Junio C Hamano --- t/t4022-diff-rewrite.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 t/t4022-diff-rewrite.sh (limited to 't') diff --git a/t/t4022-diff-rewrite.sh b/t/t4022-diff-rewrite.sh new file mode 100755 index 0000000000..6de4acbd44 --- /dev/null +++ b/t/t4022-diff-rewrite.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +test_description='rewrite diff' + +. ./test-lib.sh + +test_expect_success setup ' + + cat ../../COPYING >test && + git add test && + tr 'a-zA-Z' 'n-za-mN-ZA-M' <../../COPYING >test + +' + +test_expect_success 'detect rewrite' ' + + actual=$(git diff-files -B --summary test) && + expr "$actual" : " rewrite test ([0-9]*%)$" || { + echo "Eh? <<$actual>>" + false + } + +' + +test_done + -- cgit v1.2.3 From c5546e88fe492558313965a49512ce5c71a98dfe Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 22 Nov 2007 12:24:59 +0000 Subject: bundle create: keep symbolic refs' names instead of resolving them MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When creating a bundle, symbolic refs used to be resolved to the non-symbolic refs they point to before being written to the list of contained refs. I.e. "git bundle create a1.bundle HEAD master" would show something like 388afe7881b33102fada216dd07806728773c011 refs/heads/master 388afe7881b33102fada216dd07806728773c011 refs/heads/master instead of 388afe7881b33102fada216dd07806728773c011 HEAD 388afe7881b33102fada216dd07806728773c011 refs/heads/master Introduce a special handling so that the symbolic refs are listed with the names passed on the command line. Noticed by Santi Béjar. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t5510-fetch.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 't') diff --git a/t/t5510-fetch.sh b/t/t5510-fetch.sh index 439430f569..7406de35ae 100755 --- a/t/t5510-fetch.sh +++ b/t/t5510-fetch.sh @@ -153,4 +153,17 @@ test_expect_success 'bundle should be able to create a full history' ' ' +test_expect_success 'bundle should record HEAD correctly' ' + + cd "$D" && + git bundle create bundle5 HEAD master && + git bundle list-heads bundle5 >actual && + for h in HEAD refs/heads/master + do + echo "$(git rev-parse --verify $h) $h" + done >expect && + diff -u expect actual + +' + test_done -- cgit v1.2.3 From 6047a234c5a6aef58c72a35feba326484f07660d Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 22 Nov 2007 12:30:10 +0000 Subject: rebase -i: move help to end of todo file [PATCH] rebase -i: move help to end of todo file Many editors start in the first line, so the 9-line help text was an annoyance. So move it to the end. Requested by Junio. While at it, add a hint how to abort the rebase. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index f1039d1a21..907c7f9f6b 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -149,7 +149,8 @@ test_expect_success 'stop on conflicting pick' ' diff -u expect .git/.dotest-merge/patch && diff -u expect2 file1 && test 4 = $(grep -v "^#" < .git/.dotest-merge/done | wc -l) && - test 0 = $(grep -v "^#" < .git/.dotest-merge/git-rebase-todo | wc -l) + test 0 = $(grep -ve "^#" -e "^$" < .git/.dotest-merge/git-rebase-todo | + wc -l) ' test_expect_success 'abort' ' -- cgit v1.2.3 From 958e67c0a8b7f12462ad1828ac3b3178181ea4e9 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 22 Nov 2007 16:48:55 -0800 Subject: Make test scripts executable. --- t/t4018-diff-funcname.sh | 0 t/t7501-commit.sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 t/t4018-diff-funcname.sh mode change 100644 => 100755 t/t7501-commit.sh (limited to 't') diff --git a/t/t4018-diff-funcname.sh b/t/t4018-diff-funcname.sh old mode 100644 new mode 100755 diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh old mode 100644 new mode 100755 -- cgit v1.2.3 From 193f7e98da72f1012515b0389525cf9a6a269849 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 22 Nov 2007 16:52:17 -0800 Subject: Make test scripts executable. --- t/t9119-git-svn-info.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 t/t9119-git-svn-info.sh (limited to 't') diff --git a/t/t9119-git-svn-info.sh b/t/t9119-git-svn-info.sh old mode 100644 new mode 100755 -- cgit v1.2.3 From d63c2fd192271ea2d85c81edfad90aa42fec26ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Fri, 2 Nov 2007 11:33:06 -0400 Subject: Add testcase for amending and fixing author in git commit. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We used to clobber author time, but we shouldn't. Signed-off-by: Kristian Høgsberg Signed-off-by: Junio C Hamano --- t/t7501-commit.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 't') diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index 9dba104b1f..e601028d02 100755 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -242,4 +242,19 @@ test_expect_success 'multiple -m' ' ' +author="The Real Author " +test_expect_success 'amend commit to fix author' ' + + oldtick=$GIT_AUTHOR_DATE && + test_tick && + git reset --hard && + git cat-file -p HEAD | + sed -e "s/author.*/author $author $oldtick/" \ + -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \ + expected && + git commit --amend --author="$author" && + git cat-file -p HEAD > current && + diff expected current + +' test_done -- cgit v1.2.3 From 367c98866c340bc9cf5cfa88c3b69f027165fc44 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sun, 11 Nov 2007 17:35:41 +0000 Subject: git status: show relative paths when run in a subdirectory To show the relative paths, the function formerly called quote_crlf() (now called quote_path()) takes the prefix as an additional argument. While at it, the static buffers were replaced by strbufs. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7502-status.sh | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100755 t/t7502-status.sh (limited to 't') diff --git a/t/t7502-status.sh b/t/t7502-status.sh new file mode 100755 index 0000000000..269b3341a2 --- /dev/null +++ b/t/t7502-status.sh @@ -0,0 +1,91 @@ +#!/bin/sh +# +# Copyright (c) 2007 Johannes E. Schindelin +# + +test_description='git-status' + +. ./test-lib.sh + +test_expect_success 'setup' ' + : > tracked && + : > modified && + mkdir dir1 && + : > dir1/tracked && + : > dir1/modified && + mkdir dir2 && + : > dir1/tracked && + : > dir1/modified && + git add . && + test_tick && + git commit -m initial && + : > untracked && + : > dir1/untracked && + : > dir2/untracked && + echo 1 > dir1/modified && + echo 2 > dir2/modified && + echo 3 > dir2/added && + git add dir2/added +' + +cat > expect << \EOF +# On branch master +# Changes to be committed: +# (use "git reset HEAD ..." to unstage) +# +# new file: dir2/added +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# +# modified: dir1/modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# dir1/untracked +# dir2/modified +# dir2/untracked +# expect +# output +# untracked +EOF + +test_expect_success 'status' ' + + git status > output && + git diff expect output + +' + +cat > expect << \EOF +# On branch master +# Changes to be committed: +# (use "git reset HEAD ..." to unstage) +# +# new file: ../dir2/added +# +# Changed but not updated: +# (use "git add ..." to update what will be committed) +# +# modified: ../dir1/modified +# +# Untracked files: +# (use "git add ..." to include in what will be committed) +# +# untracked +# ../dir2/modified +# ../dir2/untracked +# ../expect +# ../output +# ../untracked +EOF + +test_expect_success 'status with relative paths' ' + + (cd dir1 && git status) > output && + git diff expect output + +' + +test_done -- cgit v1.2.3 From 13208572fbe8838fd8835548d7502202d1f7b21d Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sun, 11 Nov 2007 17:35:58 +0000 Subject: builtin-commit: fix --signoff The Signed-off-by: line contained a spurious timestamp. The reason was a call to git_committer_info(1), which automatically added the timestamp. Instead, fmt_ident() was taught to interpret an empty string for the date (as opposed to NULL, which still triggers the default behavior) as "do not bother with the timestamp", and builtin-commit.c uses it. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7500-commit.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 't') diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh index cf389b81da..49c1922dde 100755 --- a/t/t7500-commit.sh +++ b/t/t7500-commit.sh @@ -122,7 +122,19 @@ test_expect_success 'using alternate GIT_INDEX_FILE (2)' ' ) && cmp .git/index saved-index >/dev/null +' +cat > expect << EOF +zort +Signed-off-by: C O Mitter +EOF + +test_expect_success '--signoff' ' + echo "yet another content *narf*" >> foo && + echo "zort" | + GIT_EDITOR=../t7500/add-content git commit -s -F - foo && + git cat-file commit HEAD | sed "1,/^$/d" > output && + diff expect output ' test_done -- cgit v1.2.3 From 2150554b0ed60356d8918b610834c04ad2eecdec Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Sun, 11 Nov 2007 17:36:27 +0000 Subject: builtin-commit --s: add a newline if the last line was not a S-o-b The rule is this: if the last line already contains the sign off by the current committer, do nothing. If it contains another sign off, just add the sign off of the current committer. If the last line does not contain a sign off, add a new line before adding the sign off. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t7500-commit.sh | 1 + 1 file changed, 1 insertion(+) (limited to 't') diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh index 49c1922dde..baed6ce96b 100755 --- a/t/t7500-commit.sh +++ b/t/t7500-commit.sh @@ -126,6 +126,7 @@ test_expect_success 'using alternate GIT_INDEX_FILE (2)' ' cat > expect << EOF zort + Signed-off-by: C O Mitter EOF -- cgit v1.2.3 From 1200993a1e885fd67d1a1d63da9d2a0e1ee5bcea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 15 Nov 2007 09:49:58 -0500 Subject: t7501-commit: Add test for git commit with dirty index. Signed-off-by: Junio C Hamano --- t/t7501-commit.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 't') diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh index e601028d02..ce83af3a02 100755 --- a/t/t7501-commit.sh +++ b/t/t7501-commit.sh @@ -257,4 +257,14 @@ test_expect_success 'amend commit to fix author' ' diff expected current ' + +test_expect_success 'git commit with dirty index' ' + echo tacocat > elif && + echo tehlulz > chz && + git add chz && + git commit elif -m "tacocat is a palindrome" && + git show --stat | grep elif && + git diff --cached | grep chz +' + test_done -- cgit v1.2.3 From 637efc3456576d548ed5b42e70deffca42e7428e Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 15 Nov 2007 06:27:57 +0000 Subject: Replace "runstatus" with "status" in the tests We no longer have "runstatus", but running "status" is no longer that expensive anyway; it is a builtin. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t3001-ls-files-others-exclude.sh | 2 +- t/t4001-diff-rename.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 't') diff --git a/t/t3001-ls-files-others-exclude.sh b/t/t3001-ls-files-others-exclude.sh index ae0639d8f3..e25b255683 100755 --- a/t/t3001-ls-files-others-exclude.sh +++ b/t/t3001-ls-files-others-exclude.sh @@ -86,7 +86,7 @@ EOF git config core.excludesFile excludes-file -git runstatus | grep "^# " > output +git status | grep "^# " > output cat > expect << EOF # .gitignore diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh index 063e79257a..877c1ea5db 100755 --- a/t/t4001-diff-rename.sh +++ b/t/t4001-diff-rename.sh @@ -71,10 +71,10 @@ test_expect_success 'favour same basenames over different ones' ' git rm path1 && mkdir subdir && git mv another-path subdir/path1 && - git runstatus | grep "renamed: .*path1 -> subdir/path1"' + git status | grep "renamed: .*path1 -> subdir/path1"' test_expect_success 'favour same basenames even with minor differences' ' git show HEAD:path1 | sed "s/15/16/" > subdir/path1 && - git runstatus | grep "renamed: .*path1 -> subdir/path1"' + git status | grep "renamed: .*path1 -> subdir/path1"' test_done -- cgit v1.2.3 From 3f7dfe77b71ff0ae78923518ab5ca28b0cf4d786 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 18 Nov 2007 22:22:00 -0800 Subject: git-branch --contains: doc and test Signed-off-by: Junio C Hamano --- t/t3201-branch-contains.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100755 t/t3201-branch-contains.sh (limited to 't') diff --git a/t/t3201-branch-contains.sh b/t/t3201-branch-contains.sh new file mode 100755 index 0000000000..9ef593f0e1 --- /dev/null +++ b/t/t3201-branch-contains.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +test_description='branch --contains ' + +. ./test-lib.sh + +test_expect_success setup ' + + >file && + git add file && + test_tick && + git commit -m initial && + git branch side && + + echo 1 >file && + test_tick && + git commit -a -m "second on master" && + + git checkout side && + echo 1 >file && + test_tick && + git commit -a -m "second on side" && + + git merge master + +' + +test_expect_success 'branch --contains=master' ' + + git branch --contains=master >actual && + { + echo " master" && echo "* side" + } >expect && + diff -u expect actual + +' + +test_expect_success 'branch --contains master' ' + + git branch --contains master >actual && + { + echo " master" && echo "* side" + } >expect && + diff -u expect actual + +' + +test_expect_success 'branch --contains=side' ' + + git branch --contains=side >actual && + { + echo "* side" + } >expect && + diff -u expect actual + +' + +test_done -- cgit v1.2.3 From b468f0ce4881bf42ffc820b1cddad67dad17fd80 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 22 Nov 2007 16:21:49 -0800 Subject: Add a few more tests for git-commit Signed-off-by: Junio C Hamano --- t/t7502-commit.sh | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100755 t/t7502-commit.sh (limited to 't') diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh new file mode 100755 index 0000000000..21ac785e3d --- /dev/null +++ b/t/t7502-commit.sh @@ -0,0 +1,92 @@ +#!/bin/sh + +test_description='git commit porcelain-ish' + +. ./test-lib.sh + +test_expect_success 'the basics' ' + + echo doing partial >"commit is" && + mkdir not && + echo very much encouraged but we should >not/forbid && + git add "commit is" not && + echo update added "commit is" file >"commit is" && + echo also update another >not/forbid && + test_tick && + git commit -a -m "initial with -a" && + + git cat-file blob HEAD:"commit is" >current.1 && + git cat-file blob HEAD:not/forbid >current.2 && + + cmp current.1 "commit is" && + cmp current.2 not/forbid + +' + +test_expect_success 'partial' ' + + echo another >"commit is" && + echo another >not/forbid && + test_tick && + git commit -m "partial commit to handle a file" "commit is" && + + changed=$(git diff-tree --name-only HEAD^ HEAD) && + test "$changed" = "commit is" + +' + +test_expect_success 'partial modification in a subdirecotry' ' + + test_tick && + git commit -m "partial commit to subdirectory" not && + + changed=$(git diff-tree -r --name-only HEAD^ HEAD) && + test "$changed" = "not/forbid" + +' + +test_expect_success 'partial removal' ' + + git rm not/forbid && + git commit -m "partial commit to remove not/forbid" not && + + changed=$(git diff-tree -r --name-only HEAD^ HEAD) && + test "$changed" = "not/forbid" && + remain=$(git ls-tree -r --name-only HEAD) && + test "$remain" = "commit is" + +' + +test_expect_success 'sign off' ' + + >positive && + git add positive && + git commit -s -m "thank you" && + actual=$(git cat-file commit HEAD | sed -ne "s/Signed-off-by: //p") && + expected=$(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/") && + test "z$actual" = "z$expected" + +' + +test_expect_success 'multiple -m' ' + + >negative && + git add negative && + git commit -m "one" -m "two" -m "three" && + actual=$(git cat-file commit HEAD | sed -e "1,/^\$/d") && + expected=$(echo one; echo; echo two; echo; echo three) && + test "z$actual" = "z$expected" + +' + +test_expect_success 'verbose' ' + + echo minus >negative && + git add negative && + git status -v | sed -ne "/^diff --git /p" >actual && + echo "diff --git a/negative b/negative" >expect && + diff -u expect actual + +' + +test_done -- cgit v1.2.3 From 29cc0ef1ab946bc593dbe3a1e71d7b3efa42e0c4 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 23 Nov 2007 20:13:41 -0800 Subject: t4119: correct overeager war-on-whitespace Earlier a6080a0a44d5ead84db3dabbbc80e82df838533d (War on whitespace) dropped a necessary trailing whitespace from the test vector. --- t/t4119-apply-config.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t4119-apply-config.sh b/t/t4119-apply-config.sh index 65571e0549..b540f7295a 100755 --- a/t/t4119-apply-config.sh +++ b/t/t4119-apply-config.sh @@ -24,7 +24,7 @@ cat >gpatch.file <<\EOF && +++ file1+ 2007-02-21 01:07:44.000000000 -0800 @@ -1 +1 @@ -A -+B ++B EOF sed -e 's|file1|sub/&|' gpatch.file >gpatch-sub.file && -- cgit v1.2.3 From d5a4164140c52a2d267d90e2413d1fe4a326a386 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 23 Nov 2007 20:14:20 -0800 Subject: builtin-apply: teach whitespace_rules We earlier introduced core.whitespace to allow users to tweak the definition of what the "whitespace errors" are, for the purpose of diff output highlighting. This teaches the same to git-apply, so that the command can both detect (when --whitespace=warn option is given) and fix (when --whitespace=fix option is given) as configured. Signed-off-by: Junio C Hamano --- t/t4124-apply-ws-rule.sh | 133 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100755 t/t4124-apply-ws-rule.sh (limited to 't') diff --git a/t/t4124-apply-ws-rule.sh b/t/t4124-apply-ws-rule.sh new file mode 100755 index 0000000000..f53ac466d6 --- /dev/null +++ b/t/t4124-apply-ws-rule.sh @@ -0,0 +1,133 @@ +#!/bin/sh + +test_description='core.whitespace rules and git-apply' + +. ./test-lib.sh + +prepare_test_file () { + + # A line that has character X is touched iff RULE is in effect: + # X RULE + # ! trailing-space + # @ space-before-tab + # # indent-with-non-tab + sed -e "s/_/ /g" -e "s/>/ /" <<-\EOF + An_SP in an ordinary line>and a HT. + >A HT. + _>A SP and a HT (@). + _>_A SP, a HT and a SP (@). + _______Seven SP. + ________Eight SP (#). + _______>Seven SP and a HT (@). + ________>Eight SP and a HT (@#). + _______>_Seven SP, a HT and a SP (@). + ________>_Eight SP, a HT and a SP (@#). + _______________Fifteen SP (#). + _______________>Fifteen SP and a HT (@#). + ________________Sixteen SP (#). + ________________>Sixteen SP and a HT (@#). + _____a__Five SP, a non WS, two SP. + A line with a (!) trailing SP_ + A line with a (!) trailing HT> + EOF +} + +apply_patch () { + >target && + sed -e "s|\([ab]\)/file|\1/target|" //p" >fixed + + # the changed lines are all expeced to change + fixed_cnt=$(wc -l fixed-patch + test -s fixed-patch && return 0 + + # Make sure it is complaint-free + >target + git apply --whitespace=error-all file && + git add file && + prepare_test_file >file && + git diff-files -p >patch && + >target && + git add target + +' + +test_expect_success 'whitespace=nowarn, default rule' ' + + apply_patch --whitespace=nowarn && + diff file target + +' + +test_expect_success 'whitespace=warn, default rule' ' + + apply_patch --whitespace=warn && + diff file target + +' + +test_expect_success 'whitespace=error-all, default rule' ' + + apply_patch --whitespace=error-all && return 1 + test -s target && return 1 + : happy + +' + +test_expect_success 'whitespace=error-all, no rule' ' + + git config core.whitespace -trailing,-space-before,-indent && + apply_patch --whitespace=error-all && + diff file target + +' + +for t in - '' +do + case "$t" in '') tt='!' ;; *) tt= ;; esac + for s in - '' + do + case "$s" in '') ts='@' ;; *) ts= ;; esac + for i in - '' + do + case "$i" in '') ti='#' ;; *) ti= ;; esac + rule=${t}trailing,${s}space,${i}indent && + test_expect_success "rule=$rule" ' + git config core.whitespace "$rule" && + test_fix "$tt$ts$ti" + ' + done + done +done + +test_done -- cgit v1.2.3 From 10507857fe8c5d8774d016a8542c8dd572271a8a Mon Sep 17 00:00:00 2001 From: Jeff King Date: Sun, 25 Nov 2007 23:50:58 -0500 Subject: git-tag: test that -s implies an annotated tag This detects a regression introduced while moving git-tag to a C builtin. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t7004-tag.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 't') diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh index 736f22e4a9..c7130c4dcc 100755 --- a/t/t7004-tag.sh +++ b/t/t7004-tag.sh @@ -667,6 +667,22 @@ test_expect_success 'creating a signed tag with -F - should succeed' ' git diff expect actual ' +cat >fakeeditor <<'EOF' +#!/bin/sh +test -n "$1" && exec >"$1" +echo A signed tag message +echo from a fake editor. +EOF +chmod +x fakeeditor +get_tag_header implied-annotate $commit commit $time >expect +./fakeeditor >>expect +echo '-----BEGIN PGP SIGNATURE-----' >>expect +test_expect_success '-s implies annotated tag' ' + GIT_EDITOR=./fakeeditor git-tag -s implied-annotate && + get_tag_msg implied-annotate >actual && + git diff expect actual +' + test_expect_success \ 'trying to create a signed tag with non-existing -F file should fail' ' ! test -f nonexistingfile && -- cgit v1.2.3 From 795c7c0b08fefc7d0f5d0903d8341491350996f0 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 28 Nov 2007 13:55:46 -0500 Subject: Add basic cvsimport tests We weren't even testing basic things before, so let's at least try importing and updating a trivial repository, which will catch total breakage. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t9600-cvsimport.sh | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100755 t/t9600-cvsimport.sh (limited to 't') diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh new file mode 100755 index 0000000000..1ee06bb386 --- /dev/null +++ b/t/t9600-cvsimport.sh @@ -0,0 +1,99 @@ +#!/bin/sh + +test_description='git-cvsimport basic tests' +. ./test-lib.sh + +if ! ( type cvs && type cvsps ) >/dev/null 2>&1 +then + test_expect_success 'skipping cvsimport tests, cvs/cvsps not found' '' + test_done + exit +fi + +CVSROOT=$(pwd)/cvsroot +export CVSROOT +# for clean cvsps cache +HOME=$(pwd) +export HOME + +test_expect_success 'setup cvsroot' 'cvs init' + +test_expect_success 'setup a cvs module' ' + + mkdir $CVSROOT/module && + cvs co -d module-cvs module && + cd module-cvs && + cat <o_fortuna && +O Fortuna +velut luna +statu variabilis, + +semper crescis +aut decrescis; +vita detestabilis + +nunc obdurat +et tunc curat +ludo mentis aciem, + +egestatem, +potestatem +dissolvit ut glaciem. +EOF + cvs add o_fortuna && + cat <message && +add "O Fortuna" lyrics + +These public domain lyrics make an excellent sample text. +EOF + cvs commit -F message && + cd .. +' + +test_expect_success 'import a trivial module' ' + + git cvsimport -a -z 0 -C module-git module && + git diff module-cvs/o_fortuna module-git/o_fortuna + +' + +test_expect_success 'update cvs module' ' + + cd module-cvs && + cat <o_fortuna && +O Fortune, +like the moon +you are changeable, + +ever waxing +and waning; +hateful life + +first oppresses +and then soothes +as fancy takes it; + +poverty +and power +it melts them like ice. +EOF + cat <message && +translate to English + +My Latin is terrible. +EOF + cvs commit -F message && + cd .. +' + +test_expect_success 'update git module' ' + + cd module-git && + git cvsimport -a -z 0 module && + git merge origin && + cd .. && + git diff module-cvs/o_fortuna module-git/o_fortuna + +' + +test_done -- cgit v1.2.3 From 9da0dabcd9ff71083b6bbc9878c22b12002400dd Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 28 Nov 2007 13:56:11 -0500 Subject: cvsimport: use rev-parse to support packed refs Previously, if refs were packed, git-cvsimport would assume that particular refs did not exist. This could lead to, for example, overwriting previous 'origin' commits that were packed. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t9600-cvsimport.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 't') diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh index 1ee06bb386..3338d447c5 100755 --- a/t/t9600-cvsimport.sh +++ b/t/t9600-cvsimport.sh @@ -57,6 +57,8 @@ test_expect_success 'import a trivial module' ' ' +test_expect_success 'pack refs' 'cd module-git && git gc && cd ..' + test_expect_success 'update cvs module' ' cd module-cvs && -- cgit v1.2.3 From 0673c96db92429d1c6dee528c71b067470b1e8f9 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Wed, 21 Nov 2007 02:19:34 -0500 Subject: Revert "t5516: test update of local refs on push" This reverts commit 09fba7a59d38d1cafaf33eadaf1d409c4113b30c. These tests are superseded by the ones in t5404 (added in 6fa92bf3 and 8736a848), which are more extensive and better organized. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t5516-fetch-push.sh | 28 ---------------------------- 1 file changed, 28 deletions(-) (limited to 't') diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index 86f9b5346a..4fbd5b1f47 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -254,32 +254,4 @@ test_expect_success 'push with dry-run' ' check_push_result $old_commit heads/master ' -test_expect_success 'push updates local refs' ' - - rm -rf parent child && - mkdir parent && cd parent && git init && - echo one >foo && git add foo && git commit -m one && - cd .. && - git clone parent child && cd child && - echo two >foo && git commit -a -m two && - git push && - test $(git rev-parse master) = $(git rev-parse remotes/origin/master) - -' - -test_expect_success 'push does not update local refs on failure' ' - - rm -rf parent child && - mkdir parent && cd parent && git init && - echo one >foo && git add foo && git commit -m one && - echo exit 1 >.git/hooks/pre-receive && - chmod +x .git/hooks/pre-receive && - cd .. && - git clone parent child && cd child && - echo two >foo && git commit -a -m two || exit 1 - git push && exit 1 - test $(git rev-parse master) != $(git rev-parse remotes/origin/master) - -' - test_done -- cgit v1.2.3 From cd67e4d46b122b161f2ad7d943e4ae7aa8df6cf5 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 28 Nov 2007 13:11:07 +0000 Subject: Teach 'git pull' about --rebase When calling 'git pull' with the '--rebase' option, it performs a fetch + rebase instead of a fetch + merge. This behavior is more desirable than fetch + pull when a topic branch is ready to be submitted and needs to be update. fetch + rebase might also be considered a better workflow with shared repositories in any case, or for contributors to a centrally managed repository, such as WINE's. As a convenience, you can set the default behavior for a branch by defining the config variable branch..rebase, which is interpreted as a bool. This setting can be overridden on the command line by --rebase and --no-rebase. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t5520-pull.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 't') diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh index 93eaf2c154..52b3a0c6dd 100755 --- a/t/t5520-pull.sh +++ b/t/t5520-pull.sh @@ -53,4 +53,26 @@ test_expect_success 'the default remote . should not break explicit pull' ' test `cat file` = modified ' +test_expect_success '--rebase' ' + git branch to-rebase && + echo modified again > file && + git commit -m file file && + git checkout to-rebase && + echo new > file2 && + git add file2 && + git commit -m "new file" && + git tag before-rebase && + git pull --rebase . copy && + test $(git rev-parse HEAD^) = $(git rev-parse copy) && + test new = $(git show HEAD:file2) +' + +test_expect_success 'branch.to-rebase.rebase' ' + git reset --hard before-rebase && + git config branch.to-rebase.rebase 1 && + git pull . copy && + test $(git rev-parse HEAD^) = $(git rev-parse copy) && + test new = $(git show HEAD:file2) +' + test_done -- cgit v1.2.3 From fdd7d48d6a09c593a68c983c450443c1e55705e6 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 27 Nov 2007 13:10:19 +0100 Subject: t7003-filter-branch: Fix test of a failing --msg-filter. The test passed for the wrong reason: If the script given to --msg-filter fails, it is expected that git-filter-branch aborts. But the test forgot to tell the branch name to rewrite, and so git-filter-branch failed due to incorrect usage. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t7003-filter-branch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't') diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index 2089351f7d..5f60b22d87 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -114,7 +114,7 @@ test_expect_success 'use index-filter to move into a subdirectory' ' test_expect_success 'stops when msg filter fails' ' old=$(git rev-parse HEAD) && - ! git-filter-branch -f --msg-filter false && + ! git-filter-branch -f --msg-filter false HEAD && test $old = $(git rev-parse HEAD) && rm -rf .git-rewrite ' -- cgit v1.2.3 From 28391a80a94d2b59d1d21f8264fe5dab91d77249 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 29 Nov 2007 01:02:53 +0000 Subject: receive-pack: allow deletion of corrupt refs Occasionally, in some setups (*cough* forks on repo.or.cz *cough*) some refs go stale, e.g. when the forkee rebased and lost some objects needed by the fork. The quick & dirty way to deal with those refs is to delete them and push them again. However, git-push first would first fetch the current commit name for the ref, would receive a null sha1 since the ref does not point to a valid object, then tell receive-pack that it should delete the ref with this commit name. delete_ref() would be subsequently be called, and check that resolve_ref() (which does _not_ check for validity of the object) returns the same commit name. Which would fail. The proper fix is to avoid corrupting repositories, but in the meantime this is a good fix in any case. Incidentally, some instances of "cd .." in the test cases were fixed, so that subsequent test cases run in t/trash/ irrespective of the outcome of the previous test cases. Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t5516-fetch-push.sh | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) (limited to 't') diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh index 4fbd5b1f47..987c9d21ca 100755 --- a/t/t5516-fetch-push.sh +++ b/t/t5516-fetch-push.sh @@ -247,11 +247,50 @@ test_expect_success 'push with colon-less refspec (4)' ' test_expect_success 'push with dry-run' ' mk_test heads/master && - cd testrepo && - old_commit=$(git show-ref -s --verify refs/heads/master) && - cd .. && + (cd testrepo && + old_commit=$(git show-ref -s --verify refs/heads/master)) && git push --dry-run testrepo && check_push_result $old_commit heads/master ' +test_expect_success 'push updates local refs' ' + + rm -rf parent child && + mkdir parent && + (cd parent && git init && + echo one >foo && git add foo && git commit -m one) && + git clone parent child && + (cd child && + echo two >foo && git commit -a -m two && + git push && + test $(git rev-parse master) = $(git rev-parse remotes/origin/master)) + +' + +test_expect_success 'push does not update local refs on failure' ' + + rm -rf parent child && + mkdir parent && + (cd parent && git init && + echo one >foo && git add foo && git commit -m one && + echo exit 1 >.git/hooks/pre-receive && + chmod +x .git/hooks/pre-receive) && + git clone parent child && + (cd child && + echo two >foo && git commit -a -m two && + ! git push && + test $(git rev-parse master) != \ + $(git rev-parse remotes/origin/master)) + +' + +test_expect_success 'allow deleting an invalid remote ref' ' + + pwd && + rm -f testrepo/.git/objects/??/* && + git push testrepo :refs/heads/master && + (cd testrepo && ! git rev-parse --verify refs/heads/master) + +' + test_done -- cgit v1.2.3 From 67d232426b8858b31e54a9b6a5a90916690d1153 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Fri, 30 Nov 2007 17:22:12 -0500 Subject: cvsimport: fix usage of cvsimport.module There were two problems: 1. We only look at the config variable if there is no module given on the command line. We checked this by comparing @ARGV == 0. However, at the time of the comparison, we have not yet parsed the dashed options, meaning that "git cvsimport" would read the variable but "git cvsimport -a" would not. This is fixed by simply moving the check after the call to getopt. 2. If the config variable did not exist, we were adding an empty string to @ARGV. The rest of the script, rather than barfing for insufficient input, would then try to import the module '', leading to rather confusing error messages. Based on patch from Emanuele Giaquinta. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t9600-cvsimport.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 't') diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh index 3338d447c5..29fee2dd13 100755 --- a/t/t9600-cvsimport.sh +++ b/t/t9600-cvsimport.sh @@ -98,4 +98,25 @@ test_expect_success 'update git module' ' ' +test_expect_success 'update cvs module' ' + + cd module-cvs && + echo 1 >tick && + cvs add tick && + cvs commit -m 1 + cd .. + +' + +test_expect_success 'cvsimport.module config works' ' + + cd module-git && + git config cvsimport.module module && + git cvsimport -a -z0 && + git merge origin && + cd .. && + git diff module-cvs/tick module-git/tick + +' + test_done -- cgit v1.2.3 From 10455d2a955a29db1809be139177e4e298771eb0 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Fri, 30 Nov 2007 11:35:23 +0000 Subject: Replace the word 'update-cache' by 'update-index' everywhere Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- t/t4000-diff-format.sh | 2 +- t/t4001-diff-rename.sh | 2 +- t/t4100/t-apply-1.patch | 2 +- t/t4100/t-apply-2.patch | 2 +- t/t4100/t-apply-5.patch | 2 +- t/t4100/t-apply-6.patch | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 't') diff --git a/t/t4000-diff-format.sh b/t/t4000-diff-format.sh index 7d92ae3e99..c44b27aeb2 100755 --- a/t/t4000-diff-format.sh +++ b/t/t4000-diff-format.sh @@ -16,7 +16,7 @@ cat path0 >path1 chmod +x path1 test_expect_success \ - 'update-cache --add two files with and without +x.' \ + 'update-index --add two files with and without +x.' \ 'git update-index --add path0 path1' mv path0 path0- diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh index 063e79257a..2fe50bc7ce 100755 --- a/t/t4001-diff-rename.sh +++ b/t/t4001-diff-rename.sh @@ -27,7 +27,7 @@ Line 15 ' test_expect_success \ - 'update-cache --add a file.' \ + 'update-index --add a file.' \ 'git update-index --add path0' test_expect_success \ diff --git a/t/t4100/t-apply-1.patch b/t/t4100/t-apply-1.patch index de587517f4..90ab54f0f5 100644 --- a/t/t4100/t-apply-1.patch +++ b/t/t4100/t-apply-1.patch @@ -90,7 +90,7 @@ diff --git a/Documentation/git.txt b/Documentation/git.txt diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile -@@ -30,7 +30,7 @@ PROG= git-update-cache git-diff-files +@@ -30,7 +30,7 @@ PROG= git-update-index git-diff-files git-checkout-cache git-diff-tree git-rev-tree git-ls-files \ git-check-files git-ls-tree git-merge-base git-merge-cache \ git-unpack-file git-export git-diff-cache git-convert-cache \ diff --git a/t/t4100/t-apply-2.patch b/t/t4100/t-apply-2.patch index cfdc80885b..f5c7d601fc 100644 --- a/t/t4100/t-apply-2.patch +++ b/t/t4100/t-apply-2.patch @@ -9,7 +9,7 @@ diff --git a/Makefile b/Makefile - git-deltafy-script + git-deltafy-script git-fetch-script - PROG= git-update-cache git-diff-files git-init-db git-write-tree \ + PROG= git-update-index git-diff-files git-init-db git-write-tree \ git-read-tree git-commit-tree git-cat-file git-fsck-cache \ diff --git a/git-pull-script b/git-fetch-script similarity index 87% diff --git a/t/t4100/t-apply-5.patch b/t/t4100/t-apply-5.patch index de11623d1b..5f6ddc1059 100644 --- a/t/t4100/t-apply-5.patch +++ b/t/t4100/t-apply-5.patch @@ -200,7 +200,7 @@ diff a/Documentation/git.txt b/Documentation/git.txt diff a/Makefile b/Makefile --- a/Makefile +++ b/Makefile -@@ -30,7 +30,7 @@ PROG= git-update-cache git-diff-files +@@ -30,7 +30,7 @@ PROG= git-update-index git-diff-files git-checkout-cache git-diff-tree git-rev-tree git-ls-files \ git-check-files git-ls-tree git-merge-base git-merge-cache \ git-unpack-file git-export git-diff-cache git-convert-cache \ diff --git a/t/t4100/t-apply-6.patch b/t/t4100/t-apply-6.patch index d9753637fc..a72729a712 100644 --- a/t/t4100/t-apply-6.patch +++ b/t/t4100/t-apply-6.patch @@ -8,7 +8,7 @@ diff a/Makefile b/Makefile - git-deltafy-script + git-deltafy-script git-fetch-script - PROG= git-update-cache git-diff-files git-init-db git-write-tree \ + PROG= git-update-index git-diff-files git-init-db git-write-tree \ git-read-tree git-commit-tree git-cat-file git-fsck-cache \ diff a/git-fetch-script b/git-fetch-script --- /dev/null -- cgit v1.2.3 From f01913e4190bed98f918ec575229943a0ee47d83 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 29 Nov 2007 20:59:55 +0000 Subject: Add "--expire