fix(server): avoid PRs inherited from default upstreams #7317
Mergedgsimone(GitHub profile, opens in a new tab)merged 5 commits into
main fromrefs/pull/7317/headmerged by maria-rcks View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:M
- apps/server/src/git/GitManager.ts line 960OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -928,10 +941,20 @@928941 };929942 const prLookupCache = yield* Cache.makeWith(930943 (key: string) => {931- const [cwd = "", branch = "", upstreamRef = ""] = key.split("\u0000");944+ const [cwd = "", branch = "", upstreamRef = "", defaultBranch = ""] = key.split("\u0000");932945 const details = {933946 branch,934947 upstreamRef: upstreamRef.length > 0 ? upstreamRef : null,948+ defaultBranch: defaultBranch.length > 0 ? defaultBranch : null,935949 };936950 return Effect.gen(function* () {937951 const headContext = yield* resolveBranchHeadContext(cwd, details);952+ const upstreamHeadIsDefault =953+ headContext.headBranch === details.defaultBranch ||954+ (details.defaultBranch === null &&955+ (headContext.headBranch === "main" || headContext.headBranch === "master"));956+ // `git worktree add -b feature origin/main` makes the new local branch957+ // track origin/main. That upstream is the branch's base, not its958+ // published PR head. Looking up PRs for it can attach an old reverse959+ // merge from main and auto-settle an unrelated feature thread.960+ if (headContext.headBranch !== details.branch && upstreamHeadIsDefault) {
maria-rcks merged this636caf4
maria-rcks closed this
Sign in to join this conversation.
Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
5b7e8e46-9e77-4514-9288-e0981606630bYou can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share