Skip to content

Commit 6f77135

Browse files
committed
Skip merge for branches whose pull was a no-op, and drop redundant ref candidate
1 parent cbeba30 commit 6f77135

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

util/update-repos.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ for branch in "${(@k)repos}"; do
6262
else
6363
# Look for a cached remote-tracking ref carrying the integration history.
6464
remote_ref=""
65-
for candidate in "refs/remotes/${monorepo_remote}/${branch}" "refs/remotes/origin/${branch}"; do
65+
candidates=("refs/remotes/${monorepo_remote}/${branch}")
66+
if [[ "$monorepo_remote" != "origin" ]]; then
67+
candidates+=("refs/remotes/origin/${branch}")
68+
fi
69+
for candidate in "${candidates[@]}"; do
6670
if git show-ref --verify --quiet "$candidate"; then
6771
remote_ref="$candidate"
6872
break
@@ -86,7 +90,9 @@ for branch in "${(@k)repos}"; do
8690
git -c merge.directoryRenames=true pull --no-ff "$upstream"
8791

8892
after=$(git rev-parse HEAD)
89-
updated+=("$branch")
93+
if [[ "$before" != "$after" ]]; then
94+
updated+=("$branch")
95+
fi
9096
done
9197

9298
git switch "$start_branch"

0 commit comments

Comments
 (0)