Skip to content

Commit c09b71c

Browse files
committed
receive-pack: do not reuse old_sha1[] for other things
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 <[email protected]>
1 parent 0e3c339 commit c09b71c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

builtin/receive-pack.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,9 +847,11 @@ static struct command *read_head_info(struct sha1_array *shallow)
847847
break;
848848

849849
if (len == 48 && starts_with(line, "shallow ")) {
850-
if (get_sha1_hex(line + 8, old_sha1))
851-
die("protocol error: expected shallow sha, got '%s'", line + 8);
852-
sha1_array_append(shallow, old_sha1);
850+
unsigned char sha1[20];
851+
if (get_sha1_hex(line + 8, sha1))
852+
die("protocol error: expected shallow sha, got '%s'",
853+
line + 8);
854+
sha1_array_append(shallow, sha1);
853855
continue;
854856
}
855857

0 commit comments

Comments
 (0)