Skip to content

Commit

Permalink
parse_cmd_verify(): copy old_sha1 instead of evaluating <oldvalue> twice
Browse files Browse the repository at this point in the history
Aside from avoiding a tiny bit of work, this makes it transparently
obvious that old_sha1 and new_sha1 are identical.  It is arguably a
bit silly to have to set new_sha1 in order to verify old_sha1, but
that is a problem for another day.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Michael Haggerty authored and Junio C Hamano committed Apr 7, 2014
1 parent e23d843 commit 2f57736
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin/update-ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ static const char *parse_cmd_verify(struct strbuf *input, const char *next)

if (!parse_next_arg(input, &next, &value)) {
update_store_old_sha1(update, value.buf);
update_store_new_sha1(update, value.buf);
hashcpy(update->new_sha1, update->old_sha1);
} else if (!line_termination)
die("verify %s missing [<oldvalue>] NUL", ref.buf);

Expand Down

0 comments on commit 2f57736

Please sign in to comment.