summaryrefslogtreecommitdiff
path: root/fetch-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-04-08 20:23:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-04-08 20:23:25 (GMT)
commit22eee7f4554e777de93134c0ae06ee611bd570a4 (patch)
treeff7982688bc3eab633374f3ebdc53fb56abf3c03 /fetch-pack.c
parente6b971fcf5d85db821636f2d887cfaf204b32bda (diff)
parent4fe788b1b0ee6150173580d8fa70e7d5788cf7d3 (diff)
downloadgit-22eee7f4554e777de93134c0ae06ee611bd570a4.zip
git-22eee7f4554e777de93134c0ae06ee611bd570a4.tar.gz
git-22eee7f4554e777de93134c0ae06ee611bd570a4.tar.bz2
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.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index c80eaee..6e68276 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;