fix(git): use default_branch in git_commit_log and update API docs
- 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:
parent
2bd1339d6c
commit
4c49953572
@ -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>),
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user