summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 87b5054)
raw | patch | inline | side by side (parent: 87b5054)
author | Junio C Hamano <gitster@pobox.com> | |
Sun, 24 Apr 2011 05:34:13 +0000 (22:34 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 24 Apr 2011 05:34:43 +0000 (22:34 -0700) |
There is no need to duplicate the definition of $_z40 and $_x40 that
test-lib.sh supplies the test scripts.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
test-lib.sh supplies the test scripts.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 files changed:
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 54ba3df95f66ecc060adaec6846877c793016aa1..6b3991576538034b0ba2907130a1a35ced71610e 100755 (executable)
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
test_description='Test git update-ref and basic ref logging'
. ./test-lib.sh
-Z=0000000000000000000000000000000000000000
+Z=$_z40
test_expect_success setup '
diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh
index 2c8f01f6684cbe492132575209f79371ad761d87..dc7c99257ce15102a8f5c9986e17599aeb9d1ca0 100755 (executable)
--- a/t/t1501-worktree.sh
+++ b/t/t1501-worktree.sh
EMPTY_TREE=$(git write-tree) &&
EMPTY_BLOB=$(git hash-object -t blob --stdin </dev/null) &&
CHANGED_BLOB=$(echo changed | git hash-object -t blob --stdin) &&
- ZEROES=0000000000000000000000000000000000000000 &&
EMPTY_BLOB7=$(echo $EMPTY_BLOB | sed "s/\(.......\).*/\1/") &&
CHANGED_BLOB7=$(echo $CHANGED_BLOB | sed "s/\(.......\).*/\1/") &&
test_expect_success 'diff-index respects work tree under .git dir' '
cat >diff-index-cached.expected <<-EOF &&
- :000000 100644 $ZEROES $EMPTY_BLOB A sub/dir/tracked
+ :000000 100644 $_z40 $EMPTY_BLOB A sub/dir/tracked
EOF
cat >diff-index.expected <<-EOF &&
- :000000 100644 $ZEROES $ZEROES A sub/dir/tracked
+ :000000 100644 $_z40 $_z40 A sub/dir/tracked
EOF
(
test_expect_success 'diff-files respects work tree under .git dir' '
cat >diff-files.expected <<-EOF &&
- :100644 100644 $EMPTY_BLOB $ZEROES M sub/dir/tracked
+ :100644 100644 $EMPTY_BLOB $_z40 M sub/dir/tracked
EOF
(
index 15ebdc26ebaaf7881b1f51eb788c2eb2922b6d4f..300f8bf25c34cf4ea4e011d1daa525285ca94c5a 100755 (executable)
'
test_expect_success 'checkout master from invalid HEAD' '
- echo 0000000000000000000000000000000000000000 >.git/HEAD &&
+ echo $_z40 >.git/HEAD &&
git checkout master --
'
index 2e8f70245204bd4dc78e67f227e86838e1cdad5b..954fc51e5b560af918661a0ee051521a43f4efba 100755 (executable)
. ./test-lib.sh
-_z40=0000000000000000000000000000000000000000
-
test_expect_success setup '
>xyzzy &&
_empty=$(git hash-object --stdin <xyzzy) &&
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index f54a533456d74a3eb2f745dbc77c8ad5a5ae960f..4c4cff19634546d37b956dadbe9306db15ecbde4 100755 (executable)
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
'git branch a/b/c && test -f .git/refs/heads/a/b/c'
cat >expect <<EOF
-0000000000000000000000000000000000000000 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
+$_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
EOF
test_expect_success \
'git branch -l d/e/f should create a branch and a log' \
# Keep this test last, as it changes the current branch
cat >expect <<EOF
-0000000000000000000000000000000000000000 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
+$_z40 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master
EOF
test_expect_success \
'git checkout -b g/h/i -l should create a branch and a log' \
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
index b26cabd571503696a2bfa356e4f6ac46febf74ba..66523bd8ba95b6075a06cb668e1eb5b0a0eff9f1 100755 (executable)
--- a/t/t3600-rm.sh
+++ b/t/t3600-rm.sh
test_expect_success 'choking "git rm" should not let it die with cruft' '
git reset -q --hard &&
- H=0000000000000000000000000000000000000000 &&
i=0 &&
while test $i -lt 12000
do
- echo "100644 $H 0 some-file-$i"
+ echo "100644 $_z40 0 some-file-$i"
i=$(( $i + 1 ))
done | git update-index --index-info &&
git rm -n "some-file-*" | :;
diff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh
index 73441a516572dcf826582c04f3fe9d3ad0c1a88c..66e1a52c6c2fe351c0e30bfc07c7adeb4f0ff3ba 100755 (executable)
--- a/t/t4002-diff-basic.sh
+++ b/t/t4002-diff-basic.sh
:100644 100644 3fdbe17fd013303a2e981e1ca1c6cd6e72789087 7e09d6a3a14bd630913e8c75693cea32157b606d M Z/NM
EOF
-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"
-z40='0000000000000000000000000000000000000000'
cmp_diff_files_output () {
# diff-files never reports additions. Also it does not fill in the
# object ID for the changed files because it wants you to look at the
# filesystem.
sed <"$2" >.test-tmp \
- -e '/^:000000 /d;s/'$x40'\( [MCRNDU][0-9]*\) /'$z40'\1 /' &&
+ -e '/^:000000 /d;s/'$_x40'\( [MCRNDU][0-9]*\) /'$_z40'\1 /' &&
test_cmp "$1" .test-tmp
}
index a7602cf923d95a51643753ce44fa65cf406aba9c..083f62d1d6bb6bfd908b0a03db1a47f80071ef91 100755 (executable)
--- a/t/t4020-diff-external.sh
+++ b/t/t4020-diff-external.sh
. ./test-lib.sh
-_z40=0000000000000000000000000000000000000000
-
test_expect_success setup '
test_tick &&
index d99814ac641c93383d7199f4419083bedcfc9ea8..fbe44a3271acb1a82eb9a62640d0e221b417d608 100755 (executable)
. ./test-lib.sh
. "$TEST_DIRECTORY"/diff-lib.sh
-_z40=0000000000000000000000000000000000000000
test_expect_success setup '
test_tick &&
test_create_repo sub &&
index bb4066f76762520b98caeba1cddaf442d80a4bf2..8f3b54d826f5a9c8e7b08df7f6a58398b5a62480 100755 (executable)
EOF
NULL_SHA1=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
-ZERO_SHA0=0000000000000000000000000000000000000000
+
setup_absent() {
test -f 1 && rm 1
git update-index --remove 1 &&
test "$(git grep --no-ext-grep test)" = "1:test"
'
-echo ":000000 100644 $ZERO_SHA0 $NULL_SHA1 A 1" > expected
+echo ":000000 100644 $_z40 $NULL_SHA1 A 1" > expected
test_expect_success 'diff-index does not examine skip-worktree absent entries' '
setup_absent &&
git diff-index HEAD -- 1 > result &&
index 582d0b54f1f1a32459727e59932e95c4b466951f..d70fe2fe303c083f5cd0328758db9602e3af5381 100755 (executable)
'
NULL_SHA1=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
-ZERO_SHA0=0000000000000000000000000000000000000000
+
setup_absent() {
test -f 1 && rm 1
git update-index --remove 1 &&
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 830e5e7360350a424a2fe6016a03c913209f7557..7afa25fa835f4f5b0e1a18e3cf110296ea8ce948 100644 (file)
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
_x05='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
_x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x05$_x05"
+# Zero SHA-1
+_z40=0000000000000000000000000000000000000000
+
# Each test should start with something like this, after copyright notices:
#
# test_description='Description of this test...