fix: use plural 'takt-worktrees' as default clone directory name
The default clone base directory was 'takt-worktree' (singular), which is inconsistent since multiple worktrees are created inside it. Changed to 'takt-worktrees' (plural) while maintaining backward compatibility: - If existing 'takt-worktree' directory exists, continue using it - New installations will use 'takt-worktrees' - Explicit worktree_dir config always takes priority
This commit is contained in:
parent
4823a9cb83
commit
2e72054c0d
@ -33,7 +33,10 @@ export class CloneManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve the base directory for clones from global config.
|
* Resolve the base directory for clones from global config.
|
||||||
* Returns the configured worktree_dir (resolved to absolute), or ../
|
* Returns the configured worktree_dir (resolved to absolute), or
|
||||||
|
* the default 'takt-worktrees' (plural). Automatically migrates
|
||||||
|
* legacy 'takt-worktree' (singular) to 'takt-worktrees' if only
|
||||||
|
* the legacy directory exists.
|
||||||
*/
|
*/
|
||||||
private static resolveCloneBaseDir(projectDir: string): string {
|
private static resolveCloneBaseDir(projectDir: string): string {
|
||||||
const worktreeDir = resolveConfigValue(projectDir, 'worktreeDir');
|
const worktreeDir = resolveConfigValue(projectDir, 'worktreeDir');
|
||||||
@ -42,7 +45,13 @@ export class CloneManager {
|
|||||||
? worktreeDir
|
? worktreeDir
|
||||||
: path.resolve(projectDir, worktreeDir);
|
: path.resolve(projectDir, worktreeDir);
|
||||||
}
|
}
|
||||||
return path.join(projectDir, '..', 'takt-worktree');
|
const newDir = path.join(projectDir, '..', 'takt-worktrees');
|
||||||
|
const legacyDir = path.join(projectDir, '..', 'takt-worktree');
|
||||||
|
// Auto-migrate: rename legacy singular to plural
|
||||||
|
if (fs.existsSync(legacyDir) && !fs.existsSync(newDir)) {
|
||||||
|
fs.renameSync(legacyDir, newDir);
|
||||||
|
}
|
||||||
|
return newDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Resolve the clone path based on options and global config */
|
/** Resolve the clone path based on options and global config */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user