Skip to content

Conversation

@abrenneke
Copy link
Contributor

@abrenneke abrenneke commented Jul 8, 2021

Pass parent .git directory to simple-git when the git directory is resolved to .git/worktrees/etc or .git/modules/etc.

Honestly since worktrees are local only things... I think a unit test would be difficult. It'd probably have to set up a worktree, put code into it, and test betterer there? I just made a test repo and verified the change works. If you have other ideas for tests, let me know.

Fixes #786

@phenomnomnominal
Copy link
Owner

I wonder if this should be fixed infindGitRoot. It claims to be solved here: banyudu/find-git-root#2

@abrenneke
Copy link
Contributor Author

Yeah I saw that, looks like they added support in there for following the path that the .git file points to... but is that the "git root" or not? I guess not... This is currently blocking two people so getting this asap one way or another would be really helpful 🙏

@abrenneke
Copy link
Contributor Author

Hold up, found problem

@abrenneke
Copy link
Contributor Author

Okay current PR is confirmed to work now.

find-git-root just does it incorrectly, so I just rewrote their function and removed it as a dep. The correct way to handle worktrees and submodules is to basically just ignore it and assume a directory with a .git file or folder is the one you should be using.

And one less dep!

Copy link
Owner

@phenomnomnominal phenomnomnominal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heck yeah, looks good to me!

@abrenneke abrenneke force-pushed the git-error-worktree-submodule branch from 38bcfa2 to ce711dc Compare July 9, 2021 02:43
@abrenneke abrenneke force-pushed the git-error-worktree-submodule branch from ce711dc to 64d9521 Compare July 9, 2021 02:46
@phenomnomnominal phenomnomnominal merged commit a568ea3 into phenomnomnominal:master Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Not runnable inside a git submodule

2 participants