@matheusbsbs / matheus-bagliano / commits / 28a94f885a
Fork 0

Fall back to $EMAIL for missing GIT_AUTHOR_EMAIL and GIT_COMMITTER_EMAIL

Some other programs get the user's email address from $EMAIL, so fall back to that if we don't have a Git-specific email address. Signed-off-by: Josh Triplett <josh@freedesktop.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Josh Triplett committed Apr 28, 2007 at 18:40 UTC 28a94f885a735e7474357698ec384de24d526620
5 files changed +7 -2
Documentation/config.txt
+2 -2
@@ -610,8 +610,8 @@ tar.umask::
610
611 user.email::
612 Your email address to be recorded in any newly created commits.
613 - Can be overridden by the 'GIT_AUTHOR_EMAIL' and 'GIT_COMMITTER_EMAIL'
614 - environment variables. See gitlink:git-commit-tree[1].
613 + Can be overridden by the 'GIT_AUTHOR_EMAIL', 'GIT_COMMITTER_EMAIL', and
614 + 'EMAIL' environment variables. See gitlink:git-commit-tree[1].
615
616 user.name::
617 Your full name to be recorded in any newly created commits.
Documentation/git-commit-tree.txt
+1
@@ -61,6 +61,7 @@ either `.git/config` file, or using the following environment variables.
61 GIT_COMMITTER_NAME
62 GIT_COMMITTER_EMAIL
63 GIT_COMMITTER_DATE
64 + EMAIL
65
66 (nb "<", ">" and "\n"s are stripped)
67
Documentation/git.txt
+1
@@ -345,6 +345,7 @@ git Commits
345 'GIT_COMMITTER_NAME'::
346 'GIT_COMMITTER_EMAIL'::
347 'GIT_COMMITTER_DATE'::
348 +'EMAIL'::
349 see gitlink:git-commit-tree[1]
350
351 git Diffs
ident.c
+2
@@ -195,6 +195,8 @@ const char *fmt_ident(const char *name, const char *email,
195 setup_ident();
196 if (!name)
197 name = git_default_name;
198 + if (!email)
199 + email = getenv("EMAIL");
200 if (!email)
201 email = git_default_email;
202
t/test-lib.sh
+1
@@ -16,6 +16,7 @@ unset AUTHOR_EMAIL
16 unset AUTHOR_NAME
17 unset COMMIT_AUTHOR_EMAIL
18 unset COMMIT_AUTHOR_NAME
19 +unset EMAIL
20 unset GIT_ALTERNATE_OBJECT_DIRECTORIES
21 unset GIT_AUTHOR_DATE
22 GIT_AUTHOR_EMAIL=author@example.com