Description
- Gitea version (or commit ref): try.gitea.org & codeberg.org
- Git version:
- Operating system:
- Database (use
[x]
):- PostgreSQL
- MySQL
- MSSQL
- SQLite
- Can you reproduce the bug at https://try.gitea.io:
- Yes (provide example URL: https://try.gitea.io/magnusja/libaums/src/branch/develop/app/build.gradle)
- No
- Not relevant
- Log gist:
Description
I'm trying to fetch commit timestamps for a given file via the API. Using /repos/{owner}/{repo}/contents/{filepath}
(eg https://try.gitea.io/api/v1/repos/magnusja/libaums/contents/app%2Fbuild.gradle
) reports details for the file quite fine, but obviously lists a wrong sha: using the sha given there as {ref}
for /repos/{owner}/{repo}/commits/{ref}/statuses
gives an empty result, for https://try.gitea.io/api/v1/repos/magnusja/libaums/commits?sha=049bdf7bbc8ff39411b618ff855a14ed3446dcc1&limit=1
it even results in a 503 server error. Trying the sha on /repos/{owner}/{repo}/git/trees/{sha}
(where it explicitly says "sha") results in a "bad request: sha not found".
Reproducible for other repos/files on eg Codeberg.org – I could not find a single valid commit hash in the values given for sha
, and no way to get the correct commit hashes.
UPDATE: as pointed out by @mrsdizzie: "this is the file SHA and not a bug" – hence converting this from a "bug report" to a feature request: As currently there's no way to get the file's timestamp/commit-hash, please add it at this level (https://try.gitea.io/api/swagger#/repository/repoGetContents – as suggested by @mrsdizzie). Ideally both. More details on the commit itself could be obtained easily using /repos/{owner}/{repo}/commits/{ref}/statuses, for example, once the commit hash is known.