From 3f01ad665493e09aa816d84a872d9874f33a8c16 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 22 Jan 2009 16:14:58 -0800 Subject: am: Add --committer-date-is-author-date option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This new option tells 'git-am' to use the timestamp recorded in the Email message as both author and committer date. Signed-off-by: しらいしななこ Signed-off-by: Junio C Hamano --- git-am.sh | 13 ++++++++++++- t/t4150-am.sh | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/git-am.sh b/git-am.sh index b1c05c9db..e726f1714 100755 --- a/git-am.sh +++ b/git-am.sh @@ -24,6 +24,7 @@ resolvemsg= override error message when patch failure occurs r,resolved to be used after a patch failure skip skip the current patch abort restore the original branch and abort the patching operation. +committer-date-is-author-date lie about committer date rebasing (internal use for git-rebase)" . git-sh-setup @@ -134,6 +135,7 @@ dotest="$GIT_DIR/rebase-apply" sign= utf8=t keep= skip= interactive= resolved= rebasing= abort= resolvemsg= resume= git_apply_opt= +committer_date_is_author_date= while test $# != 0 do @@ -171,6 +173,8 @@ do git_apply_opt="$git_apply_opt $(sq "$1$2")"; shift ;; --reject) git_apply_opt="$git_apply_opt $1" ;; + --committer-date-is-author-date) + committer_date_is_author_date=t ;; --) shift; break ;; *) @@ -524,7 +528,14 @@ do tree=$(git write-tree) && parent=$(git rev-parse --verify HEAD) && - commit=$(git commit-tree $tree -p $parent <"$dotest/final-commit") && + commit=$( + if test -n "$committer_date_is_author_date" + then + GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" + export GIT_COMMITTER_DATE + fi && + git commit-tree $tree -p $parent <"$dotest/final-commit" + ) && git update-ref -m "$GIT_REFLOG_ACTION: $FIRSTLINE" HEAD $commit $parent || stop_here $this diff --git a/t/t4150-am.sh b/t/t4150-am.sh index 796f79526..8d3fb00cd 100755 --- a/t/t4150-am.sh +++ b/t/t4150-am.sh @@ -257,4 +257,24 @@ test_expect_success 'am works from file (absolute path given) in subdirectory' ' test -z "$(git diff second)" ' +test_expect_success 'am --committer-date-is-author-date' ' + git checkout first && + test_tick && + git am --committer-date-is-author-date patch1 && + git cat-file commit HEAD | sed -e "/^$/q" >head1 && + at=$(sed -ne "/^author /s/.*> //p" head1) && + ct=$(sed -ne "/^committer /s/.*> //p" head1) && + test "$at" = "$ct" +' + +test_expect_success 'am without --committer-date-is-author-date' ' + git checkout first && + test_tick && + git am patch1 && + git cat-file commit HEAD | sed -e "/^$/q" >head1 && + at=$(sed -ne "/^author /s/.*> //p" head1) && + ct=$(sed -ne "/^committer /s/.*> //p" head1) && + test "$at" != "$ct" +' + test_done -- cgit v1.2.1 From a79ec62d064e32b5c3979a16d215fdb70fe965c0 Mon Sep 17 00:00:00 2001 From: Nanako Shiraishi Date: Sat, 24 Jan 2009 10:18:02 +0900 Subject: git-am: Add --ignore-date option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This new option tells 'git-am' to ignore the date header field recorded in the format-patch output. The commits will have the timestamp when they are created instead. You can work a lot in one day to accumulate many changes, but apply and push to the public repository only some of them at the end of the first day. Then next day you can spend all your working hours reading comics or chatting with your coworkers, and apply your remaining patches from the previous day using this option to pretend that you have been working at the end of the day. Signed-off-by: しらいしななこ Signed-off-by: Junio C Hamano --- Documentation/git-am.txt | 17 ++++++++++++++++- git-am.sh | 8 ++++++++ t/t4150-am.sh | 13 +++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/Documentation/git-am.txt b/Documentation/git-am.txt index efd311b1c..ff307eb27 100644 --- a/Documentation/git-am.txt +++ b/Documentation/git-am.txt @@ -10,7 +10,8 @@ SYNOPSIS -------- [verse] 'git am' [--signoff] [--keep] [--utf8 | --no-utf8] - [--3way] [--interactive] + [--3way] [--interactive] [--committer-date-is-author-date] + [--ignore-date] [--whitespace=