Skip to content

Commit d63c2fd

Browse files
Kristian Høgsberggitster
authored andcommitted
Add testcase for amending and fixing author in git commit.
We used to clobber author time, but we shouldn't. Signed-off-by: Kristian Høgsberg <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 193f7e9 commit d63c2fd

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

t/t7501-commit.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,4 +242,19 @@ test_expect_success 'multiple -m' '
242242
243243
'
244244

245+
author="The Real Author <[email protected]>"
246+
test_expect_success 'amend commit to fix author' '
247+
248+
oldtick=$GIT_AUTHOR_DATE &&
249+
test_tick &&
250+
git reset --hard &&
251+
git cat-file -p HEAD |
252+
sed -e "s/author.*/author $author $oldtick/" \
253+
-e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \
254+
expected &&
255+
git commit --amend --author="$author" &&
256+
git cat-file -p HEAD > current &&
257+
diff expected current
258+
259+
'
245260
test_done

0 commit comments

Comments
 (0)