mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-01 08:13:37 +00:00
fix: normalize worktree paths and update branch listing logic
- Updated the branch listing command to remove quotes around branch names, ensuring compatibility across platforms. - Enhanced worktree path comparisons in tests to normalize path separators, improving consistency between server and client environments. - Adjusted workspace root resolution to reflect the correct directory structure for the UI. This addresses potential discrepancies in branch names and worktree paths, particularly on Windows systems.
This commit is contained in:
@@ -38,8 +38,9 @@ export function createListBranchesHandler() {
|
||||
const currentBranch = currentBranchOutput.trim();
|
||||
|
||||
// List all local branches
|
||||
// Use %(refname:short) without quotes - quotes are preserved on Windows
|
||||
const { stdout: branchesOutput } = await execAsync(
|
||||
"git branch --format='%(refname:short)'",
|
||||
"git branch --format=%(refname:short)",
|
||||
{ cwd: worktreePath }
|
||||
);
|
||||
|
||||
@@ -47,11 +48,15 @@ export function createListBranchesHandler() {
|
||||
.trim()
|
||||
.split("\n")
|
||||
.filter((b) => b.trim())
|
||||
.map((name) => ({
|
||||
name: name.trim(),
|
||||
isCurrent: name.trim() === currentBranch,
|
||||
isRemote: false,
|
||||
}));
|
||||
.map((name) => {
|
||||
// Remove any surrounding quotes (Windows git may preserve them)
|
||||
const cleanName = name.trim().replace(/^['"]|['"]$/g, "");
|
||||
return {
|
||||
name: cleanName,
|
||||
isCurrent: cleanName === currentBranch,
|
||||
isRemote: false,
|
||||
};
|
||||
});
|
||||
|
||||
// Get ahead/behind count for current branch
|
||||
let aheadCount = 0;
|
||||
|
||||
Reference in New Issue
Block a user