]> asedeno.scripts.mit.edu Git - git.git/blobdiff - ident.c
Merge branch 'master' of git://repo.or.cz/git-gui
[git.git] / ident.c
diff --git a/ident.c b/ident.c
index 88e7f74e888f1c7b13182bf07afee01408e8e525..6612d17eba1b2bac59689d4fd5e742df242662fc 100644 (file)
--- 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 */