diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-02-07 19:04:34 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-02-07 19:04:34 +0200 |
commit | 8ae023f40e28d98cc8d72e378fdcdd87b3bf4109 (patch) | |
tree | 9daf9bf3fd283734ff15fb6b5c827325cebd8b2b /git/commit.sh | |
parent | b9402bd52dc47ef3b6bf439276ec536fe9ddb18a (diff) |
Make commit script use editor to get commit message
Diffstat (limited to 'git/commit.sh')
-rwxr-xr-x | git/commit.sh | 30 |
1 files changed, 24 insertions, 6 deletions
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 |