git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v5 29/44] builtin-am: implement --ignore-date

From
Paul Tan <pyokagan@gmail.com>
Date
Jul 7, 2015, 14:20 UTC
Message-ID
<1436278862-2638-30-git-send-email-pyokagan@gmail.com>
In-Reply-To
<1436278862-2638-1-git-send-email-pyokagan@gmail.com>

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 <pyokagan@gmail.com>
---
 builtin/am.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/builtin/am.c b/builtin/am.c
index 6006010..e9eacf0 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -120,6 +120,8 @@ struct am_state {
 	/* override error message when patch failure occurs */
 	const char *resolvemsg;
 
+	int ignore_date;
+
 	int rebasing;
 };
 
@@ -1254,7 +1256,8 @@ static void do_commit(const struct am_state *state)
 	}
 
 	author = fmt_ident(state->author_name, state->author_email,
-			state->author_date, IDENT_STRICT);
+			state->ignore_date ? NULL : state->author_date,
+			IDENT_STRICT);
 
 	if (commit_tree(state->msg, state->msg_len, tree, parents, commit,
 				author, NULL))
@@ -1674,6 +1677,8 @@ 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, "ignore-date", &state.ignore_date,
+			N_("use current timestamp for author date")),
 		OPT_HIDDEN_BOOL(0, "rebasing", &state.rebasing,
 			N_("(internal use for git-rebase)")),
 		OPT_END()
-- 
2.5.0.rc1.76.gf60a929
Previous: Paul TanNext: Paul Tan
Message 37 of 63 in “Make git-am a builtin”
  1. 00/44 Make git-am a builtinPaul Tan, Jul 7, 2015
  2. 01/44 wrapper: implement xopen()Paul Tan, Jul 7, 2015
  3. 02/44 wrapper: implement xfopen()Paul Tan, Jul 7, 2015
  4. 03/44 builtin-am: implement skeletal builtin amPaul Tan, Jul 7, 2015
  5. 04/44 builtin-am: implement patch queue mechanismPaul Tan, Jul 7, 2015
  6. 05/44 builtin-am: split out mbox/maildir patches with git-mailsplitPaul Tan, Jul 7, 2015
  7. 06/44 builtin-am: auto-detect mbox patchesPaul Tan, Jul 7, 2015
  8. 07/44 builtin-am: extract patch and commit info with git-mailinfoPaul Tan, Jul 7, 2015
  9. 08/44 builtin-am: apply patch with git-applyPaul Tan, Jul 7, 2015
  10. 09/44 builtin-am: implement committing applied patchPaul Tan, Jul 7, 2015
  11. 10/44 builtin-am: refuse to apply patches if index is dirtyPaul Tan, Jul 7, 2015
  12. 11/44 builtin-am: implement --resolved/--continuePaul Tan, Jul 7, 2015
  13. 12/44 builtin-am: implement --skipPaul Tan, Jul 7, 2015
  14. Stefan BellerJul 13, 2015
  15. Paul TanJul 14, 2015
  16. Stefan BellerJul 14, 2015
  17. Paul TanJul 18, 2015
  18. 13/44 builtin-am: implement --abortPaul Tan, Jul 7, 2015
  19. 14/44 builtin-am: reject patches when there's a session in progressPaul Tan, Jul 7, 2015
  20. 15/44 builtin-am: implement -q/--quietPaul Tan, Jul 7, 2015
  21. 16/44 builtin-am: exit with user friendly message on failurePaul Tan, Jul 7, 2015
  22. 17/44 builtin-am: implement -s/--signoffPaul Tan, Jul 7, 2015
  23. 18/44 cache-tree: introduce write_index_as_tree()Paul Tan, Jul 7, 2015
  24. Junio C HamanoJul 7, 2015
  25. 19/44 builtin-am: implement --3way, am.threeWayPaul Tan, Jul 7, 2015
  26. Junio C HamanoJul 7, 2015
  27. Paul TanJul 14, 2015
  28. 20/44 builtin-am: implement --rebasing modePaul Tan, Jul 7, 2015
  29. 21/44 builtin-am: bypass git-mailinfo when --rebasingPaul Tan, Jul 7, 2015
  30. 22/44 builtin-am: handle stray state directoryPaul Tan, Jul 7, 2015
  31. 23/44 builtin-am: implement -u/--utf8Paul Tan, Jul 7, 2015
  32. 24/44 builtin-am: implement -k/--keep, --keep-non-patchPaul Tan, Jul 7, 2015
  33. 25/44 builtin-am: implement --[no-]message-id, am.messageidPaul Tan, Jul 7, 2015
  34. 26/44 builtin-am: support --keep-cr, am.keepcrPaul Tan, Jul 7, 2015
  35. 27/44 builtin-am: implement --[no-]scissorsPaul Tan, Jul 7, 2015
  36. 28/44 builtin-am: pass git-apply's options to git-applyPaul Tan, Jul 7, 2015
  37. 29/44 builtin-am: implement --ignore-datePaul Tan, Jul 7, 2015
  38. 30/44 builtin-am: implement --committer-date-is-author-datePaul Tan, Jul 7, 2015
  39. 31/44 builtin-am: implement -S/--gpg-sign, commit.gpgsignPaul Tan, Jul 7, 2015
  40. 32/44 builtin-am: invoke post-rewrite hookPaul Tan, Jul 7, 2015
  41. 33/44 builtin-am: support automatic notes copyingPaul Tan, Jul 7, 2015
  42. 34/44 builtin-am: invoke applypatch-msg hookPaul Tan, Jul 7, 2015
  43. 35/44 builtin-am: invoke pre-applypatch hookPaul Tan, Jul 7, 2015
  44. 36/44 builtin-am: invoke post-applypatch hookPaul Tan, Jul 7, 2015
  45. 37/44 builtin-am: rerere supportPaul Tan, Jul 7, 2015
  46. 38/44 builtin-am: support and auto-detect StGit patchesPaul Tan, Jul 7, 2015
  47. 39/44 builtin-am: support and auto-detect StGit series filesPaul Tan, Jul 7, 2015
  48. 40/44 builtin-am: support and auto-detect mercurial patchesPaul Tan, Jul 7, 2015
  49. 41/44 builtin-am: implement -i/--interactivePaul Tan, Jul 7, 2015
  50. 42/44 builtin-am: implement legacy -b/--binary optionPaul Tan, Jul 7, 2015
  51. 43/44 builtin-am: check for valid committer identPaul Tan, Jul 7, 2015
  52. 44/44 builtin-am: remove redirection to git-am.shPaul Tan, Jul 7, 2015
  53. Junio C HamanoJul 7, 2015
  54. Paul TanJul 7, 2015
  55. Junio C HamanoJul 8, 2015
  56. Paul TanJul 8, 2015
  57. Junio C HamanoJul 8, 2015
  58. Paul TanJul 8, 2015
  59. Junio C HamanoJul 9, 2015
  60. Paul TanJul 12, 2015
  61. Junio C HamanoJul 12, 2015
  62. Junio C HamanoJul 13, 2015
  63. Paul TanJul 14, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.