ident: reject all-crud ident name
authorJeff King <peff@peff.net>
Thu, 23 Feb 2017 08:15:55 +0000 (03:15 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Feb 2017 20:47:02 +0000 (12:47 -0800)
commit13b9a24e58f736b70e48846cf7e5b7cfa66c3fec
tree19431a4ebf5037f3dc4cf32cc72602c3107dde74
parent862e80a413e45d34834ecd573e5c6b39e38ba850
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>
ident.c
t/t7518-ident-corner-cases.sh