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

Closed
opened 2025-11-02 11:22:41 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @joh-ku on GitHub (Jul 18, 2025).

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

Originally created by @joh-ku on GitHub (Jul 18, 2025). ### Description When fetching the tree of a repository calling `https://gitea.com/api/v1/repos/{owner}/{repo}/git/trees/{sha}` ([documentation](https://docs.gitea.com/api/1.23/#tag/repository/operation/GetTree)) 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](https://github.com/sveltia/sveltia-cms/issues/467). ### 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](https://www.freshports.org/www/gitea/) using `pkg`. ### Database PostgreSQL
GiteaMirror added the topic/apitype/bug labels 2025-11-02 11:22:41 -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#14775