summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2012-09-14 21:20:40 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2012-09-14 21:20:40 -0700
commitc336bc104c47cc9c2f7caf6bce468fe00a8f6850 (patch)
tree501143681bb20b9d4642e5029a77bec2d321482c /builtin
parentFurther merging in preparation for 1.7.12.1 (diff)
parentGit 1.7.11.7 (diff)
downloadtgif-c336bc104c47cc9c2f7caf6bce468fe00a8f6850.tar.xz
Sync with 1.7.11.7
Diffstat (limited to 'builtin')
-rw-r--r--builtin/commit.c17
-rw-r--r--builtin/log.c2
2 files changed, 17 insertions, 2 deletions
diff --git a/builtin/commit.c b/builtin/commit.c
index 20cef95d60..62028e7b44 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -478,6 +478,20 @@ static void export_one(const char *var, const char *s, const char *e, int hack)
strbuf_release(&buf);
}
+static int sane_ident_split(struct ident_split *person)
+{
+ if (!person->name_begin || !person->name_end ||
+ person->name_begin == person->name_end)
+ return 0; /* no human readable name */
+ if (!person->mail_begin || !person->mail_end ||
+ person->mail_begin == person->mail_end)
+ return 0; /* no usable mail */
+ if (!person->date_begin || !person->date_end ||
+ !person->tz_begin || !person->tz_end)
+ return 0;
+ return 1;
+}
+
static void determine_author_info(struct strbuf *author_ident)
{
char *name, *email, *date;
@@ -530,7 +544,8 @@ static void determine_author_info(struct strbuf *author_ident)
if (force_date)
date = force_date;
strbuf_addstr(author_ident, fmt_ident(name, email, date, IDENT_STRICT));
- if (!split_ident_line(&author, author_ident->buf, author_ident->len)) {
+ if (!split_ident_line(&author, author_ident->buf, author_ident->len) &&
+ sane_ident_split(&author)) {
export_one("GIT_AUTHOR_NAME", author.name_begin, author.name_end, 0);
export_one("GIT_AUTHOR_EMAIL", author.mail_begin, author.mail_end, 0);
export_one("GIT_AUTHOR_DATE", author.date_begin, author.tz_end, '@');
diff --git a/builtin/log.c b/builtin/log.c
index ecc2793690..c22469cab6 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -109,9 +109,9 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN |
PARSE_OPT_KEEP_DASHDASH);
- argc = setup_revisions(argc, argv, rev, opt);
if (quiet)
rev->diffopt.output_format |= DIFF_FORMAT_NO_OUTPUT;
+ argc = setup_revisions(argc, argv, rev, opt);
/* Any arguments at this point are not recognized */
if (argc > 1)