Merge branch 'jk/reset-ident-time-per-commit' into maint
authorJunio C Hamano <gitster@pobox.com>
Fri, 12 Aug 2016 16:16:56 +0000 (09:16 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 12 Aug 2016 16:16:56 +0000 (09:16 -0700)
Not-so-recent rewrite of "git am" that started making internal
calls into the commit machinery had an unintended regression, in
that no matter how many seconds it took to apply many patches, the
resulting committer timestamp for the resulting commits were all
the same.

* jk/reset-ident-time-per-commit:
am: reset cached ident date for each patch

builtin/am.c
cache.h
ident.c
index 0d97f2fabb0fe528fcbb82b32146b09a5265f5f6..00e4a0981443c043d5a5318b53769d29edb8db8f 100644 (file)
@@ -1839,6 +1839,8 @@ static void am_run(struct am_state *state, int resume)
                const char *mail = am_path(state, msgnum(state));
                int apply_status;
 
+               reset_ident_date();
+
                if (!file_exists(mail))
                        goto next;
 
diff --git a/cache.h b/cache.h
index 7265439584f3567a9674e0d452b035b649b45b97..c141b3ca0d9c3066632277d933477e0e30881c5f 100644 (file)
--- a/cache.h
+++ b/cache.h
@@ -1262,6 +1262,7 @@ extern const char *ident_default_email(void);
 extern const char *git_editor(void);
 extern const char *git_pager(int stdout_is_tty);
 extern int git_ident_config(const char *, const char *, void *);
+extern void reset_ident_date(void);
 
 struct ident_split {
        const char *name_begin;
diff --git a/ident.c b/ident.c
index 139c5289d03b7594af2a07e6e0364bb285ae0348..e20a772dde4230b0871ffe85a5204919402aaf94 100644 (file)
--- a/ident.c
+++ b/ident.c
@@ -184,6 +184,11 @@ static const char *ident_default_date(void)
        return git_default_date.buf;
 }
 
+void reset_ident_date(void)
+{
+       strbuf_reset(&git_default_date);
+}
+
 static int crud(unsigned char c)
 {
        return  c <= 32  ||