]> granicus.if.org Git - git/commitdiff
receive-pack: do not reuse old_sha1[] for other things
authorJunio C Hamano <gitster@pobox.com>
Fri, 15 Aug 2014 21:26:17 +0000 (14:26 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Sep 2014 20:23:18 +0000 (13:23 -0700)
This piece of code reads object names of shallow boundaries, not
old_sha1[], i.e. the current value the ref points at, which is to be
replaced by what is in new_sha1[].

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/receive-pack.c

index a91eec8b1c3e1dfd955d370c112a7bd2010243bd..c9b92bffda22c1b5340c0a61a50f894d8e9dad5b 100644 (file)
@@ -847,9 +847,11 @@ static struct command *read_head_info(struct sha1_array *shallow)
                        break;
 
                if (len == 48 && starts_with(line, "shallow ")) {
-                       if (get_sha1_hex(line + 8, old_sha1))
-                               die("protocol error: expected shallow sha, got '%s'", line + 8);
-                       sha1_array_append(shallow, old_sha1);
+                       unsigned char sha1[20];
+                       if (get_sha1_hex(line + 8, sha1))
+                               die("protocol error: expected shallow sha, got '%s'",
+                                   line + 8);
+                       sha1_array_append(shallow, sha1);
                        continue;
                }