From 9ed104e5cacdc44f2fe7c2b1fdeada94622ca4e9 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 21 Aug 2020 13:36:28 -0700 Subject: ident: say whose identity is missing when giving user.name hint If `user.name` and `user.email` have not been configured and the user invokes: git commit --author=... without specifying the committer identity, then Git errors out with a message asking the user to configure `user.name` and `user.email` but doesn't tell the user which attribution was missing. This can be confusing for a user new to Git who isn't aware of the distinction between user, author, and committer. Give such users a bit more help by extending the error message to also say which attribution is expected. Signed-off-by: Junio C Hamano --- t/t7518-ident-corner-cases.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 't') diff --git a/t/t7518-ident-corner-cases.sh b/t/t7518-ident-corner-cases.sh index b22f631261..dc3e9c8c88 100755 --- a/t/t7518-ident-corner-cases.sh +++ b/t/t7518-ident-corner-cases.sh @@ -29,7 +29,18 @@ 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_i18ngrep "empty ident name" err && + test_i18ngrep "Author identity unknown" err + ) +' + +test_expect_success 'empty configured name does not auto-detect for committer' ' + ( + sane_unset GIT_COMMITTER_NAME && + test_must_fail \ + git -c user.name= commit --allow-empty -m foo 2>err && + test_i18ngrep "empty ident name" err && + test_i18ngrep "Committer identity unknown" err ) ' -- cgit v1.2.3