feat: Enhanced project initialization with Git worktree detection (#743)
* Fix Cursor deeplink installation with copy-paste instructions (#723) * detect git worktree * add changeset * add aliases and git flags * add changeset * rename and update test * add store tasks in git functionality * update changeset * fix newline * remove unused import * update command wording * update command option text
This commit is contained in:
@@ -349,6 +349,25 @@ function getCurrentBranchSync(projectRoot) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current working directory is inside a Git work-tree.
|
||||
* Uses `git rev-parse --is-inside-work-tree` which is more specific than --git-dir
|
||||
* for detecting work-trees (excludes bare repos and .git directories).
|
||||
* This is ideal for preventing accidental git init in existing work-trees.
|
||||
* @returns {boolean} True if inside a Git work-tree, false otherwise.
|
||||
*/
|
||||
function insideGitWorkTree() {
|
||||
try {
|
||||
execSync('git rev-parse --is-inside-work-tree', {
|
||||
stdio: 'ignore',
|
||||
cwd: process.cwd()
|
||||
});
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Export all functions
|
||||
export {
|
||||
isGitRepository,
|
||||
@@ -366,5 +385,6 @@ export {
|
||||
checkAndAutoSwitchGitTag,
|
||||
checkAndAutoSwitchGitTagSync,
|
||||
isGitRepositorySync,
|
||||
getCurrentBranchSync
|
||||
getCurrentBranchSync,
|
||||
insideGitWorkTree
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user