Skip to content

Commit 204e79c

Browse files
Add worktree support and consolidate branch management UI (#78)
* Fix git credential saving and improve host matching - Fix token masking bug in GitCredentialDialog that corrupted tokens on edit - Add tokenEdited state to preserve original token when not modified - Default new credential host to https://github.com - Add normalizeHostname helper for consistent host comparison - Improve credential lookup logging to show configured vs requested hosts - Remove overly permissive fuzzy matching that could leak tokens * Make OpenCode reload non-fatal when saving git credentials Settings are now saved to database even if the OpenCode server reload fails. The reload error is returned separately so the UI can inform the user that credentials were saved but the server needs a manual restart. * Fix git fetch using credentials in silent mode Previously, silent mode (used for UI fetch operations) would skip credential lookup entirely and return empty, causing auth failures. Now credentials are always looked up via IPC regardless of silent mode. * Add worktree support and consolidate branch management UI * Remove duplicate SECURE_COOKIES property from auth config * Bump version to 0.7.8
1 parent fb94137 commit 204e79c

12 files changed

Lines changed: 149 additions & 489 deletions

File tree

backend/src/services/git/GitBranchService.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ interface GitBranch {
1212
upstream?: string
1313
ahead?: number
1414
behind?: number
15+
isWorktree?: boolean
1516
}
1617

1718
export class GitBranchService {
@@ -45,19 +46,22 @@ export class GitBranchService {
4546
if (!trimmed) continue
4647

4748
const isCurrent = trimmed.startsWith('*')
48-
const namePart = trimmed.replace(/^\*?\s*/, '')
49+
const isWorktree = trimmed.startsWith('+')
50+
const namePart = trimmed.replace(/^[*+]?\s*/, '')
4951

5052
const firstSpace = namePart.indexOf(' ')
5153
const firstBracket = namePart.indexOf('[')
5254
const cutIndex = firstSpace === -1 ? (firstBracket === -1 ? namePart.length : firstBracket) : (firstBracket === -1 ? firstSpace : Math.min(firstSpace, firstBracket))
53-
const branchName = namePart.slice(0, cutIndex)
55+
const branchName = namePart.slice(0, cutIndex).trim()
5456

55-
if (!branchName) continue
57+
if (!branchName || branchName === '+' || branchName === '->' || branchName.includes('->')) continue
58+
if (/^[0-9a-f]{6,40}$/.test(branchName)) continue
5659

5760
const branch: GitBranch = {
5861
name: branchName,
5962
type: branchName.startsWith('remotes/') ? 'remote' : 'local',
60-
current: isCurrent && (branchName === currentBranch || branchName === `remotes/${currentBranch}`)
63+
current: isCurrent && (branchName === currentBranch || branchName === `remotes/${currentBranch}`),
64+
isWorktree
6165
}
6266

6367
if (seenNames.has(branch.name)) continue

frontend/src/api/repos.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ interface GitBranch {
149149
upstream?: string
150150
ahead?: number
151151
behind?: number
152+
isWorktree?: boolean
152153
}
153154

154155
export async function listBranches(id: number): Promise<{ branches: GitBranch[], status: { ahead: number, behind: number } }> {

frontend/src/components/file-browser/GitBranchSelector.tsx

Lines changed: 0 additions & 74 deletions
This file was deleted.

frontend/src/components/repo/AddBranchWorkspaceDialog.tsx

Lines changed: 0 additions & 138 deletions
This file was deleted.

0 commit comments

Comments
 (0)