Skip to content

Commit

Permalink
contrib/subtree: ignore log.date configuration
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
davvid authored and gitster committed Jul 23, 2015
1 parent bb3e7b1 commit e7aac44
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion contrib/subtree/git-subtree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions contrib/subtree/t/t7900-subtree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" &&
Expand Down

0 comments on commit e7aac44

Please sign in to comment.