File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ resolvemsg= override error message when patch failure occurs
24
24
r,resolved to be used after a patch failure
25
25
skip skip the current patch
26
26
abort restore the original branch and abort the patching operation.
27
+ committer-date-is-author-date lie about committer date
27
28
rebasing (internal use for git-rebase)"
28
29
29
30
. git-sh-setup
@@ -134,6 +135,7 @@ dotest="$GIT_DIR/rebase-apply"
134
135
sign= utf8=t keep= skip= interactive= resolved= rebasing= abort=
135
136
resolvemsg= resume=
136
137
git_apply_opt=
138
+ committer_date_is_author_date=
137
139
138
140
while test $# ! = 0
139
141
do
171
173
git_apply_opt=" $git_apply_opt $( sq " $1$2 " ) " ; shift ;;
172
174
--reject)
173
175
git_apply_opt=" $git_apply_opt $1 " ;;
176
+ --committer-date-is-author-date)
177
+ committer_date_is_author_date=t ;;
174
178
--)
175
179
shift ; break ;;
176
180
* )
524
528
525
529
tree=$( git write-tree) &&
526
530
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
+ ) &&
528
539
git update-ref -m " $GIT_REFLOG_ACTION : $FIRSTLINE " HEAD $commit $parent ||
529
540
stop_here $this
530
541
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' '
257
257
test -z "$(git diff second)"
258
258
'
259
259
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
+
260
280
test_done
You can’t perform that action at this time.
0 commit comments