[PATCH] honor --author even with --amend, -C, and -c.

Earlier code discarded GIT_AUTHOR_DATE taken from the base
commit when --author was specified.  This was often wrong as
that use is likely to fix the spelling of author's name.

Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
Junio C Hamano 2007-01-22 13:03:31 -08:00 committed by Junio C Hamano
parent 5e207b4bf8
commit 83e24dce14

View File

@ -462,15 +462,7 @@ if test -f "$GIT_DIR/MERGE_HEAD" && test -z "$no_edit"; then
fi >>"$GIT_DIR"/COMMIT_EDITMSG fi >>"$GIT_DIR"/COMMIT_EDITMSG
# Author # Author
if test '' != "$force_author" if test '' != "$use_commit"
then
GIT_AUTHOR_NAME=`expr "z$force_author" : 'z\(.*[^ ]\) *<.*'` &&
GIT_AUTHOR_EMAIL=`expr "z$force_author" : '.*\(<.*\)'` &&
test '' != "$GIT_AUTHOR_NAME" &&
test '' != "$GIT_AUTHOR_EMAIL" ||
die "malformed --author parameter"
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
elif test '' != "$use_commit"
then then
pick_author_script=' pick_author_script='
/^author /{ /^author /{
@ -501,6 +493,15 @@ then
export GIT_AUTHOR_EMAIL export GIT_AUTHOR_EMAIL
export GIT_AUTHOR_DATE export GIT_AUTHOR_DATE
fi fi
if test '' != "$force_author"
then
GIT_AUTHOR_NAME=`expr "z$force_author" : 'z\(.*[^ ]\) *<.*'` &&
GIT_AUTHOR_EMAIL=`expr "z$force_author" : '.*\(<.*\)'` &&
test '' != "$GIT_AUTHOR_NAME" &&
test '' != "$GIT_AUTHOR_EMAIL" ||
die "malformed --author parameter"
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
fi
PARENTS="-p HEAD" PARENTS="-p HEAD"
if test -z "$initial_commit" if test -z "$initial_commit"