pgit.sh: Make commit check if there's a diff before running commit

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2017-06-12 09:11:28 +00:00
commit 763d18f350

View file

@ -40,7 +40,7 @@ config()
run_git() run_git()
{ {
marker git "$@" marker git "$@"
eval git "$@" git "$@"
} }
# ------------- commands # ------------- commands
@ -59,6 +59,23 @@ run()
done done
)} )}
commit()
{(
local d
config
cd $pdir
if [ "$PGIT_KEEP_GOING" != y ]; then set -e; fi
for d in $pdirs; do
if run_git -C $d diff --quiet; then
log "Nothing to commit"
continue
fi
run_git -C $d commit "$@"
done
)}
clone() clone()
{( {(
local p local p
@ -129,7 +146,7 @@ SSH=ssh
cmd=$1 cmd=$1
shift shift
case $cmd in case $cmd in
clone|diff) clone|diff|commit)
$cmd "$@" $cmd "$@"
;; ;;
*) *)