git-commit: do not muck with commit message when no_edit is set.
Spotted by Linus and Darrin Thompson. When we took a commit message from -F <file> with an incomplete line, we appended "git status" output, which ended up attaching a lone "#" at the end. We still need the "do we have anything to commit?" check by running "status" (which has to know what to do in different cases with -i/-o/-a), but there is no point appending its output to the proposed commit message given by the user. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
@ -537,7 +537,7 @@ t)
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
|
if test -f "$GIT_DIR/MERGE_HEAD" && test -z "$no_edit"; then
|
||||||
echo "#"
|
echo "#"
|
||||||
echo "# It looks like you may be committing a MERGE."
|
echo "# It looks like you 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"
|
||||||
@ -605,16 +605,23 @@ else
|
|||||||
current=
|
current=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test -z "$no_edit"
|
||||||
|
then
|
||||||
{
|
{
|
||||||
test -z "$only_include_assumed" || echo "$only_include_assumed"
|
test -z "$only_include_assumed" || echo "$only_include_assumed"
|
||||||
run_status
|
run_status
|
||||||
} >>"$GIT_DIR"/COMMIT_EDITMSG
|
} >>"$GIT_DIR"/COMMIT_EDITMSG
|
||||||
|
else
|
||||||
|
# we need to check if there is anything to commit
|
||||||
|
run_status >/dev/null
|
||||||
|
fi
|
||||||
if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" -a -z "$amend" ]
|
if [ "$?" != "0" -a ! -f "$GIT_DIR/MERGE_HEAD" -a -z "$amend" ]
|
||||||
then
|
then
|
||||||
rm -f "$GIT_DIR/COMMIT_EDITMSG"
|
rm -f "$GIT_DIR/COMMIT_EDITMSG"
|
||||||
run_status
|
run_status
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$no_edit" in
|
case "$no_edit" in
|
||||||
'')
|
'')
|
||||||
case "${VISUAL:-$EDITOR},$TERM" in
|
case "${VISUAL:-$EDITOR},$TERM" in
|
||||||
|
Reference in New Issue
Block a user