summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/Makefile8
-rwxr-xr-xt/diff-lib.sh10
-rwxr-xr-xt/t0000-basic.sh8
-rw-r--r--t/t1200-tutorial.sh160
-rwxr-xr-xt/t3300-funny-names.sh142
-rwxr-xr-xt/t4000-diff-format.sh3
-rwxr-xr-xt/t4001-diff-rename.sh3
-rwxr-xr-xt/t4004-diff-rename-symlink.sh3
-rwxr-xr-xt/t5000-tar-tree.sh6
-rwxr-xr-xt/t5300-pack-object.sh26
-rw-r--r--t/t5500-fetch-pack.sh136
-rwxr-xr-xt/t5501-old-fetch-and-upload.sh43
-rwxr-xr-xt/t6001-rev-list-merge-order.sh2
-rwxr-xr-xt/t6002-rev-list-bisect.sh2
-rwxr-xr-xt/t6003-rev-list-topo-order.sh2
-rwxr-xr-xt/test-lib.sh6
16 files changed, 539 insertions, 21 deletions
diff --git a/t/Makefile b/t/Makefile
index e71da7782e..5c76afff83 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -7,10 +7,16 @@
SHELL_PATH ?= $(SHELL)
TAR ?= $(TAR)
+# Shell quote;
+# Result of this needs to be placed inside ''
+shq = $(subst ','\'',$(1))
+# This has surrounding ''
+shellquote = '$(call shq,$(1))'
+
T = $(wildcard t[0-9][0-9][0-9][0-9]-*.sh)
all:
- @$(foreach t,$T,echo "*** $t ***"; $(SHELL_PATH) $t $(GIT_TEST_OPTS) || exit; )
+ @$(foreach t,$T,echo "*** $t ***"; $(call shellquote,$(SHELL_PATH)) $t $(GIT_TEST_OPTS) || exit; )
@rm -fr trash
clean:
diff --git a/t/diff-lib.sh b/t/diff-lib.sh
index a912f435aa..745a1b0311 100755
--- a/t/diff-lib.sh
+++ b/t/diff-lib.sh
@@ -29,7 +29,13 @@ compare_diff_raw_z () {
compare_diff_patch () {
# When heuristics are improved, the score numbers would change.
# Ignore them while comparing.
- sed -e '/^[dis]*imilarity index [0-9]*%$/d' <"$1" >.tmp-1
- sed -e '/^[dis]*imilarity index [0-9]*%$/d' <"$2" >.tmp-2
+ sed -e '
+ /^[dis]*imilarity index [0-9]*%$/d
+ /^index [0-9a-f]*\.\.[0-9a-f]/d
+ ' <"$1" >.tmp-1
+ sed -e '
+ /^[dis]*imilarity index [0-9]*%$/d
+ /^index [0-9a-f]*\.\.[0-9a-f]/d
+ ' <"$2" >.tmp-2
diff -u .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
}
diff --git a/t/t0000-basic.sh b/t/t0000-basic.sh
index bd940bd09b..dff7d69163 100755
--- a/t/t0000-basic.sh
+++ b/t/t0000-basic.sh
@@ -28,12 +28,12 @@ test_expect_success \
'.git/objects should be empty after git-init-db in an empty repo.' \
'cmp -s /dev/null should-be-empty'
-# also it should have 258 subdirectories; 256 fan-out, pack, and info.
-# 259 is counting "objects" itself
+# also it should have 2 subdirectories; no fan-out anymore, pack, and info.
+# 3 is counting "objects" itself
find .git/objects -type d -print >full-of-directories
test_expect_success \
- '.git/objects should have 258 subdirectories.' \
- 'test $(wc -l < full-of-directories) = 259'
+ '.git/objects should have 3 subdirectories.' \
+ 'test $(wc -l < full-of-directories) = 3'
################################################################
# Basics of the basics
diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh
new file mode 100644
index 0000000000..35db799edf
--- /dev/null
+++ b/t/t1200-tutorial.sh
@@ -0,0 +1,160 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Johannes Schindelin
+#
+
+test_description='Test git-rev-parse with different parent options'
+
+. ./test-lib.sh
+
+echo "Hello World" > hello
+echo "Silly example" > example
+
+git-update-index --add hello example
+
+test_expect_success 'blob' "test blob = \"$(git-cat-file -t 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
+diff --git a/hello b/hello
+index 557db03..263414f 100644
+--- a/hello
++++ b/hello
+@@ -1 +1,2 @@
+ 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 > diff.output
+test_expect_success 'git diff' 'cmp diff.expect diff.output'
+
+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)"
+
+test_expect_success 'commit' "test 'Committing initial tree 8988da15d077d4829fc51d8544c097def6644dbb' = \"$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)\""
+
+cat > whatchanged.expect << EOF
+diff-tree VARIABLE (from root)
+Author: VARIABLE
+Date: VARIABLE
+
+ Initial commit
+
+diff --git a/example b/example
+new file mode 100644
+index 0000000..f24c74a
+--- /dev/null
++++ b/example
+@@ -0,0 +1 @@
++Silly example
+diff --git a/hello b/hello
+new file mode 100644
+index 0000000..557db03
+--- /dev/null
++++ b/hello
+@@ -0,0 +1 @@
++Hello World
+EOF
+
+git-whatchanged -p --root | \
+ sed -e "1s/^\(.\{10\}\).\{40\}/\1VARIABLE/" \
+ -e "2,3s/^\(.\{8\}\).*$/\1VARIABLE/" \
+> 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'
+
+# TODO: test git-clone
+
+git checkout -b mybranch
+test_expect_success 'git checkout -b mybranch' 'cmp .git/refs/heads/master .git/refs/heads/mybranch'
+
+cat > branch.expect <<EOF
+ master
+* mybranch
+EOF
+
+git branch > branch.output
+test_expect_success 'git branch' 'cmp branch.expect branch.output'
+
+git checkout mybranch
+echo "Work, work, work" >>hello
+git commit -m 'Some work.' hello
+
+git checkout master
+
+echo "Play, play, play" >>hello
+echo "Lots of fun" >>example
+git commit -m 'Some fun.' hello example
+
+test_expect_failure 'git resolve now fails' 'git resolve HEAD mybranch "Merge work in mybranch"'
+
+cat > hello << EOF
+Hello World
+It's a new day for git
+Play, play, play
+Work, work, work
+EOF
+
+git commit -m 'Merged "mybranch" changes.' hello
+
+cat > show-branch.expect << EOF
+* [master] Merged "mybranch" changes.
+ ! [mybranch] Some work.
+--
++ [master] Merged "mybranch" changes.
+++ [mybranch] Some work.
+EOF
+
+git show-branch master mybranch > show-branch.output
+test_expect_success 'git show-branch' 'cmp show-branch.expect show-branch.output'
+
+git checkout mybranch
+
+cat > resolve.expect << EOF
+Updating from VARIABLE to VARIABLE.
+ example | 1 +
+ hello | 1 +
+ 2 files changed, 2 insertions(+), 0 deletions(-)
+EOF
+
+git resolve HEAD master "Merge upstream changes." | \
+ sed -e "1s/[0-9a-f]\{40\}/VARIABLE/g" > resolve.output
+test_expect_success 'git resolve' 'cmp resolve.expect resolve.output'
+
+cat > show-branch2.expect << EOF
+! [master] Merged "mybranch" changes.
+ * [mybranch] Merged "mybranch" changes.
+--
+++ [master] Merged "mybranch" changes.
+EOF
+
+git show-branch master mybranch > show-branch2.output
+test_expect_success 'git show-branch' 'cmp show-branch2.expect show-branch2.output'
+
+# TODO: test git fetch
+
+# TODO: test git push
+
+test_expect_success 'git repack' 'git repack'
+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/t3300-funny-names.sh b/t/t3300-funny-names.sh
new file mode 100755
index 0000000000..897c378422
--- /dev/null
+++ b/t/t3300-funny-names.sh
@@ -0,0 +1,142 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Junio C Hamano
+#
+
+test_description='Pathnames with funny characters.
+
+This test tries pathnames with funny characters in the working
+tree, index, and tree objects.
+'
+
+# since FAT/NTFS does not allow tabs in filenames, skip this test
+test "$(uname -o 2>/dev/null)" = Cygwin && exit 0
+
+. ./test-lib.sh
+
+p0='no-funny'
+p1='tabs and spaces'
+p2='just space'
+
+cat >"$p0" <<\EOF
+1. A quick brown fox jumps over the lazy cat, oops dog.
+2. A quick brown fox jumps over the lazy cat, oops dog.
+3. A quick brown fox jumps over the lazy cat, oops dog.
+EOF
+
+cat >"$p1" "$p0"
+echo 'Foo Bar Baz' >"$p2"
+
+echo 'just space
+no-funny' >expected
+test_expect_success 'git-ls-files no-funny' \
+ 'git-update-index --add "$p0" "$p2" &&
+ git-ls-files >current &&
+ diff -u expected current'
+
+t0=`git-write-tree`
+echo "$t0" >t0
+
+echo 'just space
+no-funny
+"tabs\tand spaces"' >expected
+test_expect_success 'git-ls-files with-funny' \
+ 'git-update-index --add "$p1" &&
+ git-ls-files >current &&
+ diff -u expected current'
+
+echo 'just space
+no-funny
+tabs and spaces' >expected
+test_expect_success 'git-ls-files -z with-funny' \
+ 'git-ls-files -z | tr \\0 \\012 >current &&
+ diff -u expected current'
+
+t1=`git-write-tree`
+echo "$t1" >t1
+
+echo 'just space
+no-funny
+"tabs\tand spaces"' >expected
+test_expect_success 'git-ls-tree with funny' \
+ 'git-ls-tree -r $t1 | sed -e "s/^[^ ]* //" >current &&
+ diff -u expected current'
+
+echo 'A "tabs\tand spaces"' >expected
+test_expect_success 'git-diff-index with-funny' \
+ 'git-diff-index --name-status $t0 >current &&
+ diff -u expected current'
+
+test_expect_success 'git-diff-tree with-funny' \
+ 'git-diff-tree --name-status $t0 $t1 >current &&
+ diff -u expected current'
+
+echo 'A
+tabs and spaces' >expected
+test_expect_success 'git-diff-index -z with-funny' \
+ 'git-diff-index -z --name-status $t0 | tr \\0 \\012 >current &&
+ diff -u expected current'
+
+test_expect_success 'git-diff-tree -z with-funny' \
+ 'git-diff-tree -z --name-status $t0 $t1 | tr \\0 \\012 >current &&
+ diff -u expected current'
+
+echo 'CNUM no-funny "tabs\tand spaces"' >expected
+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 &&
+ diff -u expected current'
+
+echo 'RNUM no-funny "tabs\tand spaces"' >expected
+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 &&
+ diff -u expected current'
+
+echo 'diff --git a/no-funny "b/tabs\tand spaces"
+similarity index NUM%
+rename from no-funny
+rename to "tabs\tand spaces"' >expected
+
+test_expect_success 'git-diff-tree delete with-funny' \
+ 'git-diff-index -M -p $t0 |
+ sed -e "s/index [0-9]*%/index NUM%/" >current &&
+ diff -u expected current'
+
+chmod +x "$p1"
+echo 'diff --git a/no-funny "b/tabs\tand spaces"
+old mode 100644
+new mode 100755
+similarity index NUM%
+rename from no-funny
+rename to "tabs\tand spaces"' >expected
+
+test_expect_success 'git-diff-tree delete with-funny' \
+ 'git-diff-index -M -p $t0 |
+ sed -e "s/index [0-9]*%/index NUM%/" >current &&
+ diff -u expected current'
+
+echo >expected ' "tabs\tand spaces"
+ 1 files changed, 0 insertions(+), 0 deletions(-)'
+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 &&
+ diff -u expected current'
+
+echo >expected ' no-funny
+ "tabs\tand spaces"
+ 2 files changed, 3 insertions(+), 3 deletions(-)'
+
+test_expect_success 'git-diff-tree delete with-funny applied' \
+ 'git-diff-index -p $t0 |
+ git-apply --stat | sed -e "s/|.*//" -e "s/ *\$//" >current &&
+ diff -u expected current'
+
+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 &&
+ diff -u expected current'
+
+test_done
diff --git a/t/t4000-diff-format.sh b/t/t4000-diff-format.sh
index f3b6330a9b..beb6d8f487 100755
--- a/t/t4000-diff-format.sh
+++ b/t/t4000-diff-format.sh
@@ -7,6 +7,7 @@ test_description='Test built-in diff output engine.
'
. ./test-lib.sh
+. ../diff-lib.sh
echo >path0 'Line 1
Line 2
@@ -48,6 +49,6 @@ EOF
test_expect_success \
'validate git-diff-files -p output.' \
- 'cmp -s current expected'
+ 'compare_diff_patch current expected'
test_done
diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh
index be47485682..2e3c20d6b9 100755
--- a/t/t4001-diff-rename.sh
+++ b/t/t4001-diff-rename.sh
@@ -7,6 +7,7 @@ test_description='Test rename detection in diff engine.
'
. ./test-lib.sh
+. ../diff-lib.sh
echo >path0 'Line 1
Line 2
@@ -61,6 +62,6 @@ EOF
test_expect_success \
'validate the output.' \
- 'diff -I "similarity.*" >/dev/null current expected'
+ 'compare_diff_patch current expected'
test_done
diff --git a/t/t4004-diff-rename-symlink.sh b/t/t4004-diff-rename-symlink.sh
index f59614ae25..a23aaa0a94 100755
--- a/t/t4004-diff-rename-symlink.sh
+++ b/t/t4004-diff-rename-symlink.sh
@@ -10,6 +10,7 @@ copy of symbolic links, but should not produce rename/copy followed
by an edit for them.
'
. ./test-lib.sh
+. ../diff-lib.sh
test_expect_success \
'prepare reference tree' \
@@ -61,6 +62,6 @@ EOF
test_expect_success \
'validate diff output' \
- 'diff -u current expected'
+ 'compare_diff_patch current expected'
test_done
diff --git a/t/t5000-tar-tree.sh b/t/t5000-tar-tree.sh
index 5dffb8e1e5..4db1bb1142 100755
--- a/t/t5000-tar-tree.sh
+++ b/t/t5000-tar-tree.sh
@@ -41,8 +41,8 @@ test_expect_success \
find a -type l | xargs git-update-index --add &&
treeid=`git-write-tree` &&
echo $treeid >treeid &&
- TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
- git-commit-tree $treeid </dev/null >.git/HEAD'
+ git-update-ref HEAD $(TZ=GMT GIT_COMMITTER_DATE="2005-05-27 22:00:00" \
+ git-commit-tree $treeid </dev/null)'
test_expect_success \
'git-tar-tree' \
@@ -59,7 +59,7 @@ test_expect_success \
test_expect_success \
'git-get-tar-commit-id' \
'git-get-tar-commit-id <b.tar >b.commitid &&
- diff .git/HEAD b.commitid'
+ diff .git/$(git-symbolic-ref HEAD) b.commitid'
test_expect_success \
'extract tar archive' \
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index bb62336f26..5b50536b54 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -49,7 +49,7 @@ test_expect_success \
git-unpack-objects <test-1-${packname_1}.pack"
unset GIT_OBJECT_DIRECTORY
-cd $TRASH/.git2
+cd "$TRASH/.git2"
test_expect_success \
'check unpack without delta' \
@@ -61,7 +61,7 @@ test_expect_success \
return 1
}
done'
-cd $TRASH
+cd "$TRASH"
test_expect_success \
'pack with delta' \
@@ -80,7 +80,7 @@ test_expect_success \
git-unpack-objects <test-2-${packname_2}.pack'
unset GIT_OBJECT_DIRECTORY
-cd $TRASH/.git2
+cd "$TRASH/.git2"
test_expect_success \
'check unpack with delta' \
'(cd ../.git && find objects -type f -print) |
@@ -91,7 +91,7 @@ test_expect_success \
return 1
}
done'
-cd $TRASH
+cd "$TRASH"
rm -fr .git2
mkdir .git2
@@ -165,4 +165,22 @@ test_expect_success \
:'
+test_expect_success \
+ 'build pack index for an existing pack' \
+ 'cp 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 &&
+ 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 &&
+
+ :'
+
test_done
diff --git a/t/t5500-fetch-pack.sh b/t/t5500-fetch-pack.sh
new file mode 100644
index 0000000000..0781bd287e
--- /dev/null
+++ b/t/t5500-fetch-pack.sh
@@ -0,0 +1,136 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Johannes Schindelin
+#
+
+test_description='Testing multi_ack pack fetching
+
+'
+. ./test-lib.sh
+
+# Test fetch-pack/upload-pack pair.
+
+# Some convenience functions
+
+function show_count () {
+ commit_count=$(($commit_count+1))
+ printf " %d\r" $commit_count
+}
+
+function add () {
+ local name=$1
+ local text="$@"
+ local branch=${name:0:1}
+ local parents=""
+
+ shift
+ while test $1; do
+ parents="$parents -p $1"
+ shift
+ done
+
+ echo "$text" > test.txt
+ 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)
+ export $name=$commit
+ echo $commit > .git/refs/heads/$branch
+ eval ${branch}TIP=$commit
+}
+
+function count_objects () {
+ ls .git/objects/??/* 2>>log2.txt | wc -l | tr -d " "
+}
+
+function test_expect_object_count () {
+ local message=$1
+ local count=$2
+
+ output="$(count_objects)"
+ test_expect_success \
+ "new object count $message" \
+ "test $count = $output"
+}
+
+function test_repack () {
+ local rep=$1
+
+ test_expect_success "repack && prune-packed in $rep" \
+ '(git-repack && git-prune-packed)2>>log.txt'
+}
+
+function pull_to_client () {
+ local number=$1
+ local heads=$2
+ local count=$3
+ local no_strict_count_check=$4
+
+ cd client
+ test_expect_success "$number pull" \
+ "git-fetch-pack -v .. $heads > log.txt 2>&1"
+ 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/${heads:0:1}
+ test_expect_success "fsck" 'git-fsck-objects --full > fsck.txt 2>&1'
+ test_expect_object_count "after $number pull" $count
+ pack_count=$(grep Packing log.txt|tr -dc "0-9")
+ test -z "$pack_count" && pack_count=0
+ if [ -z "$no_strict_count_check" ]; then
+ test_expect_success "minimal count" "test $count = $pack_count"
+ else
+ test $count != $pack_count && \
+ echo "WARNING: $pack_count objects transmitted, only $count of which were needed"
+ fi
+ cd ..
+}
+
+# Here begins the actual testing
+
+# A1 - ... - A20 - A21
+# \
+# B1 - B2 - .. - B70
+
+# client pulls A20, B1. Then tracks only B. Then pulls A.
+
+(
+ mkdir client &&
+ cd client &&
+ git-init-db 2>> log2.txt
+)
+
+add A1
+
+prev=1; cur=2; while [ $cur -le 10 ]; do
+ add A$cur $(eval echo \$A$prev)
+ prev=$cur
+ cur=$(($cur+1))
+done
+
+add B1 $A1
+
+echo $ATIP > .git/refs/heads/A
+echo $BTIP > .git/refs/heads/B
+git-symbolic-ref HEAD refs/heads/B
+
+pull_to_client 1st "B A" $((11*3))
+
+(cd client; test_repack client)
+
+add A11 $A10
+
+prev=1; cur=2; while [ $cur -le 65 ]; do
+ add B$cur $(eval echo \$B$prev)
+ prev=$cur
+ cur=$(($cur+1))
+done
+
+pull_to_client 2nd "B" $((64*3))
+
+(cd client; test_repack client)
+
+pull_to_client 3rd "A" $((1*3)) # old fails
+
+test_done
diff --git a/t/t5501-old-fetch-and-upload.sh b/t/t5501-old-fetch-and-upload.sh
new file mode 100755
index 0000000000..ada5130328
--- /dev/null
+++ b/t/t5501-old-fetch-and-upload.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# Copyright (c) 2005 Johannes Schindelin
+#
+
+# Test that the current fetch-pack/upload-pack plays nicely with
+# an old counterpart
+
+cd $(dirname $0) || exit 1
+
+tmp=$(mktemp /tmp/tmp-XXXXXXXX)
+
+retval=0
+
+if [ -z "$1" ]; then
+ list="fetch upload"
+else
+ list="$@"
+fi
+
+for i in $list; do
+ case "$i" in
+ fetch) pgm="old-git-fetch-pack"; replace="$pgm";;
+ upload) pgm="old-git-upload-pack"; replace="git-fetch-pack --exec=$pgm";;
+ both) pgm="old-git-upload-pack"; replace="old-git-fetch-pack --exec=$pgm";;
+ esac
+
+ if which $pgm 2>/dev/null; then
+ echo "Testing with $pgm"
+ sed -e "s/git-fetch-pack/$replace/g" \
+ -e "s/# old fails/warn/" < t5500-fetch-pack.sh > $tmp
+
+ sh $tmp || retval=$?
+ rm $tmp
+
+ test $retval != 0 && exit $retval
+ else
+ echo "Skipping test for $i, since I cannot find $pgm"
+ fi
+done
+
+exit 0
+
diff --git a/t/t6001-rev-list-merge-order.sh b/t/t6001-rev-list-merge-order.sh
index 0101242382..8ec9ebb98a 100755
--- a/t/t6001-rev-list-merge-order.sh
+++ b/t/t6001-rev-list-merge-order.sh
@@ -108,7 +108,7 @@ 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
-tag l5 > .git/HEAD
+git-update-ref HEAD $(tag l5)
test_expect_success 'rev-list has correct number of entries' 'git-rev-list HEAD | wc -l | tr -s " "' <<EOF
19
diff --git a/t/t6002-rev-list-bisect.sh b/t/t6002-rev-list-bisect.sh
index 42fcbc60ca..693de9b32d 100755
--- a/t/t6002-rev-list-bisect.sh
+++ b/t/t6002-rev-list-bisect.sh
@@ -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
-tag l5 > .git/HEAD
+git-update-ref HEAD $(tag l5)
# E
diff --git a/t/t6003-rev-list-topo-order.sh b/t/t6003-rev-list-topo-order.sh
index 88d14ee1a3..3c4c44c24d 100755
--- a/t/t6003-rev-list-topo-order.sh
+++ b/t/t6003-rev-list-topo-order.sh
@@ -77,7 +77,7 @@ 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
-tag l5 > .git/HEAD
+git-update-ref HEAD $(tag l5)
test_expect_success 'rev-list has correct number of entries' 'git-rev-list HEAD | wc -l | tr -s " "' <<EOF
19
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 3f8a6fe414..a8f239df8f 100755
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -164,4 +164,8 @@ test=trash
rm -fr "$test"
mkdir "$test"
cd "$test"
-git-init-db 2>/dev/null || error "cannot run git-init-db"
+git-init-db --template=../../templates/blt/ 2>/dev/null ||
+error "cannot run git-init-db"
+
+mv .git/hooks .git/hooks-disabled
+