fix(git): use default_branch in git_commit_log and update API docs
Some checks are pending
CI / Rust Lint & Check (push) Waiting to run
CI / Rust Tests (push) Waiting to run
CI / Frontend Lint & Type Check (push) Waiting to run
CI / Frontend Build (push) Blocked by required conditions

- git_commit_log: default to repo.default_branch when rev is None
- Update API documentation to reflect default_branch instead of HEAD
This commit is contained in:
ZhenYi 2026-04-17 15:16:18 +08:00
parent 2bd1339d6c
commit 4c49953572
2 changed files with 3 additions and 3 deletions

View File

@ -13,7 +13,7 @@ use session::Session;
params(
("namespace" = String, Path, description = "Project namespace"),
("repo" = String, Path, description = "Repository name"),
("ref" = Option<String>, Query, description = "Git reference (branch, tag, commit). Defaults to HEAD."),
("ref" = Option<String>, Query, description = "Git reference (branch, tag, commit). Defaults to the repository's default branch."),
),
responses(
(status = 401, description = "Unauthorized", body = ApiResponse<ApiError>),

View File

@ -786,8 +786,8 @@ impl AppService {
let repo = self
.utils_find_repo(namespace.clone(), repo_name.clone(), ctx)
.await?;
let rev_clone = query.rev.clone();
let rev_for_count = query.rev.clone();
let rev_clone = query.rev.clone().or_else(|| Some(repo.default_branch.clone()));
let rev_for_count = rev_clone.clone();
let commits = git_spawn!(repo, domain -> {
domain.commit_log(rev_clone.as_deref(), offset, per_page)