Skip to content

Commit 0cd4bcb

Browse files
pyokagangitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f07adb6 commit 0cd4bcb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

builtin/am.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ struct am_state {
108108
int scissors; /* enum scissors_type */
109109
struct argv_array git_apply_opts;
110110
const char *resolvemsg;
111+
int committer_date_is_author_date;
111112
int ignore_date;
112113
int rebasing;
113114
};
@@ -1221,6 +1222,10 @@ static void do_commit(const struct am_state *state)
12211222
state->ignore_date ? NULL : state->author_date,
12221223
IDENT_STRICT);
12231224

1225+
if (state->committer_date_is_author_date)
1226+
setenv("GIT_COMMITTER_DATE",
1227+
state->ignore_date ? "" : state->author_date, 1);
1228+
12241229
if (commit_tree(state->msg, state->msg_len, tree, parents, commit,
12251230
author, NULL))
12261231
die(_("failed to write commit object"));
@@ -1663,6 +1668,9 @@ int cmd_am(int argc, const char **argv, const char *prefix)
16631668
OPT_CMDMODE(0, "abort", &resume,
16641669
N_("restore the original branch and abort the patching operation."),
16651670
RESUME_ABORT),
1671+
OPT_BOOL(0, "committer-date-is-author-date",
1672+
&state.committer_date_is_author_date,
1673+
N_("lie about committer date")),
16661674
OPT_BOOL(0, "ignore-date", &state.ignore_date,
16671675
N_("use current timestamp for author date")),
16681676
OPT_HIDDEN_BOOL(0, "rebasing", &state.rebasing,

0 commit comments

Comments
 (0)