-
Notifications
You must be signed in to change notification settings - Fork 3k
Group threads by worktree #3898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
9b96569
c254d5f
41f6aef
b9c9001
8be96a9
25b1a4f
38dfce3
afe1ae1
1564da6
6795535
dc3738e
fd4f752
69592d8
b818704
0e60ec2
854bf70
b4fa9a3
9145cbb
fff90fc
8d8e6d5
277a5e4
3abce12
747e319
5e3872d
8b6e225
9d2ed11
9644cd8
770796f
21c619d
5ae363e
fb0a957
3ffbe06
3f42da8
98ba360
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2143,8 +2143,10 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* | |
| : null; | ||
|
|
||
| const worktreeMap = new Map<string, string>(); | ||
| let mainCheckoutPath: string | null = null; | ||
| if (worktreeList.exitCode === 0) { | ||
| let currentPath: string | null = null; | ||
| let sawMainCheckout = false; | ||
| for (const line of worktreeList.stdout.split("\n")) { | ||
| if (line.startsWith("worktree ")) { | ||
| const candidatePath = line.slice("worktree ".length); | ||
|
|
@@ -2153,6 +2155,10 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* | |
| Effect.orElseSucceed(() => false), | ||
| ); | ||
| currentPath = exists ? candidatePath : null; | ||
| if (!sawMainCheckout) { | ||
| mainCheckoutPath = currentPath; | ||
| sawMainCheckout = true; | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Main checkout path stuck nullMedium Severity The Reviewed by Cursor Bugbot for commit 98ba360. Configure here. |
||
| } else if (line.startsWith("branch refs/heads/") && currentPath) { | ||
| worktreeMap.set(line.slice("branch refs/heads/".length), currentPath); | ||
| } else if (line === "") { | ||
|
|
@@ -2163,14 +2169,15 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* | |
|
|
||
| const localBranches = Arr.filterMap(localBranchResult.stdout.split("\n"), (line) => { | ||
| const refName = parseBranchLine(line); | ||
| const worktreePath = refName === null ? null : (worktreeMap.get(refName.name) ?? null); | ||
| return refName === null | ||
| ? Result.failVoid | ||
| : Result.succeed({ | ||
| name: refName.name, | ||
| current: refName.current, | ||
| isRemote: false, | ||
| isDefault: refName.name === defaultBranch, | ||
| worktreePath: worktreeMap.get(refName.name) ?? null, | ||
| worktreePath, | ||
| }); | ||
| }).toSorted((a, b) => { | ||
| const aPriority = a.current ? 0 : a.isDefault ? 1 : 2; | ||
|
|
@@ -2236,6 +2243,7 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* | |
| refs: [...refs.refs], | ||
| isRepo: true, | ||
| hasPrimaryRemote: remoteNames.includes("origin"), | ||
| mainCheckoutPath, | ||
| nextCursor: refs.nextCursor, | ||
| totalCount: refs.totalCount, | ||
| }; | ||
|
|
@@ -2321,10 +2329,38 @@ export const makeGitVcsDriverCore = Effect.fn("makeGitVcsDriverCore")(function* | |
| ); | ||
| const remoteRefName = | ||
| parsedRemoteRef?.remoteRef ?? `${input.fallbackRemoteName}/${input.refName}`; | ||
| const remoteRef = `refs/remotes/${remoteRefName}`; | ||
| const args = ["show-ref", "--verify", "--quiet", remoteRef]; | ||
| const result = yield* executeGit( | ||
| "GitVcsDriver.resolveRemoteTrackingCommit", | ||
| input.cwd, | ||
| args, | ||
| { allowNonZeroExit: true }, | ||
| ); | ||
| if (result.exitCode !== 0) { | ||
| if (result.exitCode === 1) { | ||
| return yield* new GitVcsDriver.RemoteTrackingRefNotFoundError({ | ||
| cwd: input.cwd, | ||
| remoteRefName, | ||
| }); | ||
| } | ||
| return yield* new GitCommandError({ | ||
| ...gitCommandContext({ | ||
| operation: "GitVcsDriver.resolveRemoteTrackingCommit", | ||
| cwd: input.cwd, | ||
| args, | ||
| }), | ||
| detail: "Git remote tracking ref lookup failed.", | ||
| ...(result.exitCode === null ? {} : { exitCode: result.exitCode }), | ||
| stdoutLength: result.stdout.length, | ||
| stderrLength: result.stderr.length, | ||
| }); | ||
| } | ||
| const commitSha = yield* runGitStdout("GitVcsDriver.resolveRemoteTrackingCommit", input.cwd, [ | ||
| "rev-parse", | ||
| "show-ref", | ||
| "--verify", | ||
| `refs/remotes/${remoteRefName}^{commit}`, | ||
| "--hash=40", | ||
| remoteRef, | ||
| ]).pipe(Effect.map((stdout) => stdout.trim())); | ||
|
|
||
| return { commitSha, remoteRefName }; | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.