Skip to content

Git Trees API no longer returns absolute paths + fails to find any other sha apart from head. #6813

@Kasi-R

Description

@Kasi-R
  • Gitea version (or commit ref): eb8632b/master.
  • Git version: 2.11.0
  • Operating system: N/A.
  • Database (use [x]): N/A.
  • Can you reproduce the bug at https://try.gitea.io: N/A.

Description

According to https://developer.github.com/v3/git/trees/. The paths returned should be absolute paths like so:

{
  "sha": "fc6274d15fa3ae2ab983129fb037999f264ba9a7",
  "url": "https://api.github.com/repos/octocat/Hello-World/trees/fc6274d15fa3ae2ab983129fb037999f264ba9a7",
  "tree": [
    {
      "path": "subdir/file.txt",
      "mode": "100644",
      "type": "blob",
      "size": 132,
      "sha": "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b",
      "url": "https://api.github.com/repos/octocat/Hello-World/git/7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"
    }
  ],
  "truncated": false
}

However, the path being returned is only the filename, like so:

{
  "sha": "fc6274d15fa3ae2ab983129fb037999f264ba9a7",
  "url": "https://api.github.com/repos/octocat/Hello-World/trees/fc6274d15fa3ae2ab983129fb037999f264ba9a7",
  "tree": [
    {
      "path": "file.txt",
      "mode": "100644",
      "type": "blob",
      "size": 132,
      "sha": "7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b",
      "url": "https://api.github.com/repos/octocat/Hello-World/git/7c258a9869f33c1e1e1f74fbb32f07c86cb5a75b"
    }
  ],
  "truncated": false
}

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions