{"thread":{"id":"17333","subject":"[PATCH 2/2 (v2)] git-am: Add --ignore-date option","startedAt":"2009-01-24T01:18:02Z","lastAt":"2009-01-24T01:18:02Z","messageCount":1,"participants":["Nanako Shiraishi"],"isPatch":true,"patchVersion":2,"patchTotal":2},"messages":[{"id":"101716","messageId":"20090124101802.6117@nanako3.lavabit.com","threadId":"17333","inReplyTo":null,"subject":"[PATCH 2/2 (v2)] git-am: Add --ignore-date option","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-01-24T01:18:02Z","receivedAt":"2009-01-24T01:18:02Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"This new option tells 'git-am' to ignore the date header field\nrecorded in the format-patch output. The commits will have the\ntimestamp when they are created instead.\n\nYou can work a lot in one day to accumulate many changes, but\napply and push to the public repository only some of them at\nthe end of the first day. Then next day you can spend all your\nworking hours reading comics or chatting with your coworkers,\nand apply your remaining patches from the previous day using\nthis option to pretend that you have been working at the end\nof the day.\n\nSigned-off-by: しらいしななこ <nanako3@lavabit.com>\n---\n\nAdded documentation and copied your response about the new\ntest as a comment.\n\n Documentation/git-am.txt |   17 ++++++++++++++++-\n git-am.sh                |    8 ++++++++\n t/t4150-am.sh            |   13 +++++++++++++\n 3 files changed, 37 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-am.txt b/Documentation/git-am.txt\nindex 5cbbe76..c10c91b 100644\n--- a/Documentation/git-am.txt\n+++ b/Documentation/git-am.txt\n@@ -10,7 +10,8 @@ SYNOPSIS\n --------\n [verse]\n 'git am' [--signoff] [--keep] [--utf8 | --no-utf8]\n-\t [--3way] [--interactive]\n+\t [--3way] [--interactive] [--committer-date-is-author-date]\n+\t [--ignore-date]\n \t [--whitespace=<option>] [-C<n>] [-p<n>] [--directory=<dir>]\n \t [<mbox> | <Maildir>...]\n 'git am' (--skip | --resolved | --abort)\n@@ -71,6 +72,20 @@ default.   You could use `--no-utf8` to override this.\n --interactive::\n \tRun interactively.\n \n+--committer-date-is-author-date::\n+\tBy default the command records the date from the e-mail\n+\tmessage as the commit author date, and uses the time of\n+\tcommit creation as the committer date. This allows the\n+\tuser to lie about the committer date by using the same\n+\ttimestamp as the author date.\n+\n+--ignore-date::\n+\tBy default the command records the date from the e-mail\n+\tmessage as the commit author date, and uses the time of\n+\tcommit creation as the committer date. This allows the\n+\tuser to lie about author timestamp by using the same\n+\ttimestamp as the committer date.\n+\n --skip::\n \tSkip the current patch.  This is only meaningful when\n \trestarting an aborted patch.\ndiff --git a/git-am.sh b/git-am.sh\nindex e96071d..f935178 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -24,6 +24,7 @@ r,resolved      to be used after a patch failure\n skip            skip the current patch\n abort           restore the original branch and abort the patching operation.\n committer-date-is-author-date    lie about committer date\n+ignore-date     use current timestamp for author date\n rebasing        (internal use for git-rebase)\"\n \n . git-sh-setup\n@@ -135,6 +136,7 @@ sign= utf8=t keep= skip= interactive= resolved= rebasing= abort=\n resolvemsg= resume=\n git_apply_opt=\n committer_date_is_author_date=\n+ignore_date=\n \n while test $# != 0\n do\n@@ -172,6 +174,8 @@ do\n \t\tgit_apply_opt=\"$git_apply_opt $(sq \"$1$2\")\"; shift ;;\n \t--committer-date-is-author-date)\n \t\tcommitter_date_is_author_date=t ;;\n+\t--ignore-date)\n+\t\tignore_date=t ;;\n \t--)\n \t\tshift; break ;;\n \t*)\n@@ -526,6 +530,10 @@ do\n \ttree=$(git write-tree) &&\n \tparent=$(git rev-parse --verify HEAD) &&\n \tcommit=$(\n+\t\tif test -n \"$ignore_date\"\n+\t\tthen\n+\t\t\tGIT_AUTHOR_DATE=\n+\t\tfi\n \t\tif test -n \"$committer_date_is_author_date\"\n \t\tthen\n \t\t\tGIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 8d3fb00..2ad9048 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -277,4 +277,17 @@ test_expect_success 'am without --committer-date-is-author-date' '\n \ttest \"$at\" != \"$ct\"\n '\n \n+# This checks for +0000 because TZ is set to UTC and that should\n+# show up when the current time is used. The date in message is set\n+# by test_tick that uses -0700 timezone; if this feature does not\n+# work, we will see that instead of +0000.\n+test_expect_success 'am --ignore-date' '\n+\tgit checkout first &&\n+\ttest_tick &&\n+\tgit am --ignore-date patch1 &&\n+\tgit cat-file commit HEAD | sed -e \"/^$/q\" >head1 &&\n+\tat=$(sed -ne \"/^author /s/.*> //p\" head1) &&\n+\techo \"$at\" | grep \"+0000\"\n+'\n+\n test_done\n-- \n1.6.1\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"}]}