git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Nice error message for empty idents

From
Petr Baudis <pasky@suse.cz>
Date
Feb 18, 2006, 17:27 UTC
Message-ID
<20060218172731.GV31278@pasky.or.cz>
In-Reply-To
<7vzmkpqco1.fsf@assigned-by-dhcp.cox.net>

Dear diary, on Sat, Feb 18, 2006 at 09:44:14AM CET, I got a letter where Junio C Hamano <junkio@cox.net> said that...

Show 10 quoted lines
> It appears that some people who did not care about having bogus
> names in their own commit messages are bitten by the recent
> change to require a sane environment [*1*].
> 
> While it was a good idea to prevent people from using bogus
> names to create commits and doing sign-offs, the error message
> is not very informative.  This patch attempts to warn things
> upfront and hint people how to fix their environments.
> 
> Likes, dislikes, don't cares?

One dislike from me - you shouldn't care if you ain't gonna do it - it makes no sense to require valid gecos if you are never committing anything. Note that this "premature requirement" plague has already hit GIT - come on:

	$ git-rev-list --help
	fatal: Not a git repository

That's worse than CVS (which allows cvs --help cmd but not cvs cmd --help outside of a repository).

I agree that the error message itself is bad.
---
[PATCH] Nice error message for empty idents
Signed-off-by: Petr Baudis <pasky@suse.cz>

--- commit 19b5bda8f0301ed4b856c5cd9137637b89d95d30 tree 8f91bfd101c32f258c3d8cca467eb7be26d62b91 parent 8dcc626cd144b2c6eae2a299242bbbe905cb0059 author Petr Baudis <pasky@suse.cz> Sat, 18 Feb 2006 18:26:32 +0100 committer Petr Baudis <xpasky@machine.or.cz> Sat, 18 Feb 2006 18:26:32 +0100

 ident.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/ident.c b/ident.c
index 23b8cfc..c57ba5c 100644
--- a/ident.c
+++ b/ident.c
@@ -168,9 +168,10 @@ static const char *get_ident(const char 
 	if (!email)
 		email = git_default_email;
 
-	if (!*name || !*email)
-		die("empty ident %s <%s> not allowed",
-		    name, email);
+	if (!*name)
+		die("empty realname not allowed - please set a realname for your login or use GIT_AUTHOR_NAME");
+	if (!*email)
+		die("empty email not allowed - please set your GIT_AUTHOR_EMAIL to a non-empty value");
 
 	strcpy(date, git_default_date);
 	if (date_str)
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Of the 3 great composers Mozart tells us what it's like to be human,
Beethoven tells us what it's like to be Beethoven and Bach tells us
what it's like to be the universe.  -- Douglas Adams
Previous: Nicolas Vilz 'niv'Next: Junio C Hamano
Message 3 of 5 in “[RFC] empty ident?”
  1. Junio C HamanoFeb 18, 2006
  2. Nicolas Vilz 'niv'Feb 18, 2006
  3. Nice error message for empty identsPetr Baudis, Feb 18, 2006
  4. Junio C HamanoFeb 18, 2006
  5. Delay "empty ident" errors until they really matter.Junio C Hamano, Feb 19, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.