summaryrefslogtreecommitdiff
path: root/builtin/am.c
diff options
context:
space:
mode:
authorPaul Tan <pyokagan@gmail.com>2015-08-04 13:51:52 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-08-05 05:02:11 (GMT)
commit0cd4bcba679041274f9f5c381737f6f92b03b1b6 (patch)
tree86f5cbd5eced4c6e0ba96a71a0b1f2772e9c8087 /builtin/am.c
parentf07adb62f292eec0d10fd10b0812800afb03363c (diff)
downloadgit-0cd4bcba679041274f9f5c381737f6f92b03b1b6.zip
git-0cd4bcba679041274f9f5c381737f6f92b03b1b6.tar.gz
git-0cd4bcba679041274f9f5c381737f6f92b03b1b6.tar.bz2
builtin-am: implement --committer-date-is-author-date
Since 3f01ad6 (am: Add --committer-date-is-author-date option, 2009-01-22), git-am.sh implemented the --committer-date-is-author-date option, which tells git-am to use the timestamp recorded in the email message as both author and committer date. Re-implement this option in builtin/am.c. Signed-off-by: Paul Tan <pyokagan@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/am.c')
-rw-r--r--builtin/am.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/builtin/am.c b/builtin/am.c
index 84d3e05..1561580 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -108,6 +108,7 @@ struct am_state {
int scissors; /* enum scissors_type */
struct argv_array git_apply_opts;
const char *resolvemsg;
+ int committer_date_is_author_date;
int ignore_date;
int rebasing;
};
@@ -1221,6 +1222,10 @@ static void do_commit(const struct am_state *state)
state->ignore_date ? NULL : state->author_date,
IDENT_STRICT);
+ if (state->committer_date_is_author_date)
+ setenv("GIT_COMMITTER_DATE",
+ state->ignore_date ? "" : state->author_date, 1);
+
if (commit_tree(state->msg, state->msg_len, tree, parents, commit,
author, NULL))
die(_("failed to write commit object"));
@@ -1663,6 +1668,9 @@ int cmd_am(int argc, const char **argv, const char *prefix)
OPT_CMDMODE(0, "abort", &resume,
N_("restore the original branch and abort the patching operation."),
RESUME_ABORT),
+ OPT_BOOL(0, "committer-date-is-author-date",
+ &state.committer_date_is_author_date,
+ N_("lie about committer date")),
OPT_BOOL(0, "ignore-date", &state.ignore_date,
N_("use current timestamp for author date")),
OPT_HIDDEN_BOOL(0, "rebasing", &state.rebasing,