diff options
author | Jeff King <peff@peff.net> | 2017-02-23 03:17:08 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-02-23 12:58:47 -0800 |
commit | 94425552f308946456bb7823d0a1dd72ebd30bdd (patch) | |
tree | 84bb2ac31b5f4e405d77adf28a08806e36edc5a2 /t | |
parent | 13b9a24e58f736b70e48846cf7e5b7cfa66c3fec (diff) | |
download | git-94425552f308946456bb7823d0a1dd72ebd30bdd.tar.gz |
ident: do not ignore empty config name/emailjk/ident-empty
When we read user.name and user.email from a config file,
they go into strbufs. When a caller asks ident_default_name()
for the value, we fallback to auto-detecting if the strbuf
is empty.
That means that explicitly setting an empty string in the
config is identical to not setting it at all. This is
potentially confusing, as we usually accept a configured
value as the final value.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t7518-ident-corner-cases.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t7518-ident-corner-cases.sh b/t/t7518-ident-corner-cases.sh index 667f110f59..b22f631261 100755 --- a/t/t7518-ident-corner-cases.sh +++ b/t/t7518-ident-corner-cases.sh @@ -22,4 +22,15 @@ test_expect_success 'commit rejects all-crud name' ' git commit --allow-empty -m foo ' +# We must test the actual error message here, as an unwanted +# auto-detection could fail for other reasons. +test_expect_success 'empty configured name does not auto-detect' ' + ( + sane_unset GIT_AUTHOR_NAME && + test_must_fail \ + git -c user.name= commit --allow-empty -m foo 2>err && + test_i18ngrep "empty ident name" err + ) +' + test_done |