. ./test-lib.sh
if ! test_have_prereq NOT_MINGW; then
- say "GIT_DEBUG_SEND_PACK not supported - skipping tests"
+ say "GIT_TRACE_PACKET not supported - skipping tests"
fi
# End state of the repository:
test_expect_success NOT_MINGW 'setup expect' '
cat - <<EOF >expect
-#S
want $A
-#E
EOF
'
+get_needs () {
+ perl -alne '
+ next unless $F[1] eq "upload-pack<";
+ last if $F[2] eq "0000";
+ print $F[2], " ", $F[3];
+ ' "$@"
+}
+
test_expect_success NOT_MINGW 'fetch A (new commit : 1 connection)' '
rm -f $U &&
(
cd cloned &&
- GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
+ GIT_TRACE_PACKET=3 git fetch 3>../$U &&
test $A = $(git rev-parse --verify origin/master)
) &&
- test -s $U &&
- cut -d" " -f1,2 $U >actual &&
+ get_needs $U >actual &&
test_cmp expect actual
'
test_expect_success NOT_MINGW 'setup expect' '
cat - <<EOF >expect
-#S
want $C
want $T
-#E
EOF
'
rm -f $U &&
(
cd cloned &&
- GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
+ GIT_TRACE_PACKET=3 git fetch 3>../$U &&
test $C = $(git rev-parse --verify origin/cat) &&
test $T = $(git rev-parse --verify tag1) &&
test $A = $(git rev-parse --verify tag1^0)
) &&
- test -s $U &&
- cut -d" " -f1,2 $U >actual &&
+ get_needs $U >actual &&
test_cmp expect actual
'
test_expect_success NOT_MINGW 'setup expect' '
cat - <<EOF >expect
-#S
want $B
want $S
-#E
EOF
'
rm -f $U &&
(
cd cloned &&
- GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
+ GIT_TRACE_PACKET=3 git fetch 3>../$U &&
test $B = $(git rev-parse --verify origin/master) &&
test $B = $(git rev-parse --verify tag2^0) &&
test $S = $(git rev-parse --verify tag2)
) &&
- test -s $U &&
- cut -d" " -f1,2 $U >actual &&
+ get_needs $U >actual &&
test_cmp expect actual
'
test_expect_success NOT_MINGW 'setup expect' '
cat - <<EOF >expect
-#S
want $B
want $S
-#E
EOF
'
cd clone2 &&
git init &&
git remote add origin .. &&
- GIT_DEBUG_SEND_PACK=3 git fetch 3>../$U &&
+ GIT_TRACE_PACKET=3 git fetch 3>../$U &&
test $B = $(git rev-parse --verify origin/master) &&
test $S = $(git rev-parse --verify tag2) &&
test $B = $(git rev-parse --verify tag2^0) &&
test $T = $(git rev-parse --verify tag1) &&
test $A = $(git rev-parse --verify tag1^0)
) &&
- test -s $U &&
- cut -d" " -f1,2 $U >actual &&
+ get_needs $U >actual &&
test_cmp expect actual
'