Compare commits

...

1 Commits

Author SHA1 Message Date
SuperComboGamer
6c669fbe6a refactor: replace git command for branch retrieval
- Updated multiple route handlers to use 'git symbolic-ref --short HEAD' instead of 'git rev-parse --abbrev-ref HEAD' for retrieving the current branch name, improving consistency and clarity in branch management across the application.
2026-01-06 00:04:52 -05:00
10 changed files with 10 additions and 10 deletions

View File

@@ -47,7 +47,7 @@ export function createCheckoutBranchHandler() {
}
// Get current branch for reference
const { stdout: currentBranchOutput } = await execAsync('git rev-parse --abbrev-ref HEAD', {
const { stdout: currentBranchOutput } = await execAsync('git symbolic-ref --short HEAD', {
cwd: worktreePath,
});
const currentBranch = currentBranchOutput.trim();

View File

@@ -59,7 +59,7 @@ export function createCommitHandler() {
const commitHash = hashOutput.trim().substring(0, 8);
// Get branch name
const { stdout: branchOutput } = await execAsync('git rev-parse --abbrev-ref HEAD', {
const { stdout: branchOutput } = await execAsync('git symbolic-ref --short HEAD', {
cwd: worktreePath,
});
const branchName = branchOutput.trim();

View File

@@ -43,7 +43,7 @@ export function createCreatePRHandler() {
const effectiveProjectPath = projectPath || worktreePath;
// Get current branch name
const { stdout: branchOutput } = await execAsync('git rev-parse --abbrev-ref HEAD', {
const { stdout: branchOutput } = await execAsync('git symbolic-ref --short HEAD', {
cwd: worktreePath,
env: execEnv,
});

View File

@@ -38,7 +38,7 @@ export function createDeleteHandler() {
// Get branch name before removing worktree
let branchName: string | null = null;
try {
const { stdout } = await execAsync('git rev-parse --abbrev-ref HEAD', {
const { stdout } = await execAsync('git symbolic-ref --short HEAD', {
cwd: worktreePath,
});
branchName = stdout.trim();

View File

@@ -31,7 +31,7 @@ export function createInfoHandler() {
const worktreePath = path.join(projectPath, '.worktrees', featureId);
try {
await secureFs.access(worktreePath);
const { stdout } = await execAsync('git rev-parse --abbrev-ref HEAD', {
const { stdout } = await execAsync('git symbolic-ref --short HEAD', {
cwd: worktreePath,
});
res.json({

View File

@@ -34,7 +34,7 @@ export function createListBranchesHandler() {
}
// Get current branch
const { stdout: currentBranchOutput } = await execAsync('git rev-parse --abbrev-ref HEAD', {
const { stdout: currentBranchOutput } = await execAsync('git symbolic-ref --short HEAD', {
cwd: worktreePath,
});
const currentBranch = currentBranchOutput.trim();

View File

@@ -35,7 +35,7 @@ export function createMergeHandler() {
const worktreePath = path.join(projectPath, '.worktrees', featureId);
// Get current branch
const { stdout: currentBranch } = await execAsync('git rev-parse --abbrev-ref HEAD', {
const { stdout: currentBranch } = await execAsync('git symbolic-ref --short HEAD', {
cwd: projectPath,
});

View File

@@ -28,7 +28,7 @@ export function createPullHandler() {
}
// Get current branch name
const { stdout: branchOutput } = await execAsync('git rev-parse --abbrev-ref HEAD', {
const { stdout: branchOutput } = await execAsync('git symbolic-ref --short HEAD', {
cwd: worktreePath,
});
const branchName = branchOutput.trim();

View File

@@ -29,7 +29,7 @@ export function createPushHandler() {
}
// Get branch name
const { stdout: branchOutput } = await execAsync('git rev-parse --abbrev-ref HEAD', {
const { stdout: branchOutput } = await execAsync('git symbolic-ref --short HEAD', {
cwd: worktreePath,
});
const branchName = branchOutput.trim();

View File

@@ -87,7 +87,7 @@ export function createSwitchBranchHandler() {
}
// Get current branch
const { stdout: currentBranchOutput } = await execAsync('git rev-parse --abbrev-ref HEAD', {
const { stdout: currentBranchOutput } = await execAsync('git symbolic-ref --short HEAD', {
cwd: worktreePath,
});
const previousBranch = currentBranchOutput.trim();