mirror of
https://github.com/git/git.git
synced 2024-11-28 04:23:30 +08:00
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>
This commit is contained in:
parent
294c695d8c
commit
31ec6abf88
@ -43,7 +43,11 @@ OPTIONS
|
||||
The heads to update. This is relative to $GIT_DIR
|
||||
(e.g. "HEAD", "refs/heads/master"). When unspecified,
|
||||
all heads are updated to match the remote repository.
|
||||
|
||||
+
|
||||
Usually all the refs from existing repository are stored
|
||||
under the same name in the new repository. Giving explicit
|
||||
<head> arguments instead writes the object names and refs to
|
||||
the standard output, just like get-fetch-pack does.
|
||||
|
||||
Author
|
||||
------
|
||||
|
11
clone-pack.c
11
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)
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user