Accept -m and friends for initial commits and merge commits.
Yes it was irritating not to be able to do so. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
@ -110,47 +110,26 @@ t)
|
|||||||
fi
|
fi
|
||||||
esac
|
esac
|
||||||
|
|
||||||
PARENTS="-p HEAD"
|
if [ ! -r "$GIT_DIR/HEAD" ]
|
||||||
if [ ! -r "$GIT_DIR/HEAD" ]; then
|
then
|
||||||
if [ -z "$(git-ls-files)" ]; then
|
|
||||||
echo Nothing to commit 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
{
|
|
||||||
echo "#"
|
echo "#"
|
||||||
echo "# Initial commit"
|
echo "# Initial commit"
|
||||||
case "$no_edit" in
|
|
||||||
t) echo "# (ignoring your commit message for initial commit)"
|
|
||||||
no_edit=
|
|
||||||
esac
|
|
||||||
echo "#"
|
echo "#"
|
||||||
git-ls-files | sed 's/^/# New file: /'
|
git-ls-files | sed 's/^/# New file: /'
|
||||||
echo "#"
|
echo "#"
|
||||||
} >.editmsg
|
elif [ -f "$GIT_DIR/MERGE_HEAD" ]; then
|
||||||
PARENTS=""
|
|
||||||
no_edit=
|
|
||||||
else
|
|
||||||
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
|
|
||||||
{
|
|
||||||
echo "#"
|
echo "#"
|
||||||
echo "# It looks like your may be committing a MERGE."
|
echo "# It looks like your may be committing a MERGE."
|
||||||
echo "# If this is not correct, please remove the file"
|
echo "# If this is not correct, please remove the file"
|
||||||
echo "# $GIT_DIR/MERGE_HEAD"
|
echo "# $GIT_DIR/MERGE_HEAD"
|
||||||
echo "# and try again"
|
echo "# and try again"
|
||||||
case "$no_edit" in
|
|
||||||
t) echo "# (ignoring your commit message for merge commit)"
|
|
||||||
no_edit=
|
|
||||||
esac
|
|
||||||
echo "#"
|
echo "#"
|
||||||
} |
|
fi >.editmsg
|
||||||
git-stripspace >.editmsg
|
if test "$log_message" != ''
|
||||||
PARENTS="-p HEAD -p MERGE_HEAD"
|
then
|
||||||
elif test "$log_message" != ''
|
echo "$log_message"
|
||||||
then
|
elif test "$logfile" != ""
|
||||||
echo "$log_message" |
|
then
|
||||||
git-stripspace >.editmsg
|
|
||||||
elif test "$logfile" != ""
|
|
||||||
then
|
|
||||||
if test "$logfile" = -
|
if test "$logfile" = -
|
||||||
then
|
then
|
||||||
test -t 0 &&
|
test -t 0 &&
|
||||||
@ -158,9 +137,24 @@ else
|
|||||||
cat
|
cat
|
||||||
else
|
else
|
||||||
cat <"$logfile"
|
cat <"$logfile"
|
||||||
fi |
|
fi
|
||||||
git-stripspace >.editmsg
|
elif test "$use_commit" != ""
|
||||||
elif test "$use_commit" != ""
|
then
|
||||||
|
git-cat-file commit "$use_commit" | sed -e '1,/^$/d'
|
||||||
|
fi | git-stripspace >>.editmsg
|
||||||
|
|
||||||
|
PARENTS="-p HEAD"
|
||||||
|
if [ ! -r "$GIT_DIR/HEAD" ]; then
|
||||||
|
if [ -z "$(git-ls-files)" ]; then
|
||||||
|
echo Nothing to commit 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
PARENTS=""
|
||||||
|
else
|
||||||
|
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
|
||||||
|
PARENTS="-p HEAD -p MERGE_HEAD"
|
||||||
|
fi
|
||||||
|
if test "$use_commit" != ""
|
||||||
then
|
then
|
||||||
pick_author_script='
|
pick_author_script='
|
||||||
/^author /{
|
/^author /{
|
||||||
@ -188,22 +182,20 @@ else
|
|||||||
export GIT_AUTHOR_NAME
|
export GIT_AUTHOR_NAME
|
||||||
export GIT_AUTHOR_EMAIL
|
export GIT_AUTHOR_EMAIL
|
||||||
export GIT_AUTHOR_DATE
|
export GIT_AUTHOR_DATE
|
||||||
git-cat-file commit "$use_commit" |
|
|
||||||
sed -e '1,/^$/d' |
|
|
||||||
git-stripspace >.editmsg
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$signoff" in
|
case "$signoff" in
|
||||||
t)
|
t)
|
||||||
git-var GIT_COMMITTER_IDENT | sed -e '
|
git-var GIT_COMMITTER_IDENT | sed -e '
|
||||||
s/>.*/>/
|
s/>.*/>/
|
||||||
s/^/Signed-off-by: /' >>.editmsg ;;
|
s/^/Signed-off-by: /
|
||||||
|
' >>.editmsg
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
git-status-script >>.editmsg
|
git-status-script >>.editmsg
|
||||||
fi
|
fi
|
||||||
if [ "$?" != "0" -a ! -f $GIT_DIR/MERGE_HEAD ]
|
if [ "$?" != "0" -a ! -f $GIT_DIR/MERGE_HEAD ]
|
||||||
then
|
then
|
||||||
cat .editmsg
|
sed -ne '/^#/p' .editmsg
|
||||||
rm .editmsg
|
rm .editmsg
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user