@matheusbsbs / matheus-bagliano / commits / b706fcfe93
Fork 0

commit: allow suppression of implicit identity advice

We now nag the user with a giant warning when their identity was pulled from the username, hostname, and gecos information, in case it is not correct. Most users will suppress this by simply setting up their information correctly. However, there may be some users who consciously want to use that information, because having the value change from host to host contains useful information. These users can now set advice.implicitidentity to false to suppress the message. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jan 13, 2010 at 15:17 UTC b706fcfe93262e485976ed2bc648b779cc47981f
4 files changed +11 -2
Documentation/config.txt
+4
@@ -130,6 +130,10 @@ advice.*::
130 Advice shown when linkgit:git-merge[1] refuses to
131 merge to avoid overwritting local changes.
132 Default: true.
133 + implicitIdentity::
134 + Advice on how to set your identity configuration when
135 + your information is guessed from the system username and
136 + domain name. Default: true.
137 --
138
139 core.fileMode::
advice.c
+2
@@ -3,6 +3,7 @@
3 int advice_push_nonfastforward = 1;
4 int advice_status_hints = 1;
5 int advice_commit_before_merge = 1;
6 +int advice_implicit_identity = 1;
7
8 static struct {
9 const char *name;
@@ -11,6 +12,7 @@ static struct {
12 { "pushnonfastforward", &advice_push_nonfastforward },
13 { "statushints", &advice_status_hints },
14 { "commitbeforemerge", &advice_commit_before_merge },
15 + { "implicitidentity", &advice_implicit_identity },
16 };
17
18 int git_default_advice_config(const char *var, const char *value)
advice.h
+1
@@ -4,6 +4,7 @@
4 extern int advice_push_nonfastforward;
5 extern int advice_status_hints;
6 extern int advice_commit_before_merge;
7 +extern int advice_implicit_identity;
8
9 int git_default_advice_config(const char *var, const char *value);
10
builtin-commit.c
+4 -2
@@ -994,8 +994,10 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
994 if (!user_ident_explicitly_given) {
995 strbuf_addstr(&format, "\n Committer: ");
996 strbuf_addbuf_percentquote(&format, &committer_ident);
997 - strbuf_addch(&format, '\n');
998 - strbuf_addstr(&format, implicit_ident_advice);
997 + if (advice_implicit_identity) {
998 + strbuf_addch(&format, '\n');
999 + strbuf_addstr(&format, implicit_ident_advice);
1000 + }
1001 }
1002 strbuf_release(&author_ident);
1003 strbuf_release(&committer_ident);