Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2006-10-30 22:09:53 +0300
committerJunio C Hamano <junkio@cox.net>2006-11-25 02:42:49 +0300
commitf53514bc2d82f2f5cc7b447575e74aa266ed46f0 (patch)
tree66550c439e27a793cce8d1cee474620d54e81bc1 /fetch-pack.c
parent016e6ccbe03438454777e43dd73d67844296a3fd (diff)
allow deepening of a shallow repository
Now, by saying "git fetch -depth <n> <repo>" you can deepen a shallow repository. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'fetch-pack.c')
-rw-r--r--fetch-pack.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index f335bd42b7..c3064b94ad 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -202,7 +202,17 @@ static int find_common(int fd[2], unsigned char *result_sha1,
if (lookup_object(sha1))
continue;
register_shallow(sha1);
- }
+ } else if (!strncmp("unshallow ", line, 10)) {
+ if (get_sha1_hex(line + 10, sha1))
+ die("invalid unshallow line: %s", line);
+ if (!lookup_object(sha1))
+ die("object not found: %s", line);
+ /* make sure that it is parsed as shallow */
+ parse_object(sha1);
+ if (unregister_shallow(sha1))
+ die("no shallow found: %s", line);
+ } else
+ die("expected shallow/unshallow, got %s", line);
}
}
@@ -391,9 +401,11 @@ static int everything_local(struct ref **refs, int nr_match, char **match)
}
}
- for_each_ref(mark_complete, NULL);
- if (cutoff)
- mark_recent_complete_commits(cutoff);
+ if (!depth) {
+ for_each_ref(mark_complete, NULL);
+ if (cutoff)
+ mark_recent_complete_commits(cutoff);
+ }
/*
* Mark all complete remote refs as common refs.
@@ -646,8 +658,6 @@ int main(int argc, char **argv)
}
if (!dest)
usage(fetch_pack_usage);
- if (is_repository_shallow() && depth > 0)
- die("Deepening of a shallow repository not yet supported!");
pid = git_connect(fd, dest, exec);
if (pid < 0)
return 1;