File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ resolvemsg= override error message when patch failure occurs
2424r,resolved to be used after a patch failure
2525skip skip the current patch
2626abort restore the original branch and abort the patching operation.
27+ committer-date-is-author-date lie about committer date
2728rebasing (internal use for git-rebase)"
2829
2930. git-sh-setup
@@ -134,6 +135,7 @@ dotest="$GIT_DIR/rebase-apply"
134135sign= utf8=t keep= skip= interactive= resolved= rebasing= abort=
135136resolvemsg= resume=
136137git_apply_opt=
138+ committer_date_is_author_date=
137139
138140while test $# ! = 0
139141do
171173 git_apply_opt=" $git_apply_opt $( sq " $1$2 " ) " ; shift ;;
172174 --reject)
173175 git_apply_opt=" $git_apply_opt $1 " ;;
176+ --committer-date-is-author-date)
177+ committer_date_is_author_date=t ;;
174178 --)
175179 shift ; break ;;
176180 * )
524528
525529 tree=$( git write-tree) &&
526530 parent=$( git rev-parse --verify HEAD) &&
527- commit=$( git commit-tree $tree -p $parent < " $dotest /final-commit" ) &&
531+ commit=$(
532+ if test -n " $committer_date_is_author_date "
533+ then
534+ GIT_COMMITTER_DATE=" $GIT_AUTHOR_DATE "
535+ export GIT_COMMITTER_DATE
536+ fi &&
537+ git commit-tree $tree -p $parent < " $dotest /final-commit"
538+ ) &&
528539 git update-ref -m " $GIT_REFLOG_ACTION : $FIRSTLINE " HEAD $commit $parent ||
529540 stop_here $this
530541
Original file line number Diff line number Diff line change @@ -257,4 +257,24 @@ test_expect_success 'am works from file (absolute path given) in subdirectory' '
257257 test -z "$(git diff second)"
258258'
259259
260+ test_expect_success ' am --committer-date-is-author-date' '
261+ git checkout first &&
262+ test_tick &&
263+ git am --committer-date-is-author-date patch1 &&
264+ git cat-file commit HEAD | sed -e "/^$/q" >head1 &&
265+ at=$(sed -ne "/^author /s/.*> //p" head1) &&
266+ ct=$(sed -ne "/^committer /s/.*> //p" head1) &&
267+ test "$at" = "$ct"
268+ '
269+
270+ test_expect_success ' am without --committer-date-is-author-date' '
271+ git checkout first &&
272+ test_tick &&
273+ git am patch1 &&
274+ git cat-file commit HEAD | sed -e "/^$/q" >head1 &&
275+ at=$(sed -ne "/^author /s/.*> //p" head1) &&
276+ ct=$(sed -ne "/^committer /s/.*> //p" head1) &&
277+ test "$at" != "$ct"
278+ '
279+
260280test_done
You can’t perform that action at this time.
0 commit comments