From 8ae023f40e28d98cc8d72e378fdcdd87b3bf4109 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 7 Feb 2011 19:04:34 +0200 Subject: Make commit script use editor to get commit message --- git/commit.sh | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'git/commit.sh') diff --git a/git/commit.sh b/git/commit.sh index 5c143d4..eb0613b 100755 --- a/git/commit.sh +++ b/git/commit.sh @@ -5,16 +5,34 @@ self=`realpath $0` . `dirname $self`/modules -if [ "$1" = "" ]; then -echo "missing commit message" 1>&2 -exit 1 +wd=`pwd` + +if [ "$EDITOR" = "" ]; then + echo "no editor specified with the EDITOR variable" 1>&2 + exit 1 fi -wd=`pwd` +msg_file=`mktemp -p /tmp` +$EDITOR "$msg_file" + +if [ $? -ne 0 ]; then + echo "$EDITOR failed" 1>&2 + rm -f $msg_file + exit 1 +fi + +if test ! -s "$msg_file"; then + echo "commit message is empty" 1>&2 + rm -f $msg_file + exit 1 +fi for i in $modules; do - cd $i 1>&2 + echo "commit $i" 1>&2 + cd $i git add . - git ci -m "$1" + git ci -F $msg_file cd $wd done + +rm -f $msg_file -- cgit v1.1