@matheusbsbs / matheus-bagliano / commits / 31ec6abf88
Fork 0

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>

Junio C Hamano committed Dec 14, 2005 at 21:25 UTC 31ec6abf887ec95642cbe82fe61076e975494ab0
2 files changed +16 -3
Documentation/git-clone-pack.txt
+5 -1
@@ -43,7 +43,11 @@ OPTIONS
43 The heads to update. This is relative to $GIT_DIR
44 (e.g. "HEAD", "refs/heads/master"). When unspecified,
45 all heads are updated to match the remote repository.
46 -
46 ++
47 +Usually all the refs from existing repository are stored
48 +under the same name in the new repository. Giving explicit
49 +<head> arguments instead writes the object names and refs to
50 +the standard output, just like get-fetch-pack does.
51
52 Author
53 ------
clone-pack.c
+11 -2
@@ -259,8 +259,17 @@ static int clone_pack(int fd[2], int nr_match, char **match)
259
260 status = clone_without_unpack(fd);
261
262 - if (!status)
263 - write_refs(refs);
262 + if (!status) {
263 + if (nr_match == 0)
264 + write_refs(refs);
265 + else
266 + while (refs) {
267 + printf("%s %s\n",
268 + sha1_to_hex(refs->old_sha1),
269 + refs->name);
270 + refs = refs->next;
271 + }
272 + }
273 return status;
274 }
275