update-ref --stdin: simplify error messages for missing oldvalues

Instead of, for example, fatal: update refs/heads/master missing [<oldvalue>] NUL emit fatal: update refs/heads/master missing <oldvalue> Update the tests accordingly. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Apr 7, 2014 at 15:48 UTC ac1177553d8c632e93c507f8efc80b80e6c7d3d8
2 files changed +6 -6
builtin/update-ref.c
+3 -3
@@ -176,7 +176,7 @@ static const char *parse_cmd_update(struct strbuf *input, const char *next)
176 if (*next != line_termination)
177 die("update %s has extra input: %s", update->ref_name, next);
178 } else if (!line_termination)
179 - die("update %s missing [<oldvalue>] NUL", update->ref_name);
179 + die("update %s missing <oldvalue>", update->ref_name);
180
181 return next;
182 }
@@ -222,7 +222,7 @@ static const char *parse_cmd_delete(struct strbuf *input, const char *next)
222 if (update->have_old && is_null_sha1(update->old_sha1))
223 die("delete %s given zero <oldvalue>", update->ref_name);
224 } else if (!line_termination)
225 - die("delete %s missing [<oldvalue>] NUL", update->ref_name);
225 + die("delete %s missing <oldvalue>", update->ref_name);
226
227 if (*next != line_termination)
228 die("delete %s has extra input: %s", update->ref_name, next);
@@ -245,7 +245,7 @@ static const char *parse_cmd_verify(struct strbuf *input, const char *next)
245 update_store_old_sha1("verify", update, value.buf);
246 hashcpy(update->new_sha1, update->old_sha1);
247 } else if (!line_termination)
248 - die("verify %s missing [<oldvalue>] NUL", update->ref_name);
248 + die("verify %s missing <oldvalue>", update->ref_name);
249
250 if (*next != line_termination)
251 die("verify %s has extra input: %s", update->ref_name, next);
t/t1400-update-ref.sh
+3 -3
@@ -739,7 +739,7 @@ test_expect_success 'stdin -z fails update with no new value' '
739 test_expect_success 'stdin -z fails update with no old value' '
740 printf $F "update $a" "$m" >stdin &&
741 test_must_fail git update-ref -z --stdin <stdin 2>err &&
742 - grep "fatal: update $a missing \\[<oldvalue>\\] NUL" err
742 + grep "fatal: update $a missing <oldvalue>" err
743 '
744
745 test_expect_success 'stdin -z fails update with too many arguments' '
@@ -763,7 +763,7 @@ test_expect_success 'stdin -z fails delete with bad ref name' '
763 test_expect_success 'stdin -z fails delete with no old value' '
764 printf $F "delete $a" >stdin &&
765 test_must_fail git update-ref -z --stdin <stdin 2>err &&
766 - grep "fatal: delete $a missing \\[<oldvalue>\\] NUL" err
766 + grep "fatal: delete $a missing <oldvalue>" err
767 '
768
769 test_expect_success 'stdin -z fails delete with too many arguments' '
@@ -781,7 +781,7 @@ test_expect_success 'stdin -z fails verify with too many arguments' '
781 test_expect_success 'stdin -z fails verify with no old value' '
782 printf $F "verify $a" >stdin &&
783 test_must_fail git update-ref -z --stdin <stdin 2>err &&
784 - grep "fatal: verify $a missing \\[<oldvalue>\\] NUL" err
784 + grep "fatal: verify $a missing <oldvalue>" err
785 '
786
787 test_expect_success 'stdin -z fails option with unknown name' '