summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgit/commit.sh30
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