Skip to content

Commit f07adb6

Browse files
pyokagangitster
authored andcommitted
builtin-am: implement --ignore-date
Since a79ec62 (git-am: Add --ignore-date option, 2009-01-24), git-am.sh supported the --ignore-date option, and would use the current timestamp instead of the one provided in the patch if the option was set. 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 257e8ce commit f07adb6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

builtin/am.c

Lines changed: 5 additions & 1 deletion
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 ignore_date;
111112
int rebasing;
112113
};
113114

@@ -1217,7 +1218,8 @@ static void do_commit(const struct am_state *state)
12171218
}
12181219

12191220
author = fmt_ident(state->author_name, state->author_email,
1220-
state->author_date, IDENT_STRICT);
1221+
state->ignore_date ? NULL : state->author_date,
1222+
IDENT_STRICT);
12211223

12221224
if (commit_tree(state->msg, state->msg_len, tree, parents, commit,
12231225
author, NULL))
@@ -1661,6 +1663,8 @@ int cmd_am(int argc, const char **argv, const char *prefix)
16611663
OPT_CMDMODE(0, "abort", &resume,
16621664
N_("restore the original branch and abort the patching operation."),
16631665
RESUME_ABORT),
1666+
OPT_BOOL(0, "ignore-date", &state.ignore_date,
1667+
N_("use current timestamp for author date")),
16641668
OPT_HIDDEN_BOOL(0, "rebasing", &state.rebasing,
16651669
N_("(internal use for git-rebase)")),
16661670
OPT_END()

0 commit comments

Comments
 (0)