Skip to content

fix: exclude main worktree by comparing with commonDir in submodules #1660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

gadfly3173
Copy link
Contributor

Fixes worktree detection in submodules where worktree.FullPath differs from commonDir path.

Fixes worktree detection in submodules where worktree.FullPath differs from commonDir path.
@love-linger
Copy link
Collaborator

I didn't understand what problem this PR is targeting. Could you provide a comparison of the output results of a demo?

@gadfly3173
Copy link
Contributor Author

gadfly3173 commented Aug 4, 2025

for a submodule :
real path: src/__theme__
common dir (worktree output): .git/modules/src/__theme__

@gadfly3173
Copy link
Contributor Author

image

@love-linger love-linger self-assigned this Aug 4, 2025
@love-linger love-linger added the bug Something isn't working label Aug 4, 2025
@love-linger love-linger merged commit 6cad70d into sourcegit-scm:develop Aug 4, 2025
14 checks passed
love-linger added a commit that referenced this pull request Aug 4, 2025
Since `$GIT_DIR` is the same with `$GIT_COMMON_DIR` for submodules, use `$GIT_DIR` directly to ignore submodule's main worktree  while querying worktrees

Signed-off-by: leo <longshuang@msn.cn>
@gadfly3173 gadfly3173 deleted the fix/submodule-worktree branch August 5, 2025 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants