diff options
author | Junio C Hamano <gitster@pobox.com> | 2014-12-29 09:30:55 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-12-29 09:30:56 -0800 |
commit | cb71e73ade40500591d60f76fb4f6faae6a323a5 (patch) | |
tree | ac7da482e97efd31483f01a5e6e2291bae356007 /builtin | |
parent | Sync with maint (diff) | |
parent | update-ref: fix "verify" command with missing <oldvalue> (diff) | |
download | tgif-cb71e73ade40500591d60f76fb4f6faae6a323a5.tar.xz |
Merge branch 'mh/update-ref-verify'
"git update-ref --stdin"'s verify command did not work well when
<oldvalue>, which is documented as optional, was missing.
* mh/update-ref-verify:
update-ref: fix "verify" command with missing <oldvalue>
t1400: add some more tests of "update-ref --stdin"'s verify command
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/update-ref.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 6c9be05128..1993529521 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -282,26 +282,22 @@ static const char *parse_cmd_verify(struct ref_transaction *transaction, char *refname; unsigned char new_sha1[20]; unsigned char old_sha1[20]; - int have_old; refname = parse_refname(input, &next); if (!refname) die("verify: missing <ref>"); if (parse_next_sha1(input, &next, old_sha1, "verify", refname, - PARSE_SHA1_OLD)) { - hashclr(new_sha1); - have_old = 0; - } else { - hashcpy(new_sha1, old_sha1); - have_old = 1; - } + PARSE_SHA1_OLD)) + hashclr(old_sha1); + + hashcpy(new_sha1, old_sha1); if (*next != line_termination) die("verify %s: extra input: %s", refname, next); if (ref_transaction_update(transaction, refname, new_sha1, old_sha1, - update_flags, have_old, msg, &err)) + update_flags, 1, msg, &err)) die("%s", err.buf); update_flags = 0; |