fix: support git worktrees in stack operations
Summary
- Stack metadata storage used hardcoded
.git/stacked/paths which fails in git worktrees where.gitis a file pointing to the actual git dir - Added
GitDir()function usinggit rev-parse --git-dirto resolve the actual git directory at runtime - Updated all stack path resolution (
StackLocation,AddStackRefDir,StackRootDir,GetStacks) to use it - Added worktree test cases and test helpers (
InitGitWorktree,InitGitRepoOrWorktree)
Test plan
- All existing stack tests pass
- New worktree test variants pass for:
AddStackRefDir,StackRootDir,AddStackRefFile,UpdateStackRefFile,GetStacks - Manual test: create a worktree, run
glab stack createandglab stack saveinside it
Edited by Daniel Bankmann