summaryrefslogtreecommitdiff
path: root/ident.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2012-05-24 23:28:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-05-25 00:16:41 (GMT)
commitf9bc573fdaeaf8621008f3f49aaaa64869791691 (patch)
treebecd0a65e5488ae94fdf1781c70b5ab68eb85e0a /ident.c
parentc73f384f92dcb0d7111533ed21f6c2dc9fcc323b (diff)
downloadgit-f9bc573fdaeaf8621008f3f49aaaa64869791691.zip
git-f9bc573fdaeaf8621008f3f49aaaa64869791691.tar.gz
git-f9bc573fdaeaf8621008f3f49aaaa64869791691.tar.bz2
ident: rename IDENT_ERROR_ON_NO_NAME to IDENT_STRICT
Callers who ask for ERROR_ON_NO_NAME are not so much concerned that the name will be blank (because, after all, we will fall back to using the username), but rather it is a check to make sure that low-quality identities do not end up in things like commit messages or emails (whereas it is OK for them to end up in things like reflogs). When future commits add more quality checks on the identity, each of these callers would want to use those checks, too. Rather than modify each of them later to add a new flag, let's refactor the flag. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'ident.c')
-rw-r--r--ident.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ident.c b/ident.c
index 8b5080d..c42258f 100644
--- a/ident.c
+++ b/ident.c
@@ -267,7 +267,7 @@ const char *fmt_ident(const char *name, const char *email,
{
static struct strbuf ident = STRBUF_INIT;
char date[50];
- int error_on_no_name = (flag & IDENT_ERROR_ON_NO_NAME);
+ int strict = (flag & IDENT_STRICT);
int want_date = !(flag & IDENT_NO_DATE);
int want_name = !(flag & IDENT_NO_NAME);
@@ -279,7 +279,7 @@ const char *fmt_ident(const char *name, const char *email,
if (want_name && !*name) {
struct passwd *pw;
- if (error_on_no_name) {
+ if (strict) {
if (name == git_default_name.buf)
fputs(env_hint, stderr);
die("empty ident name (for <%s>) not allowed", email);
@@ -314,7 +314,7 @@ const char *fmt_ident(const char *name, const char *email,
const char *fmt_name(const char *name, const char *email)
{
- return fmt_ident(name, email, NULL, IDENT_ERROR_ON_NO_NAME | IDENT_NO_DATE);
+ return fmt_ident(name, email, NULL, IDENT_STRICT | IDENT_NO_DATE);
}
const char *git_author_info(int flag)