Skip to content

Commit

Permalink
receive-pack: do not reuse old_sha1[] for other things
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Sep 15, 2014
1 parent 0e3c339 commit c09b71c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions builtin/receive-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit c09b71c

Please sign in to comment.