Skip to content

Commit e7aac44

Browse files
davvidgitster
authored andcommitted
contrib/subtree: ignore log.date configuration
git-subtree's log format string uses "%ad" and "%cd", which respect the user's configured log.date value. This is problematic for git-subtree because it needs to use real dates so that copied commits come through unchanged. Add a test and tweak the format strings to use %aD and %cD so that the default date format is used instead. Reported-by: Bryan Jacobs <[email protected]> Signed-off-by: David Aguilar <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bb3e7b1 commit e7aac44

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

contrib/subtree/git-subtree.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ copy_commit()
298298
# We're going to set some environment vars here, so
299299
# do it in a subshell to get rid of them safely later
300300
debug copy_commit "{$1}" "{$2}" "{$3}"
301-
git log -1 --pretty=format:'%an%n%ae%n%ad%n%cn%n%ce%n%cd%n%B' "$1" |
301+
git log -1 --pretty=format:'%an%n%ae%n%aD%n%cn%n%ce%n%cD%n%B' "$1" |
302302
(
303303
read GIT_AUTHOR_NAME
304304
read GIT_AUTHOR_EMAIL

contrib/subtree/t/t7900-subtree.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ test_expect_success 'add sub3' '
9494
# Back to mainline
9595
cd ..
9696

97+
test_expect_success 'enable log.date=relative to catch errors' '
98+
git config log.date relative
99+
'
100+
97101
test_expect_success 'add main4' '
98102
create main4 &&
99103
git commit -m "main4" &&

0 commit comments

Comments
 (0)