parse_cmd_verify(): copy old_sha1 instead of evaluating <oldvalue> twice
authorMichael Haggerty <mhagger@alum.mit.edu>
Mon, 7 Apr 2014 13:47:59 +0000 (15:47 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 7 Apr 2014 19:09:12 +0000 (12:09 -0700)
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>
builtin/update-ref.c
index 5f197fe2122e79a5a40aa647dcb251ac8f1a0d03..51adf2dafae1d66281e5eb63dcb48b4292548d87 100644 (file)
@@ -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);