Skip to content

Commit 62bd0c0

Browse files
committed
Merge branch 'jk/peel-ref'
Recent optimization broke shallow clones. * jk/peel-ref: upload-pack: load non-tip "want" objects from disk upload-pack: make sure "want" objects are parsed upload-pack: drop lookup-before-parse optimization
2 parents 51ebd0f + f59de5d commit 62bd0c0

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

t/t5500-fetch-pack.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,15 @@ EOF
364364
test_cmp count7.expected count7.actual
365365
'
366366

367+
test_expect_success 'clone shallow with packed refs' '
368+
git pack-refs --all &&
369+
git clone --depth 1 --branch A "file://$(pwd)/." shallow8 &&
370+
echo "in-pack: 4" > count8.expected &&
371+
GIT_DIR=shallow8/.git git count-objects -v |
372+
grep "^in-pack" > count8.actual &&
373+
test_cmp count8.expected count8.actual
374+
'
375+
367376
test_expect_success 'setup tests for the --stdin parameter' '
368377
for head in C D E F
369378
do

upload-pack.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,9 +327,7 @@ static int got_sha1(char *hex, unsigned char *sha1)
327327
if (!has_sha1_file(sha1))
328328
return -1;
329329

330-
o = lookup_object(sha1);
331-
if (!(o && o->parsed))
332-
o = parse_object(sha1);
330+
o = parse_object(sha1);
333331
if (!o)
334332
die("oops (%s)", sha1_to_hex(sha1));
335333
if (o->type == OBJ_COMMIT) {
@@ -648,7 +646,7 @@ static void receive_needs(void)
648646
if (parse_feature_request(features, "include-tag"))
649647
use_include_tag = 1;
650648

651-
o = lookup_object(sha1_buf);
649+
o = parse_object(sha1_buf);
652650
if (!o)
653651
die("git upload-pack: not our ref %s",
654652
sha1_to_hex(sha1_buf));

0 commit comments

Comments
 (0)