git-commit: filter out log message lines only when editor was run.
The current behaviour strips out lines starting with a # even when fed through stdin or -m. This is particularly bad when importing history from another SCM (tailor 0.9.23 uses git-commit). In the best cases all lines are stripped and the commit fails with a confusing "empty log message" error, but in many cases the commit is done, with loss of information. Note that it is quite peculiar to just have "#" handled as a leading comment char here. One commonly meet CVS: or CG: or STG: as prefixes, and using GIT: would be more robust as well as consistent with other commit tools. However, that would break any tool relying on the # (if any). Signed-off-by: Yann Dirson <ydirson@altern.org> Signed-off-by: Junio C Hamano <junkio@cox.net>maint
parent
817151e61a
commit
29f4ad867c
|
@ -693,13 +693,18 @@ t)
|
||||||
fi
|
fi
|
||||||
esac
|
esac
|
||||||
|
|
||||||
sed -e '
|
if test -z "$no_edit"
|
||||||
/^diff --git a\/.*/{
|
then
|
||||||
s///
|
sed -e '
|
||||||
q
|
/^diff --git a\/.*/{
|
||||||
}
|
s///
|
||||||
/^#/d
|
q
|
||||||
' "$GIT_DIR"/COMMIT_EDITMSG |
|
}
|
||||||
|
/^#/d
|
||||||
|
' "$GIT_DIR"/COMMIT_EDITMSG
|
||||||
|
else
|
||||||
|
cat "$GIT_DIR"/COMMIT_EDITMSG
|
||||||
|
fi |
|
||||||
git-stripspace >"$GIT_DIR"/COMMIT_MSG
|
git-stripspace >"$GIT_DIR"/COMMIT_MSG
|
||||||
|
|
||||||
if cnt=`grep -v -i '^Signed-off-by' "$GIT_DIR"/COMMIT_MSG |
|
if cnt=`grep -v -i '^Signed-off-by' "$GIT_DIR"/COMMIT_MSG |
|
||||||
|
|
Loading…
Reference in New Issue