static void gen_message_id(char *dest, unsigned int length, char *base)
{
- const char *committer = git_committer_info(1);
+ const char *committer = git_committer_info(-1);
const char *email_start = strrchr(committer, '<');
const char *email_end = strrchr(committer, '>');
if(!email_start || !email_end || email_start > email_end - 1)
unsigned long approxidate(const char *);
extern int setup_ident(void);
-extern void ignore_missing_committer_name(void);
extern const char *git_author_info(int);
extern const char *git_committer_info(int);
email = git_default_email;
if (!*name) {
- if (name == git_default_name && env_hint) {
+ struct passwd *pw;
+
+ if (0 <= error_on_no_name &&
+ name == git_default_name && env_hint) {
fprintf(stderr, env_hint, au_env, co_env);
env_hint = NULL; /* warn only once, for "git-var -l" */
}
- if (error_on_no_name)
+ if (0 < error_on_no_name)
die("empty ident %s <%s> not allowed", name, email);
+ pw = getpwuid(getuid());
+ if (!pw)
+ die("You don't exist. Go away!");
+ strlcpy(git_default_name, pw->pw_name,
+ sizeof(git_default_name));
+ name = git_default_name;
}
strcpy(date, git_default_date);
getenv("GIT_COMMITTER_DATE"),
error_on_no_name);
}
-
-void ignore_missing_committer_name()
-{
- /* If we did not get a name from the user's gecos entry then
- * git_default_name is empty; so instead load the username
- * into it as a 'good enough for now' approximation of who
- * this user is.
- */
- if (!*git_default_name) {
- struct passwd *pw = getpwuid(getuid());
- if (!pw)
- die("You don't exist. Go away!");
- strlcpy(git_default_name, pw->pw_name, sizeof(git_default_name));
- }
-}
die("attempt to push into a shallow repository");
setup_ident();
- /* don't die if gecos is empty */
- ignore_missing_committer_name();
git_config(receive_pack_config);
if (0 <= transfer_unpack_limit)
lock->log_file, strerror(errno));
}
- committer = git_committer_info(1);
+ committer = git_committer_info(-1);
if (msg) {
maxlen = strlen(committer) + strlen(msg) + 2*40 + 5;
logrec = xmalloc(maxlen);