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})
[ "${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"
fi
git -C ${REPO} pull
fi
-
done
+
+if [ -n "${FAILED_REPOS}" ]; then
+ echo ""
+ echo "Failed to update the following repositories:"
+ echo "${FAILED_REPOS}"
+fi