From 2184e036a30c881c08bf37bbe1a63916161a1fe3 Mon Sep 17 00:00:00 2001 From: trotFunky Date: Mon, 20 May 2019 23:36:42 +0200 Subject: [PATCH] =?UTF-8?q?Correction=20pour=20prendre=20en=20compte=20les?= =?UTF-8?q?=20cas=20chelous=20o=C3=B9=20c'est=20=C3=A0=20jour=20pas=20pas?= =?UTF-8?q?=20de=20[up=20to=20date]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Perso/INTech/gitUpdate.sh | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Perso/INTech/gitUpdate.sh b/Perso/INTech/gitUpdate.sh index 9fb8f76..6e96e64 100755 --- a/Perso/INTech/gitUpdate.sh +++ b/Perso/INTech/gitUpdate.sh @@ -45,8 +45,22 @@ for GIT_REPO in $work_array ; do fi remoteStatus="$(git fetch --dry-run 2>&1 | tail -n 1 | grep -v -e'+')" # Empty if there are no commits to fetch - localStatus="$(git push -n --porcelain | grep -e'up to date')" # Empty if there are commits to push - + + refChanges=$(git push -n --porcelain | grep -e'refs') + nbRefs=$(echo "$refChanges" | wc -l) + nbNonPushRefs=$(echo $(echo "$refChanges" | cut -f1) | wc -w) + + + localStatus="Nothing to do" # Empty if there are commits to push + + if [ ! -z $(echo $refChanges | grep -e"*") ]; then + localStatus="" + fi + + if [ ! $nbRefs -eq $nbNonPushRefs ]; then + localStatus="" + fi + output=$( if [ -z "$remoteStatus" ]; then if [ -z "$localStatus" ]; then