OSDN Git Service
(root)
/
git-core
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Git 1.7.0.1
[git-core/git.git]
/
ident.c
diff --git
a/ident.c
b/ident.c
index
26409b2
..
9e24388
100644
(file)
--- a/
ident.c
+++ b/
ident.c
@@
-85,10
+85,11
@@
static void setup_ident(void)
if (!git_default_email[0]) {
const char *email = getenv("EMAIL");
if (!git_default_email[0]) {
const char *email = getenv("EMAIL");
- if (email && email[0])
+ if (email && email[0])
{
strlcpy(git_default_email, email,
sizeof(git_default_email));
strlcpy(git_default_email, email,
sizeof(git_default_email));
- else {
+ user_ident_explicitly_given |= IDENT_MAIL_GIVEN;
+ } else {
if (!pw)
pw = getpwuid(getuid());
if (!pw)
if (!pw)
pw = getpwuid(getuid());
if (!pw)
@@
-168,8
+169,6
@@
static int copy(char *buf, size_t size, int offset, const char *src)
return offset;
}
return offset;
}
-static const char au_env[] = "GIT_AUTHOR_NAME";
-static const char co_env[] = "GIT_COMMITTER_NAME";
static const char *env_hint =
"\n"
"*** Please tell me who you are.\n"
static const char *env_hint =
"\n"
"*** Please tell me who you are.\n"
@@
-204,7
+203,7
@@
const char *fmt_ident(const char *name, const char *email,
if ((warn_on_no_name || error_on_no_name) &&
name == git_default_name && env_hint) {
if ((warn_on_no_name || error_on_no_name) &&
name == git_default_name && env_hint) {
- fp
rintf(stderr, env_hint, au_env, co_env
);
+ fp
uts(env_hint, stderr
);
env_hint = NULL; /* warn only once */
}
if (error_on_no_name)
env_hint = NULL; /* warn only once */
}
if (error_on_no_name)
@@
-251,11
+250,21
@@
const char *git_author_info(int flag)
const char *git_committer_info(int flag)
{
const char *git_committer_info(int flag)
{
- if (getenv("GIT_COMMITTER_NAME") &&
- getenv("GIT_COMMITTER_EMAIL"))
- user_ident_explicitly_given = 1;
+ if (getenv("GIT_COMMITTER_NAME"))
+ user_ident_explicitly_given |= IDENT_NAME_GIVEN;
+ if (getenv("GIT_COMMITTER_EMAIL"))
+ user_ident_explicitly_given |= IDENT_MAIL_GIVEN;
return fmt_ident(getenv("GIT_COMMITTER_NAME"),
getenv("GIT_COMMITTER_EMAIL"),
getenv("GIT_COMMITTER_DATE"),
flag);
}
return fmt_ident(getenv("GIT_COMMITTER_NAME"),
getenv("GIT_COMMITTER_EMAIL"),
getenv("GIT_COMMITTER_DATE"),
flag);
}
+
+int user_ident_sufficiently_given(void)
+{
+#ifndef WINDOWS
+ return (user_ident_explicitly_given & IDENT_MAIL_GIVEN);
+#else
+ return (user_ident_explicitly_given == IDENT_ALL_GIVEN);
+#endif
+}