aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/git-sync10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/git-sync b/scripts/git-sync
index deb19bc..10fc0c5 100755
--- a/scripts/git-sync
+++ b/scripts/git-sync
@@ -1,5 +1,5 @@
#!/bin/bash
-set -e
+set -eu
hosthash=$(python3 -c "import uuid, hashlib
print(hashlib.new('sha1', str(uuid.getnode()).encode('utf8')).hexdigest())")
@@ -32,7 +32,9 @@ fi
echo 'Sync: git autocommit'
git add -A "./$(git rev-parse --show-cdup)"
-git commit -m "Auto-commit on ${hosthash}" >/dev/null 2>&1 || true
+if git commit --dry-run --short; then
+ git commit -m "Auto-commit on ${hosthash}"
+fi
echo 'Sync: fetch and merge'
@@ -62,7 +64,9 @@ git status --porcelain | while read -r filename; do
done
# no action is done if there is nothing to commit
-git commit -m "$conflict_message" || true
+if git commit --dry-run --short; then
+ git commit -m "$conflict_message"
+fi
# should not fail again
git merge -m "$conflict_message"