Skip to content

Request more infomation via API for "Get a single commit from a repository" #16205

Open
@lchrennew

Description

@lchrennew
  • Gitea version (or commit ref): 1.14.2
  • 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)
    • No
  • Log gist:

Description

In current gitea version, the responses of the API for "Get a single commit from a repository" GET /repos/{owner}/{repo}/git/commits/{sha} don't include enough infomation that I need, for example:

I want to show the diffs file by file or summary of a commit, and there's only filenames I can aquire, my expectation:

{
   ...
   stats: {
       total: a number for lines of code changed of this commit,
       additions: a number for lines of code added of this commit,
       deletions: a number for lines of code deleted of this commit,
   },
   files: [
      {
         parent: 'the blob sha of this file before changed (in order to do content diff)',
         sha: 'the blob sha of this file after changed',
         filename: 'the file path',
         status: 'modified | added | deleted',
         additions: a number for lines of code added,
         deletions: a number for lines of code deleted,
         changes: a number for lines of code added plus deleted,
         patch: 'the git diff string, when the sha and parent fields are provided, this field is not nessesary, I think',
         ...
      }
   ]
   ...
}

Screenshots

Metadata

Metadata

Assignees

No one assigned

    Labels

    modifies/apiThis PR adds API routes or modifies themtype/proposalThe new feature has not been accepted yet but needs to be discussed first.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions