You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
Kasi-R
changed the title
Git Trees API no longer returns absolute paths.
Git Trees API no longer returns absolute paths + fails to find any other sha apart from head.
May 1, 2019
Unfortunately the git module API was historically shaped in quite ad-hoc way which resulted in numerous quirks. While normally TreeEntry.Name() returns only the name without a path (and some other functions depend on that) in case it is listed through Tree.ListEntriesRecursively it returns the path relative to the referenced tree. This was added some time after my original go-git migration branch in December and I didn't notice it when rebasing on top of newer Gitea versions. Unlike the regular Git Trees API the request version with ?recursive=1 parameter is not properly tested in the test suite.
The issue with the hashes not being properly resolved also happened when I was upgrading the go-git branch to newer Gitea version. However, in this case it's a quirk that comes from the GitHub API itself. Contrary to the documentation the API accepts both commit hash or tree hash as a parameter. The Gitea test suite only tests the case with commit hash (or symbolic name like HEAD). While my original implementation correctly resolved tree hashes I inadvertently introduced the bug when trying to pass the Gitea test suite and started resolving only commit hashes (and symbolic names) instead.
[x]
): N/A.Description
According to https://developer.github.com/v3/git/trees/. The paths returned should be absolute paths like so:
However, the path being returned is only the filename, like so:
It doesn't seem to be able to find any other sha than head either:
https://i.imgur.com/rW3mREC.png
https://i.imgur.com/Qdm4S22.png
Commit which introduced this bug: 2af67f6
modules/git/tree.go
The text was updated successfully, but these errors were encountered: