Skip to content

fix(git): resolve incorrect repo name when running from worktree#66

Merged
javoire merged 1 commit intomainfrom
fix/worktree-repo-name
Feb 13, 2026
Merged

fix(git): resolve incorrect repo name when running from worktree#66
javoire merged 1 commit intomainfrom
fix/worktree-repo-name

Conversation

@javoire
Copy link
Owner

@javoire javoire commented Feb 13, 2026

Summary

  • GetRepoName() used git rev-parse --show-toplevel which returns the worktree's own directory when invoked from inside a worktree, causing stack worktree to create worktrees under the wrong path (e.g. ~/.stack/worktrees/<branch-name>/... instead of ~/.stack/worktrees/<repo-name>/...)
  • Switch to git rev-parse --path-format=absolute --git-common-dir which always returns the main repo's .git directory, then derive the repo name from that

🤖 Generated with Claude Code

GetRepoName() used `git rev-parse --show-toplevel` which returns the
worktree directory when run from inside a worktree, causing new
worktrees to be created under the wrong path.

Switch to `--git-common-dir` which always returns the main repo's
.git directory regardless of which worktree you're in.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@javoire javoire marked this pull request as ready for review February 13, 2026 21:04
@javoire javoire merged commit 31b67c5 into main Feb 13, 2026
1 check passed
@javoire javoire deleted the fix/worktree-repo-name branch February 13, 2026 21:04
javoire pushed a commit that referenced this pull request Feb 13, 2026
…026-02-13)

### Bug Fixes

* **git:** resolve incorrect repo name when running from worktree ([#66](#66)) ([31b67c5](31b67c5))
@javoire
Copy link
Owner Author

javoire commented Feb 13, 2026

🎉 This PR is included in version 1.16.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments