[X2Go-Commits] [buildscripts] 01/01: bin/slave-sync.sh: git pull --rebase is stupid and returns a value of 1 if the repository already is up-to-date. Work around that.

git-admin at x2go.org git-admin at x2go.org
Thu Sep 7 08:28:56 CEST 2017


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository buildscripts.

commit 18ddc0eb210cd32ab497f197cecf786337a6e8a4
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Sep 7 08:28:52 2017 +0200

    bin/slave-sync.sh: git pull --rebase is stupid and returns a value of 1 if the repository already is up-to-date. Work around that.
---
 bin/slave-sync.sh | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/bin/slave-sync.sh b/bin/slave-sync.sh
index b76e9ca..ac509da 100755
--- a/bin/slave-sync.sh
+++ b/bin/slave-sync.sh
@@ -9,5 +9,16 @@ typeset -i modified_tree='0'
 git diff-index --quiet "$(git write-tree)" -- || modified_tree="${?}"
 
 [[ "${modified_tree}" -ne "0" ]] && git stash
-git pull --rebase
+
+typeset git_pull_output=''
+typeset -i git_pull_retval='0'
+git_pull_output="$(LC_ALL=C LANG=C git pull --rebase)"
+git_pull_retval="${?}"
+
+if [[ "${git_pull_retval}" -ne "0" ]]; then
+  # git pull --rebase is stupid and sets its return value to 1 if the repository is up-to-date. Work around that with a stupid hack.
+  typeset false_positive='Current branch master is up to date.'
+  [[ "${git_pull_output}" = "${false_positive}" ]] && exit "${git_pull_retval}"
+fi
+
 [[ "${modified_tree}" -ne "0" ]] && git stash pop

--
Alioth's /srv/git/code.x2go.org/buildscripts.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/buildscripts.git


More information about the x2go-commits mailing list