aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvg <vg@devys.org>2018-02-17 12:36:23 +0100
committervg <vg@devys.org>2018-02-17 12:36:23 +0100
commitd99e7de5de3a74cad3e12cd2dbce8d5d6bf9ee97 (patch)
treef8879288c04ba2c2c6e87d65b086099ff544ab35
parent620cfc0bbf6fe04d4969bfb8a875c6ee6745eb86 (diff)
downloadscripts-d99e7de5de3a74cad3e12cd2dbce8d5d6bf9ee97.tar.gz
scripts-d99e7de5de3a74cad3e12cd2dbce8d5d6bf9ee97.tar.bz2
scripts-d99e7de5de3a74cad3e12cd2dbce8d5d6bf9ee97.zip
be less verbose by default for git-sync
-rwxr-xr-xscripts/git-sync25
1 files changed, 18 insertions, 7 deletions
diff --git a/scripts/git-sync b/scripts/git-sync
index fa4d786..17db0f6 100755
--- a/scripts/git-sync
+++ b/scripts/git-sync
@@ -1,6 +1,7 @@
#!/bin/bash
set -eu
+verbose=0
hosthash=$(python3 -c "import uuid, hashlib
print(hashlib.new('sha1', str(uuid.getnode()).encode('utf8')).hexdigest())")
@@ -30,21 +31,27 @@ if [ "$(git config --get --bool branch.${branch_name}.sync)" != "true" ]; then
exit 1
fi
-echo 'Sync: git autocommit'
+if [ "$verbose" -ne 0 ]; then
+ echo 'Sync: git autocommit'
+fi
git add -A "./$(git rev-parse --show-cdup)"
if git status --porcelain | grep -q .; then
git status --short
git commit -m "Auto-commit on ${hosthash}"
fi
-echo 'Sync: fetch and merge'
+if [ "$verbose" -ne 0 ]; then
+ echo 'Sync: fetch and merge'
+fi
-git fetch
+git fetch --quiet
# might fail one time if conflict detected
git merge -m "$conflict_message" || true
-echo 'Sync: conflict autocommit'
+if [ "$verbose" -ne 0 ]; then
+ echo 'Sync: conflict autocommit'
+fi
git status --porcelain | while read -r filename; do
state="${filename:0:2}"
@@ -73,8 +80,12 @@ fi
# should not fail again
git merge -m "$conflict_message"
-echo 'Sync: pushing changes'
+if [ "$verbose" -ne 0 ]; then
+ echo 'Sync: pushing changes'
+fi
-git push
+git push --quiet
-echo 'Sync: done'
+if [ "$verbose" -ne 0 ]; then
+ echo 'Sync: done'
+fi