diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-04-08 13:23:25 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-04-08 13:23:25 -0700 |
commit | 22eee7f4554e777de93134c0ae06ee611bd570a4 (patch) | |
tree | ff7982688bc3eab633374f3ebdc53fb56abf3c03 /fetch-pack.c | |
parent | e6b971fcf5d85db821636f2d887cfaf204b32bda (diff) | |
parent | 4fe788b1b0ee6150173580d8fa70e7d5788cf7d3 (diff) | |
download | git-22eee7f4554e777de93134c0ae06ee611bd570a4.tar.gz |
Merge branch 'll/clone-reject-shallow'
"git clone --reject-shallow" option fails the clone as soon as we
notice that we are cloning from a shallow repository.
* ll/clone-reject-shallow:
builtin/clone.c: add --reject-shallow option
Diffstat (limited to 'fetch-pack.c')
-rw-r--r-- | fetch-pack.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/fetch-pack.c b/fetch-pack.c index c80eaee769..6e68276aa3 100644 --- a/fetch-pack.c +++ b/fetch-pack.c @@ -1113,9 +1113,11 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args, if (args->deepen) setup_alternate_shallow(&shallow_lock, &alternate_shallow_file, NULL); - else if (si->nr_ours || si->nr_theirs) + else if (si->nr_ours || si->nr_theirs) { + if (args->reject_shallow_remote) + die(_("source repository is shallow, reject to clone.")); alternate_shallow_file = setup_temporary_shallow(si->shallow); - else + } else alternate_shallow_file = NULL; if (get_pack(args, fd, pack_lockfiles, NULL, sought, nr_sought, &fsck_options.gitmodules_found)) @@ -1483,10 +1485,12 @@ static void receive_shallow_info(struct fetch_pack_args *args, * rejected (unless --update-shallow is set); do the same. */ prepare_shallow_info(si, shallows); - if (si->nr_ours || si->nr_theirs) + if (si->nr_ours || si->nr_theirs) { + if (args->reject_shallow_remote) + die(_("source repository is shallow, reject to clone.")); alternate_shallow_file = setup_temporary_shallow(si->shallow); - else + } else alternate_shallow_file = NULL; } else { alternate_shallow_file = NULL; |