]> asedeno.scripts.mit.edu Git - git.git/commitdiff
Add testcase for amending and fixing author in git commit.
authorKristian Høgsberg <krh@redhat.com>
Fri, 2 Nov 2007 15:33:06 +0000 (11:33 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 23 Nov 2007 01:04:56 +0000 (17:04 -0800)
We used to clobber author time, but we shouldn't.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7501-commit.sh

index 9dba104b1f8bf9125f1a947a2fd115b684a94095..e601028d02de80cf718f9b9567285f12e7468b26 100755 (executable)
@@ -242,4 +242,19 @@ test_expect_success 'multiple -m' '
 
 '
 
+author="The Real Author <someguy@his.email.org>"
+test_expect_success 'amend commit to fix author' '
+
+       oldtick=$GIT_AUTHOR_DATE &&
+       test_tick &&
+       git reset --hard &&
+       git cat-file -p HEAD |
+       sed -e "s/author.*/author $author $oldtick/" \
+               -e "s/^\(committer.*> \).*$/\1$GIT_COMMITTER_DATE/" > \
+               expected &&
+       git commit --amend --author="$author" &&
+       git cat-file -p HEAD > current &&
+       diff expected current
+
+'
 test_done