mirror of
https://github.com/git/git
synced 2024-08-25 02:35:46 +00:00
Merge branch 'mh/fetch-into-shallow'
"git fetch" into a shallow repository from a repository that does not know about the shallow boundary commits (e.g. a different fork from the repository the current shallow repository was cloned from) did not work correctly. * mh/fetch-into-shallow: t5500: add test for fetching with an unknown 'shallow' upload-pack: ignore 'shallow' lines with unknown obj-ids
This commit is contained in:
commit
305e19bdc3
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)) {
|
||||
|
|
Loading…
Reference in a new issue