@matheusbsbs / matheus-bagliano / commits / 5aeb3a3a83
Fork 0

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:54 UTC 5aeb3a3a838b2cb03d250f3376cf9c41f4d4608e
3 files changed +11 -1
builtin-commit.c
+1 -1
@@ -624,7 +624,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
624 author_ident);
625 free(author_ident);
626
627 - if (user_ident_explicitly_given != IDENT_ALL_GIVEN)
627 + if (!user_ident_sufficiently_given())
628 fprintf(fp,
629 "%s"
630 "# Committer: %s\n",
cache.h
+1
@@ -929,6 +929,7 @@ extern char git_default_name[MAX_GITNAME];
929 #define IDENT_MAIL_GIVEN 02
930 #define IDENT_ALL_GIVEN (IDENT_NAME_GIVEN|IDENT_MAIL_GIVEN)
931 extern int user_ident_explicitly_given;
932 +extern int user_ident_sufficiently_given(void);
933
934 extern const char *git_commit_encoding;
935 extern const char *git_log_output_encoding;
ident.c
+9
@@ -259,3 +259,12 @@ 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 +#ifndef WINDOWS
266 + return (user_ident_explicitly_given & IDENT_MAIL_GIVEN);
267 +#else
268 + return (user_ident_explicitly_given == IDENT_ALL_GIVEN);
269 +#endif
270 +}