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

Open
opened 2025-11-02 07:27:03 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @lchrennew on GitHub (Jun 19, 2021).

  • 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

Originally created by @lchrennew on GitHub (Jun 19, 2021). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Make sure it's not mentioned in the FAQ (https://docs.gitea.io/en-us/faq) 5. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 1.14.2 - Git version: - Operating system: <!-- Please include information on whether you built gitea yourself, used one of our downloads or are using some other package --> <!-- Please also tell us how you are running gitea, e.g. if it is being run from docker, a command-line, systemd etc. ---> <!-- If you are using a package or systemd tell us what distribution you are using --> - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - Log gist: <!-- It really is important to provide pertinent logs --> <!-- Please read https://docs.gitea.io/en-us/logging-configuration/#debugging-problems --> <!-- In addition, if your problem relates to git commands set `RUN_MODE=dev` at the top of app.ini --> ## Description <!-- If using a proxy or a CDN (e.g. CloudFlare) in front of gitea, please disable the proxy/CDN fully and connect to gitea directly to confirm the issue still persists without those services. --> 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: ```json5 { ... 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 <!-- **If this issue involves the Web Interface, please include a screenshot** -->
GiteaMirror added the type/proposalmodifies/api labels 2025-11-02 07:27:03 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#7485