mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-03 08:53:36 +00:00
fix: improve branch name generation logic in BoardView and useBoardActions
- Updated the logic for auto-generating branch names to consistently use the primary branch (main/master) and avoid nested feature paths. - Removed references to currentWorktreeBranch in favor of getPrimaryWorktreeBranch for better clarity and maintainability. - Enhanced comments to clarify the purpose of branch name generation.
This commit is contained in:
@@ -521,9 +521,9 @@ export function BoardView() {
|
|||||||
// Empty string clears the branch assignment, moving features to main/current branch
|
// Empty string clears the branch assignment, moving features to main/current branch
|
||||||
finalBranchName = '';
|
finalBranchName = '';
|
||||||
} else if (workMode === 'auto') {
|
} else if (workMode === 'auto') {
|
||||||
// Auto-generate a branch name based on current branch and timestamp
|
// Auto-generate a branch name based on primary branch (main/master) and timestamp
|
||||||
const baseBranch =
|
// Always use primary branch to avoid nested feature/feature/... paths
|
||||||
currentWorktreeBranch || getPrimaryWorktreeBranch(currentProject.path) || 'main';
|
const baseBranch = getPrimaryWorktreeBranch(currentProject.path) || 'main';
|
||||||
const timestamp = Date.now();
|
const timestamp = Date.now();
|
||||||
const randomSuffix = Math.random().toString(36).substring(2, 6);
|
const randomSuffix = Math.random().toString(36).substring(2, 6);
|
||||||
finalBranchName = `feature/${baseBranch}-${timestamp}-${randomSuffix}`;
|
finalBranchName = `feature/${baseBranch}-${timestamp}-${randomSuffix}`;
|
||||||
@@ -603,7 +603,6 @@ export function BoardView() {
|
|||||||
selectedFeatureIds,
|
selectedFeatureIds,
|
||||||
updateFeature,
|
updateFeature,
|
||||||
exitSelectionMode,
|
exitSelectionMode,
|
||||||
currentWorktreeBranch,
|
|
||||||
getPrimaryWorktreeBranch,
|
getPrimaryWorktreeBranch,
|
||||||
addAndSelectWorktree,
|
addAndSelectWorktree,
|
||||||
setWorktreeRefreshKey,
|
setWorktreeRefreshKey,
|
||||||
|
|||||||
@@ -127,8 +127,10 @@ export function useBoardActions({
|
|||||||
// No worktree isolation - work directly on current branch
|
// No worktree isolation - work directly on current branch
|
||||||
finalBranchName = undefined;
|
finalBranchName = undefined;
|
||||||
} else if (workMode === 'auto') {
|
} else if (workMode === 'auto') {
|
||||||
// Auto-generate a branch name based on current branch and timestamp
|
// Auto-generate a branch name based on primary branch (main/master) and timestamp
|
||||||
const baseBranch = currentWorktreeBranch || 'main';
|
// Always use primary branch to avoid nested feature/feature/... paths
|
||||||
|
const baseBranch =
|
||||||
|
(currentProject?.path ? getPrimaryWorktreeBranch(currentProject.path) : null) || 'main';
|
||||||
const timestamp = Date.now();
|
const timestamp = Date.now();
|
||||||
const randomSuffix = Math.random().toString(36).substring(2, 6);
|
const randomSuffix = Math.random().toString(36).substring(2, 6);
|
||||||
finalBranchName = `feature/${baseBranch}-${timestamp}-${randomSuffix}`;
|
finalBranchName = `feature/${baseBranch}-${timestamp}-${randomSuffix}`;
|
||||||
@@ -245,7 +247,7 @@ export function useBoardActions({
|
|||||||
currentProject,
|
currentProject,
|
||||||
onWorktreeCreated,
|
onWorktreeCreated,
|
||||||
onWorktreeAutoSelect,
|
onWorktreeAutoSelect,
|
||||||
currentWorktreeBranch,
|
getPrimaryWorktreeBranch,
|
||||||
features,
|
features,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
@@ -282,7 +284,10 @@ export function useBoardActions({
|
|||||||
if (workMode === 'current') {
|
if (workMode === 'current') {
|
||||||
finalBranchName = undefined;
|
finalBranchName = undefined;
|
||||||
} else if (workMode === 'auto') {
|
} else if (workMode === 'auto') {
|
||||||
const baseBranch = currentWorktreeBranch || 'main';
|
// Auto-generate a branch name based on primary branch (main/master) and timestamp
|
||||||
|
// Always use primary branch to avoid nested feature/feature/... paths
|
||||||
|
const baseBranch =
|
||||||
|
(currentProject?.path ? getPrimaryWorktreeBranch(currentProject.path) : null) || 'main';
|
||||||
const timestamp = Date.now();
|
const timestamp = Date.now();
|
||||||
const randomSuffix = Math.random().toString(36).substring(2, 6);
|
const randomSuffix = Math.random().toString(36).substring(2, 6);
|
||||||
finalBranchName = `feature/${baseBranch}-${timestamp}-${randomSuffix}`;
|
finalBranchName = `feature/${baseBranch}-${timestamp}-${randomSuffix}`;
|
||||||
@@ -390,7 +395,7 @@ export function useBoardActions({
|
|||||||
setEditingFeature,
|
setEditingFeature,
|
||||||
currentProject,
|
currentProject,
|
||||||
onWorktreeCreated,
|
onWorktreeCreated,
|
||||||
currentWorktreeBranch,
|
getPrimaryWorktreeBranch,
|
||||||
features,
|
features,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user