summaryrefslogtreecommitdiff
path: root/fetch-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2013-09-05 14:40:58 -0700
committerJunio C Hamano <gitster@pobox.com>2013-09-05 14:40:58 -0700
commit2ea3df68e881405940596b8c299921f681f8c22c (patch)
tree55a5973fe24539164e49fde425af6590822e5e6b /fetch-pack.c
parentbda790474690a5e5e9963221dc0d5b66fbf01875 (diff)
parent6da8bdcbbfd5ac9c4a92de79d7b4343d5d6bd4c5 (diff)
downloadgit-2ea3df68e881405940596b8c299921f681f8c22c.tar.gz
Merge branch 'nd/fetch-pack-shallow-fix' into maint
The recent "short-cut clone connectivity check" topic broke a shallow repository when a fetch operation tries to auto-follow tags. * nd/fetch-pack-shallow-fix: fetch-pack: do not remove .git/shallow file when --depth is not specified
Diffstat (limited to 'fetch-pack.c')
-rw-r--r--fetch-pack.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index 6684348c0e..f5d99c1181 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -897,6 +897,8 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args,
packet_flush(fd[1]);
if (args->depth > 0)
setup_alternate_shallow();
+ else
+ alternate_shallow_file = NULL;
if (get_pack(args, fd, pack_lockfile))
die("git fetch-pack: fetch failed.");
@@ -987,7 +989,7 @@ struct ref *fetch_pack(struct fetch_pack_args *args,
}
ref_cpy = do_fetch_pack(args, fd, ref, sought, nr_sought, pack_lockfile);
- if (alternate_shallow_file) {
+ if (args->depth > 0 && alternate_shallow_file) {
if (*alternate_shallow_file == '\0') { /* --unshallow */
unlink_or_warn(git_path("shallow"));
rollback_lock_file(&shallow_lock);