upload-pack: remove packet debugging harness
If you set the GIT_DEBUG_SEND_PACK environment variable, upload-pack will dump lines it receives in the receive_needs phase to a descriptor. This debugging harness is a strict subset of what GIT_TRACE_PACKET can do. Let's just drop it in favor of that. A few tests used GIT_DEBUG_SEND_PACK to confirm which objects get sent; we have to adapt them to the new output format. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
e58e57e49e
commit
97a83fa839
@ -5,7 +5,7 @@ test_description='test automatic tag following'
|
||||
. ./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:
|
||||
@ -42,21 +42,26 @@ U=UPLOAD_LOG
|
||||
|
||||
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
|
||||
'
|
||||
|
||||
@ -74,10 +79,8 @@ test_expect_success NOT_MINGW "create tag T on A, create C on branch cat" '
|
||||
|
||||
test_expect_success NOT_MINGW 'setup expect' '
|
||||
cat - <<EOF >expect
|
||||
#S
|
||||
want $C
|
||||
want $T
|
||||
#E
|
||||
EOF
|
||||
'
|
||||
|
||||
@ -85,13 +88,12 @@ test_expect_success NOT_MINGW 'fetch C, T (new branch, tag : 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 $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
|
||||
'
|
||||
|
||||
@ -113,10 +115,8 @@ test_expect_success NOT_MINGW "create commits O, B, tag S on B" '
|
||||
|
||||
test_expect_success NOT_MINGW 'setup expect' '
|
||||
cat - <<EOF >expect
|
||||
#S
|
||||
want $B
|
||||
want $S
|
||||
#E
|
||||
EOF
|
||||
'
|
||||
|
||||
@ -124,22 +124,19 @@ test_expect_success NOT_MINGW 'fetch B, S (commit and tag : 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 $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
|
||||
'
|
||||
|
||||
@ -151,15 +148,14 @@ test_expect_success NOT_MINGW 'new clone fetch master and tags' '
|
||||
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
|
||||
'
|
||||
|
||||
|
@ -55,10 +55,10 @@ cd "$base_dir"
|
||||
rm -f "$U.D"
|
||||
|
||||
test_expect_success 'cloning with reference (no -l -s)' \
|
||||
'GIT_DEBUG_SEND_PACK=3 git clone --reference B "file://$(pwd)/A" D 3>"$U.D"'
|
||||
'GIT_TRACE_PACKET=3 git clone --reference B "file://$(pwd)/A" D 3>"$U.D"'
|
||||
|
||||
test_expect_success 'fetched no objects' \
|
||||
'! grep "^want" "$U.D"'
|
||||
'! grep " want" "$U.D"'
|
||||
|
||||
cd "$base_dir"
|
||||
|
||||
@ -173,12 +173,12 @@ test_expect_success 'fetch with incomplete alternates' '
|
||||
(
|
||||
cd K &&
|
||||
git remote add J "file://$base_dir/J" &&
|
||||
GIT_DEBUG_SEND_PACK=3 git fetch J 3>"$U.K"
|
||||
GIT_TRACE_PACKET=3 git fetch J 3>"$U.K"
|
||||
) &&
|
||||
master_object=$(cd A && git for-each-ref --format="%(objectname)" refs/heads/master) &&
|
||||
! grep "^want $master_object" "$U.K" &&
|
||||
! grep " want $master_object" "$U.K" &&
|
||||
tag_object=$(cd A && git for-each-ref --format="%(objectname)" refs/tags/HEAD) &&
|
||||
! grep "^want $tag_object" "$U.K"
|
||||
! grep " want $tag_object" "$U.K"
|
||||
'
|
||||
|
||||
test_done
|
||||
|
@ -42,7 +42,6 @@ static unsigned int timeout;
|
||||
* otherwise maximum packet size (up to 65520 bytes).
|
||||
*/
|
||||
static int use_sideband;
|
||||
static int debug_fd;
|
||||
static int advertise_refs;
|
||||
static int stateless_rpc;
|
||||
|
||||
@ -580,8 +579,6 @@ static void receive_needs(void)
|
||||
int has_non_tip = 0;
|
||||
|
||||
shallow_nr = 0;
|
||||
if (debug_fd)
|
||||
write_str_in_full(debug_fd, "#S\n");
|
||||
for (;;) {
|
||||
struct object *o;
|
||||
const char *features;
|
||||
@ -590,8 +587,6 @@ static void receive_needs(void)
|
||||
reset_timeout();
|
||||
if (!len)
|
||||
break;
|
||||
if (debug_fd)
|
||||
write_in_full(debug_fd, line, len);
|
||||
|
||||
if (!prefixcmp(line, "shallow ")) {
|
||||
unsigned char sha1[20];
|
||||
@ -653,8 +648,6 @@ static void receive_needs(void)
|
||||
add_object_array(o, NULL, &want_obj);
|
||||
}
|
||||
}
|
||||
if (debug_fd)
|
||||
write_str_in_full(debug_fd, "#E\n");
|
||||
|
||||
/*
|
||||
* We have sent all our refs already, and the other end
|
||||
@ -845,8 +838,6 @@ int main(int argc, char **argv)
|
||||
if (is_repository_shallow())
|
||||
die("attempt to fetch/clone from a shallow repository");
|
||||
git_config(upload_pack_config, NULL);
|
||||
if (getenv("GIT_DEBUG_SEND_PACK"))
|
||||
debug_fd = atoi(getenv("GIT_DEBUG_SEND_PACK"));
|
||||
upload_pack();
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user