summaryrefslogtreecommitdiff
path: root/builtin/fetch-pack.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2013-12-05 13:02:49 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-12-11 00:14:18 (GMT)
commit58f2ed051fe9b966100d8c531a79200628490ec4 (patch)
tree79a84b42c929cf68e9a0ebfd37f722d0939fb326 /builtin/fetch-pack.c
parentb016918b2f283513758957b06a14eb2f5c2a9619 (diff)
downloadgit-58f2ed051fe9b966100d8c531a79200628490ec4.zip
git-58f2ed051fe9b966100d8c531a79200628490ec4.tar.gz
git-58f2ed051fe9b966100d8c531a79200628490ec4.tar.bz2
remote-curl: pass ref SHA-1 to fetch-pack as well
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/fetch-pack.c')
-rw-r--r--builtin/fetch-pack.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/builtin/fetch-pack.c b/builtin/fetch-pack.c
index 927424b..aa6e596 100644
--- a/builtin/fetch-pack.c
+++ b/builtin/fetch-pack.c
@@ -13,6 +13,13 @@ static void add_sought_entry_mem(struct ref ***sought, int *nr, int *alloc,
const char *name, int namelen)
{
struct ref *ref = xcalloc(1, sizeof(*ref) + namelen + 1);
+ unsigned char sha1[20];
+
+ if (namelen > 41 && name[40] == ' ' && !get_sha1_hex(name, sha1)) {
+ hashcpy(ref->old_sha1, sha1);
+ name += 41;
+ namelen -= 41;
+ }
memcpy(ref->name, name, namelen);
ref->name[namelen] = '\0';