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>
Paul Tan committed
Aug 4, 2015 at 21:51 UTC
0cd4bcba679041274f9f5c381737f6f92b03b1b6
1 file changed
+8
builtin/am.c
+8
@@ -108,6 +108,7 @@ struct am_state {
108
int scissors; /* enum scissors_type */
109
struct argv_array git_apply_opts;
110
const char *resolvemsg;
111
+ int committer_date_is_author_date;
112
int ignore_date;
113
int rebasing;
114
};
@@ -1221,6 +1222,10 @@ static void do_commit(const struct am_state *state)
1222
state->ignore_date ? NULL : state->author_date,
1223
IDENT_STRICT);
1224
1225
+ if (state->committer_date_is_author_date)
1226
+ setenv("GIT_COMMITTER_DATE",
1227
+ state->ignore_date ? "" : state->author_date, 1);
1228
+
1229
if (commit_tree(state->msg, state->msg_len, tree, parents, commit,
1230
author, NULL))
1231
die(_("failed to write commit object"));
@@ -1663,6 +1668,9 @@ int cmd_am(int argc, const char **argv, const char *prefix)
1668
OPT_CMDMODE(0, "abort", &resume,
1669
N_("restore the original branch and abort the patching operation."),
1670
RESUME_ABORT),
1671
+ OPT_BOOL(0, "committer-date-is-author-date",
1672
+ &state.committer_date_is_author_date,
1673
+ N_("lie about committer date")),
1674
OPT_BOOL(0, "ignore-date", &state.ignore_date,
1675
N_("use current timestamp for author date")),
1676
OPT_HIDDEN_BOOL(0, "rebasing", &state.rebasing,