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 <b@q3q.us> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

David Aguilar committed Jul 21, 2015 at 17:01 UTC e7aac44ed276bc0de0253baa8e3f5ac247044a31
2 files changed +5 -1
contrib/subtree/git-subtree.sh
+1 -1
@@ -298,7 +298,7 @@ copy_commit()
298 # We're going to set some environment vars here, so
299 # do it in a subshell to get rid of them safely later
300 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" |
302 (
303 read GIT_AUTHOR_NAME
304 read GIT_AUTHOR_EMAIL
contrib/subtree/t/t7900-subtree.sh
+4
@@ -94,6 +94,10 @@ test_expect_success 'add sub3' '
94 # Back to mainline
95 cd ..
96
97 +test_expect_success 'enable log.date=relative to catch errors' '
98 + git config log.date relative
99 +'
100 +
101 test_expect_success 'add main4' '
102 create main4 &&
103 git commit -m "main4" &&