Skip to content

Commit

Permalink
Merge branch 'mh/fetch-into-shallow' into maint
Browse files Browse the repository at this point in the history
* mh/fetch-into-shallow:
  t5500: add test for fetching with an unknown 'shallow'
  upload-pack: ignore 'shallow' lines with unknown obj-ids
  • Loading branch information
Junio C Hamano committed Jun 27, 2013
2 parents 11fbc0b + 71d5f93 commit 0fb2c97
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
3 changes: 1 addition & 2 deletions Documentation/technical/pack-protocol.txt
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,7 @@ obtained through ref discovery.
The client MUST write all obj-ids which it only has shallow copies
of (meaning that it does not have the parents of a commit) as
'shallow' lines so that the server is aware of the limitations of
the client's history. Clients MUST NOT mention an obj-id which
it does not know exists on the server.
the client's history.

The client now sends the maximum commit history depth it wants for
this transaction, which is the number of commits it wants from the
Expand Down
14 changes: 14 additions & 0 deletions t/t5500-fetch-pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,20 @@ test_expect_success 'clone shallow with packed refs' '
test_cmp count8.expected count8.actual
'

test_expect_success 'fetch in shallow repo unreachable shallow objects' '
(
git clone --bare --branch B --single-branch "file://$(pwd)/." no-reflog &&
git clone --depth 1 "file://$(pwd)/no-reflog" shallow9 &&
cd no-reflog &&
git tag -d TAGB1 TAGB2 &&
git update-ref refs/heads/B B~~ &&
git gc --prune=now &&
cd ../shallow9 &&
git fetch origin &&
git fsck --no-dangling
)
'

test_expect_success 'setup tests for the --stdin parameter' '
for head in C D E F
do
Expand Down
2 changes: 1 addition & 1 deletion upload-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ static void receive_needs(void)
die("invalid shallow line: %s", line);
object = parse_object(sha1);
if (!object)
die("did not find object for %s", line);
continue;
if (object->type != OBJ_COMMIT)
die("invalid shallow object %s", sha1_to_hex(sha1));
if (!(object->flags & CLIENT_SHALLOW)) {
Expand Down

0 comments on commit 0fb2c97

Please sign in to comment.