summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-08-26 01:57:35 (GMT)
committerJunio C Hamano <junkio@cox.net>2005-08-27 05:36:54 (GMT)
commitaba2da13391d2adc72c0a2805e7196db2c803753 (patch)
tree2199c82aa658a5c70597d0ab879b77ca9d03a283
parent7311d9f10476f9b478348dab597bcc3d8736f091 (diff)
downloadgit-aba2da13391d2adc72c0a2805e7196db2c803753.zip
git-aba2da13391d2adc72c0a2805e7196db2c803753.tar.gz
git-aba2da13391d2adc72c0a2805e7196db2c803753.tar.bz2
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>
-rwxr-xr-xgit-commit-script86
1 files changed, 39 insertions, 47 deletions
diff --git a/git-commit-script b/git-commit-script
index 5c5f564..e47a090 100755
--- a/git-commit-script
+++ b/git-commit-script
@@ -110,57 +110,51 @@ t)
fi
esac
+if [ ! -r "$GIT_DIR/HEAD" ]
+then
+ echo "#"
+ echo "# Initial commit"
+ echo "#"
+ git-ls-files | sed 's/^/# New file: /'
+ echo "#"
+elif [ -f "$GIT_DIR/MERGE_HEAD" ]; then
+ echo "#"
+ echo "# It looks like your may be committing a MERGE."
+ echo "# If this is not correct, please remove the file"
+ echo "# $GIT_DIR/MERGE_HEAD"
+ echo "# and try again"
+ echo "#"
+fi >.editmsg
+if test "$log_message" != ''
+then
+ echo "$log_message"
+elif test "$logfile" != ""
+then
+ if test "$logfile" = -
+ then
+ test -t 0 &&
+ echo >&2 "(reading log message from standard input)"
+ cat
+ else
+ cat <"$logfile"
+ fi
+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
- {
- echo "#"
- echo "# Initial commit"
- case "$no_edit" in
- t) echo "# (ignoring your commit message for initial commit)"
- no_edit=
- esac
- echo "#"
- git-ls-files | sed 's/^/# New file: /'
- echo "#"
- } >.editmsg
PARENTS=""
- no_edit=
else
if [ -f "$GIT_DIR/MERGE_HEAD" ]; then
- {
- echo "#"
- echo "# It looks like your may be committing a MERGE."
- echo "# If this is not correct, please remove the file"
- echo "# $GIT_DIR/MERGE_HEAD"
- echo "# and try again"
- case "$no_edit" in
- t) echo "# (ignoring your commit message for merge commit)"
- no_edit=
- esac
- echo "#"
- } |
- git-stripspace >.editmsg
PARENTS="-p HEAD -p MERGE_HEAD"
- elif test "$log_message" != ''
- then
- echo "$log_message" |
- git-stripspace >.editmsg
- elif test "$logfile" != ""
- then
- if test "$logfile" = -
- then
- test -t 0 &&
- echo >&2 "(reading log message from standard input)"
- cat
- else
- cat <"$logfile"
- fi |
- git-stripspace >.editmsg
- elif test "$use_commit" != ""
+ fi
+ if test "$use_commit" != ""
then
pick_author_script='
/^author /{
@@ -188,22 +182,20 @@ else
export GIT_AUTHOR_NAME
export GIT_AUTHOR_EMAIL
export GIT_AUTHOR_DATE
- git-cat-file commit "$use_commit" |
- sed -e '1,/^$/d' |
- git-stripspace >.editmsg
fi
-
case "$signoff" in
t)
git-var GIT_COMMITTER_IDENT | sed -e '
s/>.*/>/
- s/^/Signed-off-by: /' >>.editmsg ;;
+ s/^/Signed-off-by: /
+ ' >>.editmsg
+ ;;
esac
git-status-script >>.editmsg
fi
if [ "$?" != "0" -a ! -f $GIT_DIR/MERGE_HEAD ]
then
- cat .editmsg
+ sed -ne '/^#/p' .editmsg
rm .editmsg
exit 1
fi