scripts/git: Stop failing when upstream branches don't exist

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.
This commit is contained in:
teor 2019-11-07 12:04:51 +10:00
parent 3864536b7c
commit 7ee1e16c6f
No known key found for this signature in database
GPG Key ID: 10FEAA0E7075672A

View File

@ -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