objective-git
objective-git copied to clipboard
[WIP] Support worktrees in latest libgit2 in -[GTRepository fileURL]
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.