Get commit comparison information
const url = 'https://gitea.com/api/v1/repos/example/example/compare/example?output=diff';const options = {method: 'GET', headers: {Authorization: 'Basic <credentials>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://gitea.com/api/v1/repos/example/example/compare/example?output=diff' \ --header 'Authorization: Basic <credentials>'By default returns JSON commit comparison information. The raw diff or patch can be
requested with the output query parameter set to diff or patch respectively.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Owner of the repo
Name of the repo
Compare two refs as base...head (or base..head); refs may be branches, tags, full or short SHAs (including branch names that contain slashes), optionally with a ^ or ~N revision suffix.
Query Parameters
Section titled “Query Parameters”Return the raw comparison as diff or patch instead of JSON
Responses
Section titled “Responses”object
object
User represents a user
object
Is user active
URL to the user’s avatar
The user’s description
User counts
The user’s full name
URL to the user’s gitea page
The user’s id
Is the user an administrator
User locale
The user’s location
Login of the user, same as username
Identifier of the user, provided by the external authenticator (if configured)
Is user login prohibited
Is user restricted
The ID of the user’s Authentication Source
User visibility level option: public, limited, private public UserVisibilityPublic limited UserVisibilityLimited private UserVisibilityPrivate
The user’s website
object
object
Date is the commit date in string format
Name is the person’s name
object
Date is the commit date in string format
Name is the person’s name
Message is the commit message
object
SHA is the commit SHA hash
URL is the API URL for the commit
URL is the API URL for the commit
PayloadCommitVerification represents the GPG verification of a commit
object
The signed payload content
The reason for the verification status
The GPG signature of the commit
PayloadUser represents the author or committer of a commit
object
Full name of the commit author
Username of the user
Whether the commit signature is verified
User represents a user
object
Is user active
URL to the user’s avatar
The user’s description
User counts
The user’s full name
URL to the user’s gitea page
The user’s id
Is the user an administrator
User locale
The user’s location
Login of the user, same as username
Identifier of the user, provided by the external authenticator (if configured)
Is user login prohibited
Is user restricted
The ID of the user’s Authentication Source
User visibility level option: public, limited, private public UserVisibilityPublic limited UserVisibilityLimited private UserVisibilityPrivate
The user’s website
Files contains information about files affected by the commit
CommitAffectedFiles store information about files affected by the commit
object
Filename is the path of the affected file
Status indicates how the file was affected (added, modified, deleted)
HTMLURL is the web URL for viewing the commit
Parents contains the parent commit information
object
SHA is the commit SHA hash
URL is the API URL for the commit
SHA is the commit SHA hash
CommitStats is statistics for a RepoCommit
object
Additions is the number of lines added
Deletions is the number of lines deleted
Total is the total number of lines changed
URL is the API URL for the commit
Example
{ "commits": [ { "author": { "login_name": "empty", "visibility": "public" }, "committer": { "login_name": "empty", "visibility": "public" } } ]}APIError is error format response
Headers
Section titled “Headers”APINotFound is a not found empty response