git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Prefer $EMAIL over auto-generated user@hostname.
@ 2007-07-06 15:03 Brandon Casey
  2007-07-06 15:11 ` Uwe Kleine-König
  0 siblings, 1 reply; 10+ messages in thread
From: Brandon Casey @ 2007-07-06 15:03 UTC (permalink / raw)
  To: torvalds, gitster; +Cc: mkraai, madcoder, git


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>
---

Linus Torvalds wrote:
>If you want it to prefer $EMAIL, you'd need to change the initialization 
>of git_default_email, methinks.

How about this?


 ident.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ident.c b/ident.c
index 3d49608..dc13510 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

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [PATCH] Prefer $EMAIL over auto-generated user@hostname.
@ 2007-07-06 16:14 Brandon Casey
  0 siblings, 0 replies; 10+ messages in thread
From: Brandon Casey @ 2007-07-06 16:14 UTC (permalink / raw)
  To: Alex Riesen
  Cc: Johannes Schindelin, Uwe Kleine-König, Linus Torvalds,
	Junio C Hamano, mkraai, madcoder, Git Mailing List

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:
> 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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-07-06 16:24 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-06 15:03 [PATCH] Prefer $EMAIL over auto-generated user@hostname Brandon Casey
2007-07-06 15:11 ` Uwe Kleine-König
2007-07-06 15:22   ` Brandon Casey
2007-07-06 15:32     ` Johannes Schindelin
2007-07-06 15:51       ` Brandon Casey
2007-07-06 15:59         ` Alex Riesen
2007-07-06 15:59           ` Vincent Hanquez
2007-07-06 16:22             ` Alex Riesen
2007-07-06 16:23               ` Alex Riesen
  -- strict thread matches above, loose matches on Subject: below --
2007-07-06 16:14 Brandon Casey

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).