{"thread":{"id":"17332","subject":"[PATCH 1/2] am: Add --committer-date-is-author-date option","startedAt":"2009-01-24T01:17:50Z","lastAt":"2009-01-24T01:17:50Z","messageCount":1,"participants":["Nanako Shiraishi"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"101715","messageId":"20090124101750.6117@nanako3.lavabit.com","threadId":"17332","inReplyTo":null,"subject":"[PATCH 1/2] am: Add --committer-date-is-author-date option","fromName":"Nanako Shiraishi","fromEmail":"nanako3@lavabit.com","sentAt":"2009-01-24T01:17:50Z","receivedAt":"2009-01-24T01:17:50Z","isPatch":true,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"From: Junio C Hamano <gitster@pobox.com>\nDate: Thu, 22 Jan 2009 16:14:58 -0800\n\nThis new option tells 'git-am' to use the timestamp recorded\nin the Email message as both author and committer date.\n\nSigned-off-by: しらいしななこ <nanako3@lavabit.com>\n---\n git-am.sh     |   13 ++++++++++++-\n t/t4150-am.sh |   20 ++++++++++++++++++++\n 2 files changed, 32 insertions(+), 1 deletions(-)\n\ndiff --git a/git-am.sh b/git-am.sh\nindex e20dd88..e96071d 100755\n--- a/git-am.sh\n+++ b/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 a/t/t4150-am.sh b/t/t4150-am.sh\nindex 796f795..8d3fb00 100755\n--- a/t/t4150-am.sh\n+++ b/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-- \n1.6.1\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n"}]}