summaryrefslogtreecommitdiff
path: root/fetch-pack.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2006-10-30 20:09:06 +0100
committerJunio C Hamano <junkio@cox.net>2006-11-24 15:42:49 -0800
commited09aef06fda2ba06a7412e3fa43ab1c3449f723 (patch)
treeae3de15cc0743c919e541f56a96082cf6c0b7cc8 /fetch-pack.c
parent9b8dc263e1b0d470cc67a824837d8884ae3e7136 (diff)
downloadgit-ed09aef06fda2ba06a7412e3fa43ab1c3449f723.tar.gz
support fetching into a shallow repository
A shallow commit is a commit which has parents, which in turn are "grafted away", i.e. the commit appears as if it were a root. Since these shallow commits should not be edited by the user, but only by core git, they are recorded in the file $GIT_DIR/shallow. A repository containing shallow commits is called shallow. The advantage of a shallow repository is that even if the upstream contains lots of history, your local (shallow) repository needs not occupy much disk space. The disadvantage is that you might miss a merge base when pulling some remote branch. 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.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fetch-pack.c b/fetch-pack.c
index 0a169dce85..bc5e725055 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -180,6 +180,8 @@ static int find_common(int fd[2], unsigned char *result_sha1,
packet_write(fd[1], "want %s\n", sha1_to_hex(remote));
fetching++;
}
+ if (is_repository_shallow())
+ write_shallow_commits(fd[1], 1);
packet_flush(fd[1]);
if (!fetching)
return 1;
@@ -523,6 +525,8 @@ static int fetch_pack(int fd[2], int nr_match, char **match)
int status;
get_remote_heads(fd[0], &ref, 0, NULL, 0);
+ if (is_repository_shallow() && !server_supports("shallow"))
+ die("Server does not support shallow clients");
if (server_supports("multi_ack")) {
if (verbose)
fprintf(stderr, "Server supports multi_ack\n");