Skip to content

Repository discovery starting from files#3998

Merged
carlosmn merged 5 commits into
libgit2:masterfrom
pks-t:pks/repo-discovery
Nov 14, 2016
Merged

Repository discovery starting from files#3998
carlosmn merged 5 commits into
libgit2:masterfrom
pks-t:pks/repo-discovery

Conversation

@pks-t
Copy link
Copy Markdown
Member

@pks-t pks-t commented Nov 11, 2016

This PR is as a response to #3994. I think it does make sense to make a repository discoverable even if initially, a path to a file inside the repository was specified.

When trying to find a discovery, we walk up the directory
structure checking if there is a ".git" file or directory and, if
so, check its validity. But in the case that we've got a ".git"
file, we do not want to unconditionally assume that the file is
in fact a ".git" file and treat it as such, as we would error out
if it is not.

Fix the issue by only treating a file as a gitlink file if it
ends with "/.git". This allows users of the function to discover
a repository by handing in any path contained inside of a git
repository.
@pks-t pks-t force-pushed the pks/repo-discovery branch from 78c9584 to 0f31609 Compare November 14, 2016 09:53
@ethomson
Copy link
Copy Markdown
Member

This looks 👍 to me, this seems quite low risk for 0.25, @carlosmn do you agree?

@carlosmn carlosmn merged commit a39f18a into libgit2:master Nov 14, 2016
@carlosmn
Copy link
Copy Markdown
Member

Yeah, since this was apparently working before, I suppose not supporting it would technically break the API.

@pks-t pks-t deleted the pks/repo-discovery branch November 15, 2016 07:51
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.

3 participants