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

[WIP] Support worktrees in latest libgit2 in -[GTRepository fileURL] #626

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ksuther
Copy link

@ksuther ksuther commented Apr 27, 2017

The latest version of libgit2 with worktree support can return relative paths in git_repository_workdir. This results in -[GTRepository fileURL] returning an arbitrary URL depending on the current working directory.

What seems to work is searching for the parent repository using git_repository_discover, then combining the result with the relative worktree path and returning that.

It might be better to cache the result rather than having to do this every time fileURL is called. This is a rough PR and I wouldn't be surprised if there's a better way of accomplishing this.

git_repository_workdir can now return a relative path for a worktree checkout. Need to check if a relative URL is returned and try to create an absolute path using the parent repository.
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.

1 participant