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

Add support to provide ".git" folder location #977

Open
datosh opened this issue Dec 19, 2023 · 1 comment
Open

Add support to provide ".git" folder location #977

datosh opened this issue Dec 19, 2023 · 1 comment
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@datosh
Copy link

datosh commented Dec 19, 2023

Currently go-git only provides a public API to get the location of the git root folder via:

tree, err := repository.Worktree()
tree.Filesystem.Root()

Getting from the repository root directory to the .git directory is not trivial since .git can be both a folder or a file referencing a folder.
This logic is already implemented in go-git (https://github.com/go-git/go-git/blob/master/repository.go#L332-L417 )but not available as public API.

My suggestion would be to extend the Repository API to provide a DotGit() string function that returns the folder to the .git folder of the current repository.

@pjbgf
Copy link
Member

pjbgf commented Mar 15, 2024

@datosh this could be a new Interface that the supporting Storage.Storers could implement. But I am assuming this would only be needed for filesystem though.

Note that if you are using BoundOS it may be slightly easier to have a direct translation of the path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants