git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Kraai <kraai@ftbfs.org>
To: git@vger.kernel.org
Cc: Matt Kraai <kraai@ftbfs.org>
Subject: [PATCH] Prefer EMAIL to username@hostname.
Date: Thu,  5 Jul 2007 17:29:41 -0700	[thread overview]
Message-ID: <11836817811266-git-send-email-kraai@ftbfs.org> (raw)

Signed-off-by: Matt Kraai <kraai@ftbfs.org>
---
 ident.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/ident.c b/ident.c
index 3d49608..6612d17 100644
--- a/ident.c
+++ b/ident.c
@@ -83,11 +83,18 @@ static void setup_ident(void)
 	}
 
 	if (!git_default_email[0]) {
-		if (!pw)
-			pw = getpwuid(getuid());
-		if (!pw)
-			die("You don't exist. Go away!");
-		copy_email(pw);
+		const char *email = getenv("EMAIL");
+
+		if (email && email[0])
+			strlcpy(git_default_email, email,
+				sizeof(git_default_email));
+		else {
+			if (!pw)
+				pw = getpwuid(getuid());
+			if (!pw)
+				die("You don't exist. Go away!");
+			copy_email(pw);
+		}
 	}
 
 	/* And set the default date */
@@ -197,8 +204,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.2.3

                 reply	other threads:[~2007-07-06  0:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11836817811266-git-send-email-kraai@ftbfs.org \
    --to=kraai@ftbfs.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).