]> git.sthu.org Git - shutils.git/commitdiff
git: Update git-pull-all
authorStefan Huber <stefan.huber@fh-salzburg.ac.at>
Thu, 16 Apr 2026 09:15:00 +0000 (11:15 +0200)
committerStefan Huber <stefan.huber@fh-salzburg.ac.at>
Thu, 16 Apr 2026 09:15:04 +0000 (11:15 +0200)
git/git-pull-all

index d63e73c9061ebb7a06bc6c4e92afc30a5d490c36..5131f861f447ac7f213129ecf242a1216fe93e9f 100755 (executable)
@@ -78,6 +78,9 @@ while [ $# -gt 0 ]; do
        shift
 done
 
+# Collection of failed repos for summary at the end
+FAILED_REPOS=""
+
 for REPODIR in $(find "$@" -name .git -type d 2> /dev/null); do
 
        REPO=$(dirname ${REPODIR})
@@ -90,7 +93,11 @@ for REPODIR in $(find "$@" -name .git -type d 2> /dev/null); do
                [ "${response}" = "y" ] || continue
        fi
 
-       git -C ${REPO} remote update
+       git -C ${REPO} remote update || {
+               /usr/bin/echo -e "\e[1;31m  Failed to update ${REPO}\e[0m"
+               FAILED_REPOS="${FAILED_REPOS}\n${REPO}"
+               continue
+       }
 
        if [ -z "$(git -C ${REPO} status -uno | grep 'Your branch is behind')" ] ; then
                /usr/bin/echo -e "\e[1;32m  Already up to date\e[0m"
@@ -101,5 +108,10 @@ for REPODIR in $(find "$@" -name .git -type d 2> /dev/null); do
                fi
                git -C ${REPO} pull
        fi
-
 done
+
+if [ -n "${FAILED_REPOS}" ]; then
+       echo ""
+       echo "Failed to update the following repositories:"
+       echo "${FAILED_REPOS}"
+fi