{"thread":{"id":"41335","subject":"[PATCH v5] ident: add user.useConfigOnly boolean for when ident shouldn't be guessed","startedAt":"2016-02-05T07:01:39Z","lastAt":"2016-02-05T07:01:42Z","messageCount":4,"participants":["Dan Aloni"],"isPatch":true,"patchVersion":5,"patchTotal":null},"messages":[{"id":"277511","messageId":"1454655702-28164-1-git-send-email-alonid@gmail.com","threadId":"41335","inReplyTo":null,"subject":"[PATCH v5] ident: add user.useConfigOnly boolean for when ident shouldn't be guessed","fromName":"Dan Aloni","fromEmail":"alonid@gmail.com","sentAt":"2016-02-05T07:01:39Z","receivedAt":"2016-02-05T07:01:39Z","isPatch":true,"sender":{"key":"alonid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/321273?v=4"},"body":"\nChanges between v4 -> v5:\n\n * Fixes for compiler warnings under standard compilation.\n * Revised commit messages according to remarks.\n * Cleanups and fixes of the added test script.\n * Indentation and styling fixes.\n\nv4: http://thread.gmane.org/gmane.comp.version-control.git/285441\n"},{"id":"277512","messageId":"1454655702-28164-2-git-send-email-alonid@gmail.com","threadId":"41335","inReplyTo":"1454655702-28164-1-git-send-email-alonid@gmail.com","subject":"[PATCH v5 1/3] fmt_ident: refactor strictness checks","fromName":"Dan Aloni","fromEmail":"alonid@gmail.com","sentAt":"2016-02-05T07:01:40Z","receivedAt":"2016-02-05T07:01:40Z","isPatch":true,"sender":{"key":"alonid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/321273?v=4"},"body":"From: Jeff King <peff@peff.net>\n\nThis function has evolved quite a bit over time, and as a\nresult, the logic for \"is this an OK ident\" has been\nsprinkled throughout. This ends up with a lot of redundant\nconditionals, like checking want_name repeatedly. Worse,\nwe want to know in many cases whether we are using the\n\"default\" ident, and we do so by comparing directly to the\nglobal strbuf, which violates the abstraction of the\nident_default_* functions.\n\nLet's reorganize the function into a hierarchy of\nconditionals to handle similar cases together. The only\ncase that doesn't just work naturally for this is that of an\nempty name, where our advice is different based on whether\nwe came from ident_default_name() or not. We can use a\nsimple flag to cover this case.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n ident.c | 46 ++++++++++++++++++++++++----------------------\n 1 file changed, 24 insertions(+), 22 deletions(-)\n\ndiff --git a/ident.c b/ident.c\nindex 3da555634290..f3a431f738cc 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -345,32 +345,34 @@ const char *fmt_ident(const char *name, const char *email,\n \tint want_date = !(flag & IDENT_NO_DATE);\n \tint want_name = !(flag & IDENT_NO_NAME);\n \n-\tif (want_name && !name)\n-\t\tname = ident_default_name();\n-\tif (!email)\n-\t\temail = ident_default_email();\n-\n-\tif (want_name && !*name) {\n-\t\tstruct passwd *pw;\n-\n-\t\tif (strict) {\n-\t\t\tif (name == git_default_name.buf)\n+\tif (want_name) {\n+\t\tint using_default = 0;\n+\t\tif (!name) {\n+\t\t\tname = ident_default_name();\n+\t\t\tusing_default = 1;\n+\t\t\tif (strict && default_name_is_bogus) {\n \t\t\t\tfputs(env_hint, stderr);\n-\t\t\tdie(\"empty ident name (for <%s>) not allowed\", email);\n+\t\t\t\tdie(\"unable to auto-detect name (got '%s')\", name);\n+\t\t\t}\n+\t\t}\n+\t\tif (!*name) {\n+\t\t\tstruct passwd *pw;\n+\t\t\tif (strict) {\n+\t\t\t\tif (using_default)\n+\t\t\t\t\tfputs(env_hint, stderr);\n+\t\t\t\tdie(\"empty ident name (for <%s>) not allowed\", email);\n+\t\t\t}\n+\t\t\tpw = xgetpwuid_self(NULL);\n+\t\t\tname = pw->pw_name;\n \t\t}\n-\t\tpw = xgetpwuid_self(NULL);\n-\t\tname = pw->pw_name;\n-\t}\n-\n-\tif (want_name && strict &&\n-\t    name == git_default_name.buf && default_name_is_bogus) {\n-\t\tfputs(env_hint, stderr);\n-\t\tdie(\"unable to auto-detect name (got '%s')\", name);\n \t}\n \n-\tif (strict && email == git_default_email.buf && default_email_is_bogus) {\n-\t\tfputs(env_hint, stderr);\n-\t\tdie(\"unable to auto-detect email address (got '%s')\", email);\n+\tif (!email) {\n+\t\temail = ident_default_email();\n+\t\tif (strict && default_email_is_bogus) {\n+\t\t\tfputs(env_hint, stderr);\n+\t\t\tdie(\"unable to auto-detect email address (got '%s')\", email);\n+\t\t}\n \t}\n \n \tstrbuf_reset(&ident);\n-- \n2.5.0\n"},{"id":"277514","messageId":"1454655702-28164-3-git-send-email-alonid@gmail.com","threadId":"41335","inReplyTo":"1454655702-28164-1-git-send-email-alonid@gmail.com","subject":"[PATCH v5 2/3] ident: add user.useConfigOnly boolean for when ident shouldn't be guessed","fromName":"Dan Aloni","fromEmail":"alonid@gmail.com","sentAt":"2016-02-05T07:01:41Z","receivedAt":"2016-02-05T07:01:41Z","isPatch":true,"sender":{"key":"alonid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/321273?v=4"},"body":"It used to be that:\n\n   git config --global user.email \"(none)\"\n\nwas a viable way for people to force themselves to set user.email in\neach repository.  This was helpful for people with more than one\nemail address, targeting different email addresses for different\nclones, as it barred git from creating commit unless the user.email\nconfig was set in the per-repo config to the correct email address.\n\nA recent change, 19ce497c (ident: keep a flag for bogus\ndefault_email, 2015-12-10), however declared that an explicitly\nconfigured user.email is not bogus, no matter what its value is, so\nthis hack no longer works.\n\nProvide the same functionality by adding a new configuration\nvariable user.useConfigOnly; when this variable is set, the\nuser must explicitly set user.email configuration.\n\nSigned-off-by: Dan Aloni <alonid@gmail.com>\nHelped-by: Jeff King <peff@peff.net>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nCc: Eric Sunshine <sunshine@sunshineco.com>\n---\n Documentation/config.txt  |  9 ++++++++\n ident.c                   | 16 +++++++++++++\n t/t9904-per-repo-email.sh | 58 +++++++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 83 insertions(+)\n create mode 100755 t/t9904-per-repo-email.sh\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex 02bcde6bb596..25cf7ce4e83a 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -2821,6 +2821,15 @@ user.name::\n \tCan be overridden by the 'GIT_AUTHOR_NAME' and 'GIT_COMMITTER_NAME'\n \tenvironment variables.  See linkgit:git-commit-tree[1].\n \n+user.useConfigOnly::\n+\tThis instruct Git to avoid trying to guess defaults for 'user.email'\n+\tand 'user.name' other than strictly from environment or config.\n+\tIf you have multiple email addresses that you would like to set\n+\tup per repository, you may want to set this to 'true' in the global\n+\tconfig, and then Git would prompt you to set user.email separately,\n+\tin each of the cloned repositories.\n+\tDefaults to `false`.\n+\n user.signingKey::\n \tIf linkgit:git-tag[1] or linkgit:git-commit[1] is not selecting the\n \tkey you want it to automatically when creating a signed tag or\ndiff --git a/ident.c b/ident.c\nindex f3a431f738cc..9bd6ac69bfe8 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -13,11 +13,14 @@ static struct strbuf git_default_date = STRBUF_INIT;\n static int default_email_is_bogus;\n static int default_name_is_bogus;\n \n+static int ident_use_config_only;\n+\n #define IDENT_NAME_GIVEN 01\n #define IDENT_MAIL_GIVEN 02\n #define IDENT_ALL_GIVEN (IDENT_NAME_GIVEN|IDENT_MAIL_GIVEN)\n static int committer_ident_explicitly_given;\n static int author_ident_explicitly_given;\n+static int ident_config_given;\n \n #ifdef NO_GECOS_IN_PWENT\n #define get_gecos(ignored) \"&\"\n@@ -354,6 +357,9 @@ const char *fmt_ident(const char *name, const char *email,\n \t\t\t\tfputs(env_hint, stderr);\n \t\t\t\tdie(\"unable to auto-detect name (got '%s')\", name);\n \t\t\t}\n+\t\t\tif (strict && ident_use_config_only &&\n+\t\t\t    !(ident_config_given & IDENT_NAME_GIVEN))\n+\t\t\t\tdie(\"user.useConfigOnly set but no name given\");\n \t\t}\n \t\tif (!*name) {\n \t\t\tstruct passwd *pw;\n@@ -373,6 +379,9 @@ const char *fmt_ident(const char *name, const char *email,\n \t\t\tfputs(env_hint, stderr);\n \t\t\tdie(\"unable to auto-detect email address (got '%s')\", email);\n \t\t}\n+\t\tif (strict && ident_use_config_only\n+\t\t    && !(ident_config_given & IDENT_MAIL_GIVEN))\n+\t\t\tdie(\"user.useConfigOnly set but no mail given\");\n \t}\n \n \tstrbuf_reset(&ident);\n@@ -446,6 +455,11 @@ int author_ident_sufficiently_given(void)\n \n int git_ident_config(const char *var, const char *value, void *data)\n {\n+\tif (!strcmp(var, \"user.useconfigonly\")) {\n+\t\tident_use_config_only = git_config_bool(var, value);\n+\t\treturn 0;\n+\t}\n+\n \tif (!strcmp(var, \"user.name\")) {\n \t\tif (!value)\n \t\t\treturn config_error_nonbool(var);\n@@ -453,6 +467,7 @@ int git_ident_config(const char *var, const char *value, void *data)\n \t\tstrbuf_addstr(&git_default_name, value);\n \t\tcommitter_ident_explicitly_given |= IDENT_NAME_GIVEN;\n \t\tauthor_ident_explicitly_given |= IDENT_NAME_GIVEN;\n+\t\tident_config_given |= IDENT_NAME_GIVEN;\n \t\treturn 0;\n \t}\n \n@@ -463,6 +478,7 @@ int git_ident_config(const char *var, const char *value, void *data)\n \t\tstrbuf_addstr(&git_default_email, value);\n \t\tcommitter_ident_explicitly_given |= IDENT_MAIL_GIVEN;\n \t\tauthor_ident_explicitly_given |= IDENT_MAIL_GIVEN;\n+\t\tident_config_given |= IDENT_MAIL_GIVEN;\n \t\treturn 0;\n \t}\n \ndiff --git a/t/t9904-per-repo-email.sh b/t/t9904-per-repo-email.sh\nnew file mode 100755\nindex 000000000000..0430f2e38434\n--- /dev/null\n+++ b/t/t9904-per-repo-email.sh\n@@ -0,0 +1,58 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2016 Dan Aloni\n+#\n+\n+test_description='per-repo forced setting of email address'\n+\n+. ./test-lib.sh\n+\n+prepare () {\n+\t# Have a non-empty repository\n+\trm -fr .git\n+\tgit init\n+\techo \"Initial\" >foo &&\n+\tgit add foo &&\n+\tgit commit -m foo &&\n+\n+\t# Setup a likely user.useConfigOnly use case\n+\tsane_unset GIT_AUTHOR_NAME &&\n+\tsane_unset GIT_AUTHOR_EMAIL &&\n+\ttest_unconfig --global user.name &&\n+\ttest_unconfig --global user.email &&\n+\ttest_config user.name \"test\" &&\n+\ttest_unconfig user.email &&\n+\ttest_config_global user.useConfigOnly true\n+}\n+\n+about_to_commit () {\n+\techo \"Second\" >>foo &&\n+\tgit add foo\n+}\n+\n+test_expect_success 'fails committing if clone email is not set' '\n+\tprepare && about_to_commit &&\n+\n+\ttest_must_fail git commit -m msg\n+'\n+\n+test_expect_success 'fails committing if clone email is not set, but EMAIL set' '\n+\tprepare && about_to_commit &&\n+\n+\ttest_must_fail env EMAIL=test@fail.com git commit -m msg\n+'\n+\n+test_expect_success 'succeeds committing if clone email is set' '\n+\tprepare && about_to_commit &&\n+\n+\ttest_config user.email \"test@ok.com\" &&\n+\tgit commit -m msg\n+'\n+\n+test_expect_success 'succeeds cloning if global email is not set' '\n+\tprepare &&\n+\n+\tgit clone . clone\n+'\n+\n+test_done\n-- \n2.5.0\n"},{"id":"277513","messageId":"1454655702-28164-4-git-send-email-alonid@gmail.com","threadId":"41335","inReplyTo":"1454655702-28164-1-git-send-email-alonid@gmail.com","subject":"[PATCH v5 3/3] ident: cleanup wrt ident's source","fromName":"Dan Aloni","fromEmail":"alonid@gmail.com","sentAt":"2016-02-05T07:01:42Z","receivedAt":"2016-02-05T07:01:42Z","isPatch":true,"sender":{"key":"alonid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/321273?v=4"},"body":"This change condenses the variables that tells where we got the user's\nident into single enum, instead of a collection of booleans.\n\nIn addtion, also have {committer,author}_ident_sufficiently_given\ndirectly probe the environment and the afformentioned enum instead of\nrelying on git_{committer,author}_info to do so.\n\nSigned-off-by: Dan Aloni <alonid@gmail.com>\nHelped-by: Jeff King <peff@peff.net>\nHelped-by: Junio C Hamano <gitster@pobox.com>\n---\n ident.c | 126 ++++++++++++++++++++++++++++++++++++++++------------------------\n 1 file changed, 80 insertions(+), 46 deletions(-)\n\ndiff --git a/ident.c b/ident.c\nindex 9bd6ac69bfe8..725d0aeb7da4 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -10,17 +10,19 @@\n static struct strbuf git_default_name = STRBUF_INIT;\n static struct strbuf git_default_email = STRBUF_INIT;\n static struct strbuf git_default_date = STRBUF_INIT;\n-static int default_email_is_bogus;\n-static int default_name_is_bogus;\n+\n+enum ident_source {\n+\tIDENT_SOURCE_UNKNOWN = 0,\n+\tIDENT_SOURCE_CONFIG,\n+\tIDENT_SOURCE_ENVIRONMENT,\n+\tIDENT_SOURCE_GUESSED,\n+\tIDENT_SOURCE_GUESSED_BOGUS\n+};\n \n static int ident_use_config_only;\n \n-#define IDENT_NAME_GIVEN 01\n-#define IDENT_MAIL_GIVEN 02\n-#define IDENT_ALL_GIVEN (IDENT_NAME_GIVEN|IDENT_MAIL_GIVEN)\n-static int committer_ident_explicitly_given;\n-static int author_ident_explicitly_given;\n-static int ident_config_given;\n+static enum ident_source source_of_default_email = IDENT_SOURCE_UNKNOWN;\n+static enum ident_source source_of_default_name = IDENT_SOURCE_UNKNOWN;\n \n #ifdef NO_GECOS_IN_PWENT\n #define get_gecos(ignored) \"&\"\n@@ -28,7 +30,7 @@ static int ident_config_given;\n #define get_gecos(struct_passwd) ((struct_passwd)->pw_gecos)\n #endif\n \n-static struct passwd *xgetpwuid_self(int *is_bogus)\n+static struct passwd *xgetpwuid_self(enum ident_source *source)\n {\n \tstruct passwd *pw;\n \n@@ -41,9 +43,13 @@ static struct passwd *xgetpwuid_self(int *is_bogus)\n \t\tfallback.pw_gecos = \"Unknown\";\n #endif\n \t\tpw = &fallback;\n-\t\tif (is_bogus)\n-\t\t\t*is_bogus = 1;\n+\t\tif (source)\n+\t\t\t*source = IDENT_SOURCE_GUESSED_BOGUS;\n+\t} else {\n+\t\tif (source)\n+\t\t\t*source = IDENT_SOURCE_GUESSED;\n \t}\n+\n \treturn pw;\n }\n \n@@ -120,26 +126,26 @@ static int canonical_name(const char *host, struct strbuf *out)\n \treturn status;\n }\n \n-static void add_domainname(struct strbuf *out, int *is_bogus)\n+static void add_domainname(struct strbuf *out, enum ident_source *source)\n {\n \tchar buf[1024];\n \n \tif (gethostname(buf, sizeof(buf))) {\n \t\twarning(\"cannot get host name: %s\", strerror(errno));\n \t\tstrbuf_addstr(out, \"(none)\");\n-\t\t*is_bogus = 1;\n+\t\t*source = IDENT_SOURCE_GUESSED_BOGUS;\n \t\treturn;\n \t}\n \tif (strchr(buf, '.'))\n \t\tstrbuf_addstr(out, buf);\n \telse if (canonical_name(buf, out) < 0) {\n \t\tstrbuf_addf(out, \"%s.(none)\", buf);\n-\t\t*is_bogus = 1;\n+\t\t*source = IDENT_SOURCE_GUESSED_BOGUS;\n \t}\n }\n \n static void copy_email(const struct passwd *pw, struct strbuf *email,\n-\t\t       int *is_bogus)\n+\t\t       enum ident_source *source)\n {\n \t/*\n \t * Make up a fake email address\n@@ -150,13 +156,13 @@ static void copy_email(const struct passwd *pw, struct strbuf *email,\n \n \tif (!add_mailname_host(email))\n \t\treturn;\t/* read from \"/etc/mailname\" (Debian) */\n-\tadd_domainname(email, is_bogus);\n+\tadd_domainname(email, source);\n }\n \n const char *ident_default_name(void)\n {\n \tif (!git_default_name.len) {\n-\t\tcopy_gecos(xgetpwuid_self(&default_name_is_bogus), &git_default_name);\n+\t\tcopy_gecos(xgetpwuid_self(&source_of_default_name), &git_default_name);\n \t\tstrbuf_trim(&git_default_name);\n \t}\n \treturn git_default_name.buf;\n@@ -169,11 +175,12 @@ const char *ident_default_email(void)\n \n \t\tif (email && email[0]) {\n \t\t\tstrbuf_addstr(&git_default_email, email);\n-\t\t\tcommitter_ident_explicitly_given |= IDENT_MAIL_GIVEN;\n-\t\t\tauthor_ident_explicitly_given |= IDENT_MAIL_GIVEN;\n-\t\t} else\n-\t\t\tcopy_email(xgetpwuid_self(&default_email_is_bogus),\n-\t\t\t\t   &git_default_email, &default_email_is_bogus);\n+\t\t\tsource_of_default_email = IDENT_SOURCE_ENVIRONMENT;\n+\t\t} else {\n+\t\t\tcopy_email(xgetpwuid_self(&source_of_default_email),\n+\t\t\t\t   &git_default_email, &source_of_default_email);\n+\t\t}\n+\n \t\tstrbuf_trim(&git_default_email);\n \t}\n \treturn git_default_email.buf;\n@@ -353,12 +360,13 @@ const char *fmt_ident(const char *name, const char *email,\n \t\tif (!name) {\n \t\t\tname = ident_default_name();\n \t\t\tusing_default = 1;\n-\t\t\tif (strict && default_name_is_bogus) {\n+\t\t\tif (strict &&\n+\t\t\t    source_of_default_name == IDENT_SOURCE_GUESSED_BOGUS) {\n \t\t\t\tfputs(env_hint, stderr);\n \t\t\t\tdie(\"unable to auto-detect name (got '%s')\", name);\n \t\t\t}\n \t\t\tif (strict && ident_use_config_only &&\n-\t\t\t    !(ident_config_given & IDENT_NAME_GIVEN))\n+\t\t\t    source_of_default_name != IDENT_SOURCE_CONFIG)\n \t\t\t\tdie(\"user.useConfigOnly set but no name given\");\n \t\t}\n \t\tif (!*name) {\n@@ -375,12 +383,12 @@ const char *fmt_ident(const char *name, const char *email,\n \n \tif (!email) {\n \t\temail = ident_default_email();\n-\t\tif (strict && default_email_is_bogus) {\n+\t\tif (strict && source_of_default_email == IDENT_SOURCE_GUESSED_BOGUS) {\n \t\t\tfputs(env_hint, stderr);\n \t\t\tdie(\"unable to auto-detect email address (got '%s')\", email);\n \t\t}\n-\t\tif (strict && ident_use_config_only\n-\t\t    && !(ident_config_given & IDENT_MAIL_GIVEN))\n+\t\tif (strict && ident_use_config_only &&\n+\t\t    source_of_default_email != IDENT_SOURCE_CONFIG)\n \t\t\tdie(\"user.useConfigOnly set but no mail given\");\n \t}\n \n@@ -412,10 +420,6 @@ const char *fmt_name(const char *name, const char *email)\n \n const char *git_author_info(int flag)\n {\n-\tif (getenv(\"GIT_AUTHOR_NAME\"))\n-\t\tauthor_ident_explicitly_given |= IDENT_NAME_GIVEN;\n-\tif (getenv(\"GIT_AUTHOR_EMAIL\"))\n-\t\tauthor_ident_explicitly_given |= IDENT_MAIL_GIVEN;\n \treturn fmt_ident(getenv(\"GIT_AUTHOR_NAME\"),\n \t\t\t getenv(\"GIT_AUTHOR_EMAIL\"),\n \t\t\t getenv(\"GIT_AUTHOR_DATE\"),\n@@ -424,33 +428,67 @@ const char *git_author_info(int flag)\n \n const char *git_committer_info(int flag)\n {\n-\tif (getenv(\"GIT_COMMITTER_NAME\"))\n-\t\tcommitter_ident_explicitly_given |= IDENT_NAME_GIVEN;\n-\tif (getenv(\"GIT_COMMITTER_EMAIL\"))\n-\t\tcommitter_ident_explicitly_given |= IDENT_MAIL_GIVEN;\n \treturn fmt_ident(getenv(\"GIT_COMMITTER_NAME\"),\n \t\t\t getenv(\"GIT_COMMITTER_EMAIL\"),\n \t\t\t getenv(\"GIT_COMMITTER_DATE\"),\n \t\t\t flag);\n }\n \n-static int ident_is_sufficient(int user_ident_explicitly_given)\n+enum ident_person {\n+\tIDENT_PERSON_COMMITTER,\n+\tIDENT_PERSON_AUTHOR,\n+};\n+\n+static int ident_source_is_sufficient(enum ident_source source)\n+{\n+\tswitch (source) {\n+\tcase IDENT_SOURCE_CONFIG:\n+\tcase IDENT_SOURCE_ENVIRONMENT:\n+\t\treturn 1;\n+\tdefault:\n+\t\tbreak;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int ident_is_sufficient(enum ident_person person)\n {\n+\tconst char *str_name, *str_email;\n+\tint name, email;\n+\n+\tswitch (person) {\n+\tcase IDENT_PERSON_COMMITTER:\n+\t\tstr_name = getenv(\"GIT_COMMITTER_NAME\");\n+\t\tstr_email = getenv(\"GIT_COMMITTER_EMAIL\");\n+\t\tbreak;\n+\tcase IDENT_PERSON_AUTHOR:\n+\t\tstr_name = getenv(\"GIT_AUTHOR_NAME\");\n+\t\tstr_email = getenv(\"GIT_AUTHOR_EMAIL\");\n+\t\tbreak;\n+\tdefault:\n+\t\tdie(\"invalid parameter to ident_is_sufficient()\");\n+\t}\n+\n+\tname = !!str_name || ident_source_is_sufficient(source_of_default_name);\n+\temail = !!str_email || ident_source_is_sufficient(source_of_default_email);\n+\n #ifndef WINDOWS\n-\treturn (user_ident_explicitly_given & IDENT_MAIL_GIVEN);\n+\t(void)name;\n+\treturn email;\n #else\n-\treturn (user_ident_explicitly_given == IDENT_ALL_GIVEN);\n+\treturn name && email;\n #endif\n }\n \n int committer_ident_sufficiently_given(void)\n {\n-\treturn ident_is_sufficient(committer_ident_explicitly_given);\n+\treturn ident_is_sufficient(IDENT_PERSON_COMMITTER);\n }\n \n int author_ident_sufficiently_given(void)\n {\n-\treturn ident_is_sufficient(author_ident_explicitly_given);\n+\treturn ident_is_sufficient(IDENT_PERSON_AUTHOR);\n }\n \n int git_ident_config(const char *var, const char *value, void *data)\n@@ -465,9 +503,7 @@ int git_ident_config(const char *var, const char *value, void *data)\n \t\t\treturn config_error_nonbool(var);\n \t\tstrbuf_reset(&git_default_name);\n \t\tstrbuf_addstr(&git_default_name, value);\n-\t\tcommitter_ident_explicitly_given |= IDENT_NAME_GIVEN;\n-\t\tauthor_ident_explicitly_given |= IDENT_NAME_GIVEN;\n-\t\tident_config_given |= IDENT_NAME_GIVEN;\n+\t\tsource_of_default_name = IDENT_SOURCE_CONFIG;\n \t\treturn 0;\n \t}\n \n@@ -476,9 +512,7 @@ int git_ident_config(const char *var, const char *value, void *data)\n \t\t\treturn config_error_nonbool(var);\n \t\tstrbuf_reset(&git_default_email);\n \t\tstrbuf_addstr(&git_default_email, value);\n-\t\tcommitter_ident_explicitly_given |= IDENT_MAIL_GIVEN;\n-\t\tauthor_ident_explicitly_given |= IDENT_MAIL_GIVEN;\n-\t\tident_config_given |= IDENT_MAIL_GIVEN;\n+\t\tsource_of_default_email = IDENT_SOURCE_CONFIG;\n \t\treturn 0;\n \t}\n \n-- \n2.5.0\n"}]}