summaryrefslogtreecommitdiff
path: root/clone-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-12-15 05:25:22 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-12-15 05:25:22 (GMT)
commit31ec6abf887ec95642cbe82fe61076e975494ab0 (patch)
treeb4568f377cecd823a5eeea8eadd1257ed193d908 /clone-pack.c
parent294c695d8cfbcf95a5c33fc6ba386f496964defb (diff)
downloadgit-31ec6abf887ec95642cbe82fe61076e975494ab0.zip
git-31ec6abf887ec95642cbe82fe61076e975494ab0.tar.gz
git-31ec6abf887ec95642cbe82fe61076e975494ab0.tar.bz2
clone-pack: make it usable for partial branch cloning.
clone-pack had some logic to accept subset of remote refs from the command line and clone from there. However, it was never used in practice and its problems were not found out so far. This commit changes the command to output the object names of refs to the standard output instead of making a clone of the remote repository when explicit <head> parameters are given; the output format is the same as fetch-pack. The traditional behaviour of cloning the whole repository by giving no explicit <head> parameters stays the same. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'clone-pack.c')
-rw-r--r--clone-pack.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/clone-pack.c b/clone-pack.c
index a99a95c..b5ce5d3 100644
--- a/clone-pack.c
+++ b/clone-pack.c
@@ -259,8 +259,17 @@ static int clone_pack(int fd[2], int nr_match, char **match)
status = clone_without_unpack(fd);
- if (!status)
- write_refs(refs);
+ if (!status) {
+ if (nr_match == 0)
+ write_refs(refs);
+ else
+ while (refs) {
+ printf("%s %s\n",
+ sha1_to_hex(refs->old_sha1),
+ refs->name);
+ refs = refs->next;
+ }
+ }
return status;
}