user_ident_sufficiently_given(): refactor the logic to be usable from elsewhere
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Jan 17, 2010 at 13:59 UTC
1a893064d7b403625896a2c8bdab39f0f7db61d5
3 files changed
+8
-2
builtin-commit.c
+2
-2
@@ -602,7 +602,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
602
author_ident);
603
free(author_ident);
604
605
- if (!user_ident_explicitly_given)
605
+ if (!user_ident_sufficiently_given())
606
fprintf(fp,
607
"%s"
608
"# Committer: %s\n",
@@ -991,7 +991,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
991
strbuf_addstr(&format, "\n Author: ");
992
strbuf_addbuf_percentquote(&format, &author_ident);
993
}
994
- if (!user_ident_explicitly_given) {
994
+ if (!user_ident_sufficiently_given()) {
995
strbuf_addstr(&format, "\n Committer: ");
996
strbuf_addbuf_percentquote(&format, &committer_ident);
997
if (advice_implicit_identity) {
cache.h
+1
@@ -926,6 +926,7 @@ extern const char *config_exclusive_filename;
926
extern char git_default_email[MAX_GITNAME];
927
extern char git_default_name[MAX_GITNAME];
928
extern int user_ident_explicitly_given;
929
+extern int user_ident_sufficiently_given(void);
930
931
extern const char *git_commit_encoding;
932
extern const char *git_log_output_encoding;
ident.c
+5
@@ -259,3 +259,8 @@ const char *git_committer_info(int flag)
259
getenv("GIT_COMMITTER_DATE"),
260
flag);
261
}
262
+
263
+int user_ident_sufficiently_given(void)
264
+{
265
+ return user_ident_explicitly_given;
266
+}