{"thread":{"id":"17309","subject":"how to force a commit date matching info from a mbox ?","startedAt":"2009-01-22T22:41:12Z","lastAt":"2009-01-24T02:35:48Z","messageCount":19,"participants":["Christian MICHON","Junio C Hamano","Johannes Schindelin","Nanako Shiraishi","Adeodato Simó","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"101566","messageId":"46d6db660901221441q60eb90bdge601a7a250c3a247@mail.gmail.com","threadId":"17309","inReplyTo":null,"subject":"how to force a commit date matching info from a mbox ?","fromName":"Christian MICHON","fromEmail":"christian.michon@gmail.com","sentAt":"2009-01-22T22:41:12Z","receivedAt":"2009-01-22T22:41:12Z","isPatch":false,"sender":{"key":"christian.michon@gmail.com","avatar":"https://gravatar.com/avatar/8a7c327b21187fbcab5c27640a49450eec72e0355dc292501197f27a5a744ec4?d=mp&s=160"},"body":"Hi list,\n\nI've a big set of patches in a mbox file: there's sufficient info\ninside for git-am to work.\n\nYet, each time I do import these, my sha1sums are changing because of\ndifferent commit dates.\n\nI'd like to force the commit date to match the info/date from the time\nI received the email (and therefore always get back the right\nsha1sums).\n\nis this possible ?\n\nThere's hundreds of these patches: I'm looking for the right switch or\n1 liner trick instead of a long shell script which will import 1 by 1\nthe patches and force the commit date by environment.\n\nTIA\n\n-- \nChristian\n--\nhttp://detaolb.sourceforge.net/, a linux distribution for Qemu with Git inside !\n"},{"id":"101582","messageId":"7vljt26fp9.fsf@gitster.siamese.dyndns.org","threadId":"17309","inReplyTo":"46d6db660901221441q60eb90bdge601a7a250c3a247@mail.gmail.com","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-23T00:14:58Z","receivedAt":"2009-01-23T00:14:58Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian MICHON <christian.michon@gmail.com> writes:\n\n> I'd like to force the commit date to match the info/date from the time\n> I received the email (and therefore always get back the right\n> sha1sums).\n>\n> is this possible ?\n\n\"am\" being a tool to accept patches written in some past to faithfully\nrecord both author timestamp and committer timestamp, what you seem to\nwant is outside of the current scope of the tool.\n\nA patch to butcher \"git-am\" to copy GIT_COMMITTER_DATE from\nGIT_AUTHOR_DATE and export it should be trivial to implement, though.\n\nPerhaps something like this totally untested patch.\n\n\n\n git-am.sh     |   13 ++++++++++++-\n t/t4150-am.sh |   20 ++++++++++++++++++++\n 2 files changed, 32 insertions(+), 1 deletions(-)\n\ndiff --git c/git-am.sh w/git-am.sh\nindex e20dd88..e96071d 100755\n--- c/git-am.sh\n+++ w/git-am.sh\n@@ -23,6 +23,7 @@ resolvemsg=     override error message when patch failure occurs\n 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 rebasing        (internal use for git-rebase)\"\n \n . git-sh-setup\n@@ -133,6 +134,7 @@ dotest=\"$GIT_DIR/rebase-apply\"\n sign= utf8=t keep= skip= interactive= resolved= rebasing= abort=\n resolvemsg= resume=\n git_apply_opt=\n+committer_date_is_author_date=\n \n while test $# != 0\n do\n@@ -168,6 +170,8 @@ do\n \t\tgit_apply_opt=\"$git_apply_opt $(sq \"$1=$2\")\"; shift ;;\n \t-C|-p)\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--)\n \t\tshift; break ;;\n \t*)\n@@ -521,7 +525,14 @@ do\n \n \ttree=$(git write-tree) &&\n \tparent=$(git rev-parse --verify HEAD) &&\n-\tcommit=$(git commit-tree $tree -p $parent <\"$dotest/final-commit\") &&\n+\tcommit=$(\n+\t\tif test -n \"$committer_date_is_author_date\"\n+\t\tthen\n+\t\t\tGIT_COMMITTER_DATE=\"$GIT_AUTHOR_DATE\"\n+\t\t\texport GIT_COMMITTER_DATE\n+\t\tfi &&\n+\t\tgit commit-tree $tree -p $parent <\"$dotest/final-commit\"\n+\t) &&\n \tgit update-ref -m \"$GIT_REFLOG_ACTION: $FIRSTLINE\" HEAD $commit $parent ||\n \tstop_here $this\n \ndiff --git c/t/t4150-am.sh w/t/t4150-am.sh\nindex 796f795..8d3fb00 100755\n--- c/t/t4150-am.sh\n+++ w/t/t4150-am.sh\n@@ -257,4 +257,24 @@ test_expect_success 'am works from file (absolute path given) in subdirectory' '\n \ttest -z \"$(git diff second)\"\n '\n \n+test_expect_success 'am --committer-date-is-author-date' '\n+\tgit checkout first &&\n+\ttest_tick &&\n+\tgit am --committer-date-is-author-date patch1 &&\n+\tgit cat-file commit HEAD | sed -e \"/^$/q\" >head1 &&\n+\tat=$(sed -ne \"/^author /s/.*> //p\" head1) &&\n+\tct=$(sed -ne \"/^committer /s/.*> //p\" head1) &&\n+\ttest \"$at\" = \"$ct\"\n+'\n+\n+test_expect_success 'am without --committer-date-is-author-date' '\n+\tgit checkout first &&\n+\ttest_tick &&\n+\tgit am patch1 &&\n+\tgit cat-file commit HEAD | sed -e \"/^$/q\" >head1 &&\n+\tat=$(sed -ne \"/^author /s/.*> //p\" head1) &&\n+\tct=$(sed -ne \"/^committer /s/.*> //p\" head1) &&\n+\ttest \"$at\" != \"$ct\"\n+'\n+\n test_done\n"},{"id":"101583","messageId":"alpine.DEB.1.00.0901230119490.3586@pacific.mpi-cbg.de","threadId":"17309","inReplyTo":"46d6db660901221441q60eb90bdge601a7a250c3a247@mail.gmail.com","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-23T00:21:21Z","receivedAt":"2009-01-23T00:21:21Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 22 Jan 2009, Christian MICHON wrote:\n\n> I've a big set of patches in a mbox file: there's sufficient info inside \n> for git-am to work.\n> \n> Yet, each time I do import these, my sha1sums are changing because of \n> different commit dates.\n> \n> I'd like to force the commit date to match the info/date from the time I \n> received the email (and therefore always get back the right sha1sums).\n> \n> is this possible ?\n\nHave you tried setting GIT_COMMITTER_DATE to the given date?\n\nAlternatively, you can always use a commit-message filter with \nfilter-branch to fix it up.\n\nCiao,\nDscho\n"},{"id":"101588","messageId":"20090123094529.6117@nanako3.lavabit.com","threadId":"17309","inReplyTo":"7vljt26fp9.fsf@gitster.siamese.dyndns.org","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-01-23T00:45:29Z","receivedAt":"2009-01-23T00:45:29Z","isPatch":false,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Junio C Hamano <gitster@pobox.com>:\n\n> Christian MICHON <christian.michon@gmail.com> writes:\n>\n>> I'd like to force the commit date to match the info/date from the time\n>> I received the email (and therefore always get back the right\n>> sha1sums).\n>>\n>> is this possible ?\n>\n> \"am\" being a tool to accept patches written in some past to faithfully\n> record both author timestamp and committer timestamp, what you seem to\n> want is outside of the current scope of the tool.\n>\n> A patch to butcher \"git-am\" to copy GIT_COMMITTER_DATE from\n> GIT_AUTHOR_DATE and export it should be trivial to implement, though.\n>\n> Perhaps something like this totally untested patch.\n\nYou have test scripts already, but you say it is untested?\n\nI often wanted to have an opposite of what Christian wants. I always have some changes I am holding off, and when I decide to trickle them out to the main repository, I do not want the resulting commit to carry old dates that are recorded in the format-patch output. Instead I want to pretend that I worked on them today. Is this something you can teach git-am and git-rebase to do easily?\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"101625","messageId":"7vwscm1nic.fsf@gitster.siamese.dyndns.org","threadId":"17309","inReplyTo":"20090123094529.6117@nanako3.lavabit.com","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-23T07:37:31Z","receivedAt":"2009-01-23T07:37:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nanako Shiraishi <nanako3@lavabit.com> writes:\n\n> Quoting Junio C Hamano <gitster@pobox.com>:\n>\n>> Perhaps something like this totally untested patch.\n>\n> You have test scripts already, but you say it is untested?\n\nCorrect.  I did not run that new test, let alone existing ones ;-)\n"},{"id":"101628","messageId":"46d6db660901230007x36368c79s724d1adb51d0818d@mail.gmail.com","threadId":"17309","inReplyTo":"alpine.DEB.1.00.0901230119490.3586@pacific.mpi-cbg.de","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Christian MICHON","fromEmail":"christian.michon@gmail.com","sentAt":"2009-01-23T08:07:58Z","receivedAt":"2009-01-23T08:07:58Z","isPatch":false,"sender":{"key":"christian.michon@gmail.com","avatar":"https://gravatar.com/avatar/8a7c327b21187fbcab5c27640a49450eec72e0355dc292501197f27a5a744ec4?d=mp&s=160"},"body":"On Fri, Jan 23, 2009 at 1:21 AM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> Hi,\n>\n> On Thu, 22 Jan 2009, Christian MICHON wrote:\n>\n>> I've a big set of patches in a mbox file: there's sufficient info inside\n>> for git-am to work.\n>>\n>> Yet, each time I do import these, my sha1sums are changing because of\n>> different commit dates.\n>>\n>> I'd like to force the commit date to match the info/date from the time I\n>> received the email (and therefore always get back the right sha1sums).\n>>\n>> is this possible ?\n>\n> Have you tried setting GIT_COMMITTER_DATE to the given date?\n\nyes, I did. This is what I want to change: I can fix the same\nGIT_COMMITTER_DATE for all patches in the mbox, but I really want +\n                   GIT_COMMITTER_DATE=GIT_AUTHOR_DATE\n\n\n>\n> Alternatively, you can always use a commit-message filter with\n> filter-branch to fix it up.\n>\n> Ciao,\n> Dscho\n>\n\nI'm curious if this could be done: the problem I quickly faced was\nthat this approach would double the amount of commits.\n\nSo I'm eager to test Junio's patch :)\n\n-- \nChristian\n--\nhttp://detaolb.sourceforge.net/, a linux distribution for Qemu with Git inside !\n"},{"id":"101629","messageId":"46d6db660901230008q418f3d3bsc68ca4e9d675cb36@mail.gmail.com","threadId":"17309","inReplyTo":"7vljt26fp9.fsf@gitster.siamese.dyndns.org","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Christian MICHON","fromEmail":"christian.michon@gmail.com","sentAt":"2009-01-23T08:08:44Z","receivedAt":"2009-01-23T08:08:44Z","isPatch":false,"sender":{"key":"christian.michon@gmail.com","avatar":"https://gravatar.com/avatar/8a7c327b21187fbcab5c27640a49450eec72e0355dc292501197f27a5a744ec4?d=mp&s=160"},"body":"On Fri, Jan 23, 2009 at 1:14 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Christian MICHON <christian.michon@gmail.com> writes:\n>\n>> I'd like to force the commit date to match the info/date from the time\n>> I received the email (and therefore always get back the right\n>> sha1sums).\n>>\n>> is this possible ?\n>\n> \"am\" being a tool to accept patches written in some past to faithfully\n> record both author timestamp and committer timestamp, what you seem to\n> want is outside of the current scope of the tool.\n>\n> A patch to butcher \"git-am\" to copy GIT_COMMITTER_DATE from\n> GIT_AUTHOR_DATE and export it should be trivial to implement, though.\n>\n> Perhaps something like this totally untested patch.\n>\n\nI love this idea. I'll try to test it asap. Thanks!\n\n-- \nChristian\n--\nhttp://detaolb.sourceforge.net/, a linux distribution for Qemu with Git inside !\n"},{"id":"101632","messageId":"20090123172646.6117@nanako3.lavabit.com","threadId":"17309","inReplyTo":"7vwscm1nic.fsf@gitster.siamese.dyndns.org","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-01-23T08:26:46Z","receivedAt":"2009-01-23T08:26:46Z","isPatch":false,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Junio C Hamano <gitster@pobox.com>:\n\n> Nanako Shiraishi <nanako3@lavabit.com> writes:\n>\n>> Quoting Junio C Hamano <gitster@pobox.com>:\n>>\n>>> Perhaps something like this totally untested patch.\n>>\n>> You have test scripts already, but you say it is untested?\n>\n> Correct.  I did not run that new test, let alone existing ones ;-)\n\nI applied your patch and run the test suite, including the new one, and they passed.\n\nI tried to write a new option I said that I wanted in my previous message.  Here is a patch.\n\n--->8---\nSubject: [PATCH] git-am: Add --ignore-date option\n\nThis new option makes the command ignore the date header field recorded in\nthe format-patch output.  The commits will have the timestamp when they\nare created instead.\n\nYou can work a lot in one day to accumulate many changes, but apply and\npush to the public repository only some of them at the end of the first\nday.  Then next day you can spend all your working hours reading comics or\nchatting with your coworkers, and apply your remaining patches from the\nprevious day using this option to pretend that you have been working at\nthe end of the day.\n\nSigned-off-by: しらいしななこ <nanako3@lavabit.com>\n---\n git-am.sh     |   12 +++++++++++-\n t/t4150-am.sh |    9 +++++++++\n 2 files changed, 20 insertions(+), 1 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex e96071d..eb88d90 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@@ -379,7 +383,13 @@ do\n \n \tGIT_AUTHOR_NAME=\"$(sed -n '/^Author/ s/Author: //p' \"$dotest/info\")\"\n \tGIT_AUTHOR_EMAIL=\"$(sed -n '/^Email/ s/Email: //p' \"$dotest/info\")\"\n-\tGIT_AUTHOR_DATE=\"$(sed -n '/^Date/ s/Date: //p' \"$dotest/info\")\"\n+\tcase \"$ignore_date\" in\n+\t    t)\n+\t\tGIT_AUTHOR_DATE=\"$(date -R)\"\n+\t\t;;\n+\t    '')\n+\t\tGIT_AUTHOR_DATE=\"$(sed -n '/^Date/ s/Date: //p' \"$dotest/info\")\"\n+\tesac\n \n \tif test -z \"$GIT_AUTHOR_EMAIL\"\n \tthen\ndiff --git a/t/t4150-am.sh b/t/t4150-am.sh\nindex 8d3fb00..5ecf456 100755\n--- a/t/t4150-am.sh\n+++ b/t/t4150-am.sh\n@@ -277,4 +277,13 @@ test_expect_success 'am without --committer-date-is-author-date' '\n \ttest \"$at\" != \"$ct\"\n '\n \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.224.gb56c7\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"101634","messageId":"46d6db660901230051x57be0119ge324e4e664b1c335@mail.gmail.com","threadId":"17309","inReplyTo":"46d6db660901230008q418f3d3bsc68ca4e9d675cb36@mail.gmail.com","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Christian MICHON","fromEmail":"christian.michon@gmail.com","sentAt":"2009-01-23T08:51:48Z","receivedAt":"2009-01-23T08:51:48Z","isPatch":false,"sender":{"key":"christian.michon@gmail.com","avatar":"https://gravatar.com/avatar/8a7c327b21187fbcab5c27640a49450eec72e0355dc292501197f27a5a744ec4?d=mp&s=160"},"body":"On Fri, Jan 23, 2009 at 9:08 AM, Christian MICHON\n<christian.michon@gmail.com> wrote:\n>> A patch to butcher \"git-am\" to copy GIT_COMMITTER_DATE from\n>> GIT_AUTHOR_DATE and export it should be trivial to implement, though.\n>>\n>> Perhaps something like this totally untested patch.\n>>\n>\n> I love this idea. I'll try to test it asap. Thanks!\n>\n\nworking fine! I've predictable/reproducible commits with this patch!\n\nmany thanks and kudos!\n\n-- \nChristian\n--\nhttp://detaolb.sourceforge.net/, a linux distribution for Qemu with Git inside !\n"},{"id":"101645","messageId":"7vtz7qxsxc.fsf@gitster.siamese.dyndns.org","threadId":"17309","inReplyTo":"20090123172646.6117@nanako3.lavabit.com","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-23T09:39:27Z","receivedAt":"2009-01-23T09:39:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nanako Shiraishi <nanako3@lavabit.com> writes:\n\n> Quoting Junio C Hamano <gitster@pobox.com>:\n>\n>> Correct.  I did not run that new test, let alone existing ones ;-)\n>\n> I applied your patch and run the test suite, including the new one, and they passed.\n\nThanks.\n\n> I tried to write a new option I said that I wanted in my previous message.  Here is a patch.\n>\n> --->8---\n> Subject: [PATCH] git-am: Add --ignore-date option\n\nGood.\n\nLeaving \"Subject: \" in saves me typing, because I do not have to insert it\nmanually when editing the submitted patch in my MUA to chop off everything\nbefore the scissors.\n\n> This new option makes the command ignore the date header field recorded in\n> the format-patch output.  The commits will have the timestamp when they\n> are created instead.\n>\n> You can work a lot in one day to accumulate many changes, but apply and\n> push to the public repository only some of them at the end of the first\n> day.  Then next day you can spend all your working hours reading comics or\n> chatting with your coworkers, and apply your remaining patches from the\n> previous day using this option to pretend that you have been working at\n> the end of the day.\n\nLOL.  A slacker option is a tough sell to a serious management, though.\n\nI think it would work equally well if you somehow manage to pass this\nthrough \"git-rebase\", but this won't work with \"git-rebase --interactive\".\n\n> @@ -379,7 +383,13 @@ do\n>  \n>  \tGIT_AUTHOR_NAME=\"$(sed -n '/^Author/ s/Author: //p' \"$dotest/info\")\"\n>  \tGIT_AUTHOR_EMAIL=\"$(sed -n '/^Email/ s/Email: //p' \"$dotest/info\")\"\n> -\tGIT_AUTHOR_DATE=\"$(sed -n '/^Date/ s/Date: //p' \"$dotest/info\")\"\n> +\tcase \"$ignore_date\" in\n> +\t    t)\n> +\t\tGIT_AUTHOR_DATE=\"$(date -R)\"\n> +\t\t;;\n> +\t    '')\n> +\t\tGIT_AUTHOR_DATE=\"$(sed -n '/^Date/ s/Date: //p' \"$dotest/info\")\"\n> +\tesac\n\nPlease align case arm labels with case/esac; iow, do not indent t) and '')\nby four spaces, when you write your next case/esac statement.\n\n\"date -R\" is a GNU extension; avoid it (I'll show you how at the end).\n\n> diff --git a/t/t4150-am.sh b/t/t4150-am.sh\n> index 8d3fb00..5ecf456 100755\n> --- a/t/t4150-am.sh\n> +++ b/t/t4150-am.sh\n> @@ -277,4 +277,13 @@ test_expect_success 'am without --committer-date-is-author-date' '\n>  \ttest \"$at\" != \"$ct\"\n>  '\n>  \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\nThis is a convoluted logic.\n\nThe committer and author dates are set to -0700 timezone by test_tick,\nwhile TZ is set to UTC (+0000) by test-lib.sh, and you are taking\nadvantage of them to see which one is being used.\n\nBut I do not think of a better way to do this offhand, so I'll let it\npass.\n\nRegarding the \"date -R\" thing, I think we can take advantage of the fact\nthat an empty GIT_AUTHOR_DATE (and GIT_COMMITTER_DATE) means \"do not use\nthis environment variable, but use the current date instead\".  Something\nlike this patch on top of yours, whose first hunk reverts your change to\nuse \"date -R\", and sets GIT_AUTHOR_DATE to empty when --ignore-date is\nasked for.\n\nNo, I didn't test it.\n\ndiff --git i/git-am.sh w/git-am.sh\nindex eb88d90..f935178 100755\n--- i/git-am.sh\n+++ w/git-am.sh\n@@ -383,13 +383,7 @@ do\n \n \tGIT_AUTHOR_NAME=\"$(sed -n '/^Author/ s/Author: //p' \"$dotest/info\")\"\n \tGIT_AUTHOR_EMAIL=\"$(sed -n '/^Email/ s/Email: //p' \"$dotest/info\")\"\n-\tcase \"$ignore_date\" in\n-\t    t)\n-\t\tGIT_AUTHOR_DATE=\"$(date -R)\"\n-\t\t;;\n-\t    '')\n-\t\tGIT_AUTHOR_DATE=\"$(sed -n '/^Date/ s/Date: //p' \"$dotest/info\")\"\n-\tesac\n+\tGIT_AUTHOR_DATE=\"$(sed -n '/^Date/ s/Date: //p' \"$dotest/info\")\"\n \n \tif test -z \"$GIT_AUTHOR_EMAIL\"\n \tthen\n@@ -536,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\"\n"},{"id":"101646","messageId":"20090123185209.6117@nanako3.lavabit.com","threadId":"17309","inReplyTo":"20090123172646.6117@nanako3.lavabit.com","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-01-23T09:52:09Z","receivedAt":"2009-01-23T09:52:09Z","isPatch":false,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"Quoting Junio C Hamano <gitster@pobox.com>:\n\n>> --->8---\n>> Subject: [PATCH] git-am: Add --ignore-date option\n>\n> Good.\n>\n> Leaving \"Subject: \" in saves me typing, because I do not have to insert it\n> manually when editing the submitted patch in my MUA to chop off everything\n> before the scissors.\n\nI am sorry to ask you a stupid question, but do you mean you want to have\n\"Subject: \" there, or do you mean you want me to leave that word out?\n\n> I think it would work equally well if you somehow manage to pass this\n> through \"git-rebase\", but this won't work with \"git-rebase --interactive\".\n\nI can try to change git-rebase if you want, but I do not think I can\nmodify git-rebase --interactive.  The script looked very scary last time I\nlooked at it (^_^;;;).\n\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> This is a convoluted logic.\n>\n> The committer and author dates are set to -0700 timezone by test_tick,\n> while TZ is set to UTC (+0000) by test-lib.sh, and you are taking\n> advantage of them to see which one is being used.\n>\n> But I do not think of a better way to do this offhand, so I'll let it\n> pass.\n>\n> Regarding the \"date -R\" thing, I think we can take advantage of the fact\n> that an empty GIT_AUTHOR_DATE (and GIT_COMMITTER_DATE) means \"do not use\n> this environment variable, but use the current date instead\".  Something\n> like this patch on top of yours, whose first hunk reverts your change to\n> use \"date -R\", and sets GIT_AUTHOR_DATE to empty when --ignore-date is\n> asked for.\n>\n> No, I didn't test it.\n\nI did, and it works.\n\nThank you very much.\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"},{"id":"101652","messageId":"alpine.DEB.1.00.0901231336080.3586@pacific.mpi-cbg.de","threadId":"17309","inReplyTo":"20090123172646.6117@nanako3.lavabit.com","subject":"Re: [PATCH] git-am: Add --ignore-date option","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-23T12:38:34Z","receivedAt":"2009-01-23T12:38:34Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\n[if you would have given a new mail subject to your mail, gitweb would \n stand a chance to find it]\n\nOn Fri, 23 Jan 2009, Nanako Shiraishi wrote:\n\n> Subject: [PATCH] git-am: Add --ignore-date option\n> \n> This new option makes the command ignore the date header field recorded in\n> the format-patch output.  The commits will have the timestamp when they\n> are created instead.\n> \n> You can work a lot in one day to accumulate many changes, but apply and\n> push to the public repository only some of them at the end of the first\n> day.  Then next day you can spend all your working hours reading comics or\n> chatting with your coworkers, and apply your remaining patches from the\n> previous day using this option to pretend that you have been working at\n> the end of the day.\n\nFWIW I have that problem in one of my workflows, and I do this:\n\n\tgrep -v \"^Date:\" < $MBOX | git am\n\nOf course, this assumes that none of my commit messages has the string \n\"Date:\" at the beginning of the line...\n\nCiao,\nDscho\n"},{"id":"101657","messageId":"20090123131711.GA11507@chistera.yi.org","threadId":"17309","inReplyTo":"alpine.DEB.1.00.0901231336080.3586@pacific.mpi-cbg.de","subject":"Re: [PATCH] git-am: Add --ignore-date option","fromName":"Adeodato Simó","fromEmail":"dato@net.com.org.es","sentAt":"2009-01-23T13:17:11Z","receivedAt":"2009-01-23T13:17:11Z","isPatch":true,"sender":{"key":"dato@net.com.org.es","avatar":"https://gravatar.com/avatar/952ec7d5d5663eb8baf631b5c37f9c58480a881920dd5f8a2d3a71f969b72b53?d=mp&s=160"},"body":"* Johannes Schindelin [Fri, 23 Jan 2009 13:38:34 +0100]:\n\n> FWIW I have that problem in one of my workflows, and I do this:\n> \tgrep -v \"^Date:\" < $MBOX | git am\n\n> Of course, this assumes that none of my commit messages has the string \n> \"Date:\" at the beginning of the line...\n\nIn case you're interested:\n\n    % formail -I 'Date' -s < $MBOX | git am\n\nis robust against your assumption being wrong. (I realize ^Date: is not\nvery likely in commit messages, but I thought I'd mention nevertheless.)\n\nCheers,\n\n-- \nAdeodato Simó                                     dato at net.com.org.es\nDebian Developer                                  adeodato at debian.org\n \n- Are you sure we're good?\n- Always.\n                -- Rory and Lorelai\n"},{"id":"101670","messageId":"7vprieue43.fsf@gitster.siamese.dyndns.org","threadId":"17309","inReplyTo":"20090123185209.6117@nanako3.lavabit.com","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-01-23T17:27:40Z","receivedAt":"2009-01-23T17:27:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nanako Shiraishi <nanako3@lavabit.com> writes:\n\n> Quoting Junio C Hamano <gitster@pobox.com>:\n>\n>>> --->8---\n>>> Subject: [PATCH] git-am: Add --ignore-date option\n>>\n>> Good.\n>>\n>> Leaving \"Subject: \" in saves me typing, because I do not have to insert it\n>> manually when editing the submitted patch in my MUA to chop off everything\n>> before the scissors.\n>\n> I am sorry to ask you a stupid question, but do you mean you want to have\n> \"Subject: \" there, or do you mean you want me to leave that word out?\n\nSorry for poor use of the language.  I want to see \"Subject: \" on the\nline after the scissors.  That way, I can remove everything up to the\nscissors, and the resulting message body will start with a line that\nbegins with \"Subject: \", which overrides the subject of the e-mail.\n"},{"id":"101699","messageId":"20090123222906.GC11328@coredump.intra.peff.net","threadId":"17309","inReplyTo":"7vtz7qxsxc.fsf@gitster.siamese.dyndns.org","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-01-23T22:29:06Z","receivedAt":"2009-01-23T22:29:06Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Jan 23, 2009 at 01:39:27AM -0800, Junio C Hamano wrote:\n\n> > --->8---\n> > Subject: [PATCH] git-am: Add --ignore-date option\n> \n> Good.\n> \n> Leaving \"Subject: \" in saves me typing, because I do not have to insert it\n> manually when editing the submitted patch in my MUA to chop off everything\n> before the scissors.\n\nInteresting to know. I have intentionally _not_ been including them,\nbecause I assumed you marked up _after_ git-am (i.e., via \"git commit\n--amend) in which case you would have to delete it manually. I suppose\nit makes more sense to do so before git-am, though, since then it will\nrespect From: fields and the like (which it would otherwise ignore,\nsince they are blocked by all of the cover letter cruft that you will\nend up deleting).\n\nSo good to know, and I will start generating my patches differently.\n\n-Peff\n"},{"id":"101711","messageId":"alpine.DEB.1.00.0901240133510.3586@pacific.mpi-cbg.de","threadId":"17309","inReplyTo":"20090123222906.GC11328@coredump.intra.peff.net","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-24T00:34:41Z","receivedAt":"2009-01-24T00:34:41Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 23 Jan 2009, Jeff King wrote:\n\n> On Fri, Jan 23, 2009 at 01:39:27AM -0800, Junio C Hamano wrote:\n> \n> > > --->8---\n> > > Subject: [PATCH] git-am: Add --ignore-date option\n> > \n> > Good.\n> > \n> > Leaving \"Subject: \" in saves me typing, because I do not have to insert it\n> > manually when editing the submitted patch in my MUA to chop off everything\n> > before the scissors.\n> \n> Interesting to know. I have intentionally _not_ been including them,\n> because I assumed you marked up _after_ git-am (i.e., via \"git commit\n> --amend) in which case you would have to delete it manually. I suppose\n> it makes more sense to do so before git-am, though, since then it will\n> respect From: fields and the like (which it would otherwise ignore,\n> since they are blocked by all of the cover letter cruft that you will\n> end up deleting).\n> \n> So good to know, and I will start generating my patches differently.\n\nNote that your patches will not be found using Pasky's \"mail\" link in \ngitweb, if you do not put the commit subject into the _real_ mail subject.\n\nDunno if I like that.\n\nCiao,\nDscho\n"},{"id":"101713","messageId":"20090124005225.GA9864@sigill.intra.peff.net","threadId":"17309","inReplyTo":"alpine.DEB.1.00.0901240133510.3586@pacific.mpi-cbg.de","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-01-24T00:52:25Z","receivedAt":"2009-01-24T00:52:25Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Jan 24, 2009 at 01:34:41AM +0100, Johannes Schindelin wrote:\n\n> > So good to know, and I will start generating my patches differently.\n> \n> Note that your patches will not be found using Pasky's \"mail\" link in \n> gitweb, if you do not put the commit subject into the _real_ mail subject.\n> \n> Dunno if I like that.\n\nI think that is not a new problem. Quite a few patches are \"how about\nthis\" patches in the middle of a thread, and leave the old subject.\nIMHO, that is a failing of the tool in not tracking common practice, not\nthe other way around.\n\n-Peff\n"},{"id":"101718","messageId":"alpine.DEB.1.00.0901240242270.3586@pacific.mpi-cbg.de","threadId":"17309","inReplyTo":"20090124005225.GA9864@sigill.intra.peff.net","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-01-24T01:43:47Z","receivedAt":"2009-01-24T01:43:47Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 23 Jan 2009, Jeff King wrote:\n\n> On Sat, Jan 24, 2009 at 01:34:41AM +0100, Johannes Schindelin wrote:\n> \n> > > So good to know, and I will start generating my patches differently.\n> > \n> > Note that your patches will not be found using Pasky's \"mail\" link in \n> > gitweb, if you do not put the commit subject into the _real_ mail subject.\n> > \n> > Dunno if I like that.\n> \n> I think that is not a new problem. Quite a few patches are \"how about\n> this\" patches in the middle of a thread, and leave the old subject.\n> IMHO, that is a failing of the tool in not tracking common practice, not\n> the other way around.\n\nYou know exactly what \"fixing the tool\" would mean.\n\nCiao,\nDscho\n"},{"id":"101724","messageId":"20090124023547.GA12311@coredump.intra.peff.net","threadId":"17309","inReplyTo":"alpine.DEB.1.00.0901240242270.3586@pacific.mpi-cbg.de","subject":"Re: how to force a commit date matching info from a mbox ?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-01-24T02:35:48Z","receivedAt":"2009-01-24T02:35:48Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Jan 24, 2009 at 02:43:47AM +0100, Johannes Schindelin wrote:\n\n> > I think that is not a new problem. Quite a few patches are \"how about\n> > this\" patches in the middle of a thread, and leave the old subject.\n> > IMHO, that is a failing of the tool in not tracking common practice, not\n> > the other way around.\n> \n> You know exactly what \"fixing the tool\" would mean.\n\nYes, I know. I think Pasky's tool is a clever hack, but I never expected\nit to be comprehensive in its results. At the GitTogether, we discussed\nsome interesting ideas for tracking the mailing list and showing a more\npatch-oriented view, but those would be a lot of work, and I am not\nvolunteering to do it right now.\n\nWhat I meant by my comment was that I am not too concerned with tweaking\nmy workflow to help Pasky's tool.\n\n-Peff\n"}]}