]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
scripts/git: Stop failing when upstream branches don't exist
authorteor <teor@torproject.org>
Thu, 7 Nov 2019 02:04:51 +0000 (12:04 +1000)
committerteor <teor@torproject.org>
Thu, 7 Nov 2019 02:04:51 +0000 (12:04 +1000)
If you add a custom remote, or a new branch, and don't fetch first,
then the script would fail when checking for unchanged branches.

Instead, skip the check: a new branch is definitely a change.

scripts/git/git-push-all.sh

index 4738658f1df992a231d42ddd3a811e7e15d8aa6e..293df034233a210aa786574604c70070140f08fd 100755 (executable)
@@ -251,7 +251,8 @@ if [ "$PUSH_SAME" -eq 0 ]; then
     PUSH_COMMIT=$(git rev-parse "$b")
     SKIP_UPSTREAM=
     for u in $UPSTREAM_SKIP_SAME_AS; do
-      UPSTREAM_COMMIT=$(git rev-parse "$u")
+      # Skip the branch check on error
+      UPSTREAM_COMMIT=$(git rev-parse "$u" 2>/dev/null) || continue
       if [ "$PUSH_COMMIT" = "$UPSTREAM_COMMIT" ]; then
         SKIP_UPSTREAM="$u"
       fi