summaryrefslogtreecommitdiff
path: root/t/t7518-ident-corner-cases.sh
diff options
context:
space:
mode:
authorLibravatar Jeff King <peff@peff.net>2017-02-23 03:15:55 -0500
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-02-23 12:47:02 -0800
commit13b9a24e58f736b70e48846cf7e5b7cfa66c3fec (patch)
tree19431a4ebf5037f3dc4cf32cc72602c3107dde74 /t/t7518-ident-corner-cases.sh
parentident: handle NULL email when complaining of empty name (diff)
downloadtgif-13b9a24e58f736b70e48846cf7e5b7cfa66c3fec.tar.xz
ident: reject all-crud ident name
An ident name consisting of only "crud" characters (like whitespace or punctuation) is effectively the same as an empty one, because our strbuf_addstr_without_crud() will remove those characters. We reject an empty name when formatting a strict ident, but don't notice an all-crud one because our check happens before the crud-removal step. We could skip past the crud before checking for an empty name, but let's make it a separate code path, for two reasons. One is that we can give a more specific error message. And two is that unlike a blank name, we probably don't want to kick in the fallback-to-username behavior. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7518-ident-corner-cases.sh')
-rwxr-xr-xt/t7518-ident-corner-cases.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/t/t7518-ident-corner-cases.sh b/t/t7518-ident-corner-cases.sh
index 6c057afc11..667f110f59 100755
--- a/t/t7518-ident-corner-cases.sh
+++ b/t/t7518-ident-corner-cases.sh
@@ -17,4 +17,9 @@ test_expect_success 'empty name and missing email' '
)
'
+test_expect_success 'commit rejects all-crud name' '
+ test_must_fail env GIT_AUTHOR_NAME=" .;<>" \
+ git commit --allow-empty -m foo
+'
+
test_done