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

[PATCH] Prefer $EMAIL over auto-generated user@hostname.

From
Brandon Casey <casey@nrlssc.navy.mil>
Date
Jul 6, 2007, 16:14 UTC
Message-ID
<468E6A76.6060806@nrlssc.navy.mil>

This makes $EMAIL the second to last resort ahead of username@hostname rather than the last resort when GIT_AUTHOR_EMAIL or GIT_COMMITER_EMAIL and user.email are not set.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---
Alex Riesen wrote:
Show 8 quoted lines
> On 7/6/07, Brandon Casey <casey@nrlssc.navy.mil> wrote:
>>
>> Is the recommended tab stop 8 characters as it is for linux? or 4?
>>
> 
> Tab is always 8 spaces. It is indentation which can be 8, 4, 3, 2, and
> even 1.
> It is 8 in Git.
Here's an updated patch using tabs.
-brandon
 ident.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/ident.c b/ident.c
index 3d49608..be5efcd 100644
--- a/ident.c
+++ b/ident.c
@@ -73,6 +73,7 @@ static void copy_email(const struct passwd *pw)
 static void setup_ident(void)
 {
 	struct passwd *pw = NULL;
+	char *email;
 
 	/* Get the name ("gecos") */
 	if (!git_default_name[0]) {
@@ -82,6 +83,9 @@ static void setup_ident(void)
 		copy_gecos(pw, git_default_name, sizeof(git_default_name));
 	}
 
+	if (!git_default_email[0] && (email = getenv("EMAIL")) != NULL)
+		strlcpy(git_default_email, email, sizeof(git_default_email));
+
 	if (!git_default_email[0]) {
 		if (!pw)
 			pw = getpwuid(getuid());
@@ -197,8 +201,6 @@ const char *fmt_ident(const char *name, const char *email,
 		name = git_default_name;
 	if (!email)
 		email = git_default_email;
-	if (!email)
-		email = getenv("EMAIL");
 
 	if (!*name) {
 		struct passwd *pw;
-- 
1.5.3.rc0.30.g114f-dirty
Message 1 of 1 in “Prefer $EMAIL over auto-generated user@hostname.”
  1. Prefer $EMAIL over auto-generated user@hostname.Brandon Casey, Jul 6, 2007

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.