Skip to content
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

Submodules and working trees are not handled correctly #971

Open
tionis opened this issue Dec 31, 2022 · 5 comments
Open

Submodules and working trees are not handled correctly #971

tionis opened this issue Dec 31, 2022 · 5 comments
Labels
Easy pick Something that should be easy to solve good first issue Good for newcomers

Comments

@tionis
Copy link

tionis commented Dec 31, 2022

In git submodules and working trees the .git path is a file linking to the real working tree via following syntax:

gitdir: /some/absolute/or/relative/path

This is not handled correctly and throws a Error: .git exist but is not a directory error

@MichaelMure
Copy link
Owner

What would you expect to happen in that case? Read that file and open the corresponding repo?

In that case it could be an easy fix over there:

return "", fmt.Errorf(".git exist but is not a directory")

@tionis
Copy link
Author

tionis commented Dec 31, 2022

Yes, that would be the same behavior as git.

@tionis
Copy link
Author

tionis commented Dec 31, 2022

As far as I have seen, the paths in these files don't recurse. Instead, nested submodules/working trees point to the top most "real" git dir.
I think a simple parsing of the .git file and a change-dir should suffice

@MichaelMure MichaelMure added good first issue Good for newcomers Easy pick Something that should be easy to solve labels Jan 2, 2023
Kintar added a commit to Kintar/git-bug that referenced this issue Jan 21, 2023
Altered logic for detecting git directory. Instead of erroring on non-direcctory .git files,
now parses the file and returns the linked gitdir.
@DarthRubik
Copy link

I have a WIP solution for this that I will post probably tonight after I clean
it up

@DarthRubik
Copy link

Oh....Oops...I did not notice that a solution for this was already posted

MichaelMure added a commit that referenced this issue Mar 4, 2023
fix(#971): parse submodule .git files instead of erroring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy pick Something that should be easy to solve good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants