]> granicus.if.org Git - git/commitdiff
contrib/subtree: ignore log.date configuration
authorDavid Aguilar <davvid@gmail.com>
Wed, 22 Jul 2015 00:01:02 +0000 (17:01 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 23 Jul 2015 22:08:41 +0000 (15:08 -0700)
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>
contrib/subtree/git-subtree.sh
contrib/subtree/t/t7900-subtree.sh

index fa1a5839af2d0c423adb51238fb330f555dc4dff..39c7d54ce8029369189e2f796d658a65a61fd402 100755 (executable)
@@ -298,7 +298,7 @@ copy_commit()
        # We're going to set some environment vars here, so
        # do it in a subshell to get rid of them safely later
        debug copy_commit "{$1}" "{$2}" "{$3}"
-       git log -1 --pretty=format:'%an%n%ae%n%ad%n%cn%n%ce%n%cd%n%B' "$1" |
+       git log -1 --pretty=format:'%an%n%ae%n%aD%n%cn%n%ce%n%cD%n%B' "$1" |
        (
                read GIT_AUTHOR_NAME
                read GIT_AUTHOR_EMAIL
index 6309d124ca2c97b2b1b9262c7b9470c576870069..da709f96e57d3395b976968048a12bee005efcb9 100755 (executable)
@@ -94,6 +94,10 @@ test_expect_success 'add sub3' '
 # Back to mainline
 cd ..
 
+test_expect_success 'enable log.date=relative to catch errors' '
+       git config log.date relative
+'
+
 test_expect_success 'add main4' '
         create main4 &&
         git commit -m "main4" &&