From d99e7de5de3a74cad3e12cd2dbce8d5d6bf9ee97 Mon Sep 17 00:00:00 2001 From: vg Date: Sat, 17 Feb 2018 12:36:23 +0100 Subject: be less verbose by default for git-sync --- scripts/git-sync | 25 ++++++++++++++++++------- 1 file 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 -- cgit v1.2.3