Skip to content

Repository API (GET tree) returns "truncated: true" on last API call #35117

@joh-ku

Description

@joh-ku

Description

When fetching the tree of a repository calling https://gitea.com/api/v1/repos/{owner}/{repo}/git/trees/{sha} (documentation) the last API call in this sequence that returns the last (non-truncated) chunk of data, returns truncated: true.
This behaviour was observed while using Sveltia-CMS and is documented in this issue.

Expected Behavior

I think the expected behaviour would be to return truncated: false in the last API call. This is to be discussed.

Example

The request body will look like this:

{
"sha":"{sha}",
"url":"https://gitea.com/api/v1/repos/{owner}/{repo}/git/trees/{sha}",
"tree":[{"path":"path/to/file/1.svg","mode":"100644","type":"blob","size":986,"sha":"{sha-file1}","url":"https://gitea.com/api/v1/repos/{owner}/{repo}/git/blobs/{sha-file1}"},
{"path":"/path/to/file/2.svg","mode":"100644","type":"blob","size":2192,"sha":"{sha-file2}","url":"https://gitea.com/api/v1/repos/{owner}/{repo}/git/blobs/{sha-file2}"}],
"truncated":true,
"page":13,
"total_count":12002
}

Gitea Version

v1.24.2

Can you reproduce the bug on the Gitea demo site?

No (did not try)

Log Gist

No response

Screenshots

No response

Git Version

git version 2.50.1

Operating System

FreeBSD 14.3-RELEASE-p1

How are you running Gitea?

Installed from FreeBSD Ports collection using pkg.

Database

PostgreSQL

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions