[PATCH 13/26] update-ref --stdin: Simplify error messages for missing oldvalues

2014-03-10 Thread Michael Haggerty
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 mhag...@alum.mit.edu
---
 builtin/update-ref.c  | 6 +++---
 t/t1400-update-ref.sh | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/builtin/update-ref.c b/builtin/update-ref.c
index e4c0854..a9eb5fe 100644
--- a/builtin/update-ref.c
+++ b/builtin/update-ref.c
@@ -176,7 +176,7 @@ static const char *parse_cmd_update(struct strbuf *input, 
const char *next)
if (*next != line_termination)
die(update %s has extra input: %s, update-ref_name, 
next);
} else if (!line_termination)
-   die(update %s missing [oldvalue] NUL, update-ref_name);
+   die(update %s missing oldvalue, update-ref_name);
 
return next;
 }
@@ -222,7 +222,7 @@ static const char *parse_cmd_delete(struct strbuf *input, 
const char *next)
if (update-have_old  is_null_sha1(update-old_sha1))
die(delete %s given zero oldvalue, 
update-ref_name);
} else if (!line_termination)
-   die(delete %s missing [oldvalue] NUL, update-ref_name);
+   die(delete %s missing oldvalue, update-ref_name);
 
if (*next != line_termination)
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)
update_store_old_sha1(verify, update, value.buf);
hashcpy(update-new_sha1, update-old_sha1);
} else if (!line_termination)
-   die(verify %s missing [oldvalue] NUL, update-ref_name);
+   die(verify %s missing oldvalue, update-ref_name);
 
if (*next != line_termination)
die(verify %s has extra input: %s, update-ref_name, next);
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 3045ae7..42fec4e 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -739,7 +739,7 @@ test_expect_success 'stdin -z fails update with no new 
value' '
 test_expect_success 'stdin -z fails update with no old value' '
printf $F update $a $m stdin 
test_must_fail git update-ref -z --stdin stdin 2err 
-   grep fatal: update $a missing \\[oldvalue\\] NUL err
+   grep fatal: update $a missing oldvalue err
 '
 
 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' '
 test_expect_success 'stdin -z fails delete with no old value' '
printf $F delete $a stdin 
test_must_fail git update-ref -z --stdin stdin 2err 
-   grep fatal: delete $a missing \\[oldvalue\\] NUL err
+   grep fatal: delete $a missing oldvalue err
 '
 
 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' '
 test_expect_success 'stdin -z fails verify with no old value' '
printf $F verify $a stdin 
test_must_fail git update-ref -z --stdin stdin 2err 
-   grep fatal: verify $a missing \\[oldvalue\\] NUL err
+   grep fatal: verify $a missing oldvalue err
 '
 
 test_expect_success 'stdin -z fails option with unknown name' '
-- 
1.9.0

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 13/26] update-ref --stdin: Simplify error messages for missing oldvalues

2014-03-10 Thread Brad King
On 03/10/2014 01:08 PM, Brad King wrote:
 -die(update %s missing [oldvalue] NUL, update-ref_name);
 +die(update %s missing oldvalue, update-ref_name);
 
 The reason for the original wording is that the oldvalue is indeed
 optional.  This can only occur at end-of-input, and it is actually the
 *NUL* that is missing because an empty old value can be specified to
 mean that it it intentionally missing.

I see a following patch makes the wording even clearer about
unexpected end of input, so ignore my previous review.

-Brad

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 13/26] update-ref --stdin: Simplify error messages for missing oldvalues

2014-03-10 Thread Brad King
On 03/10/2014 08:46 AM, Michael Haggerty wrote:
 Instead of, for example,
 
 fatal: update refs/heads/master missing [oldvalue] NUL
 
 emit
 
 fatal: update refs/heads/master missing oldvalue
[snip]
 - die(update %s missing [oldvalue] NUL, update-ref_name);
 + die(update %s missing oldvalue, update-ref_name);

The reason for the original wording is that the oldvalue is indeed
optional.  This can only occur at end-of-input, and it is actually the
*NUL* that is missing because an empty old value can be specified to
mean that it it intentionally missing.

-Brad

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html