Add path-filtered repository history
This commit is contained in:
@@ -599,6 +599,7 @@ impl GotchaCore {
|
||||
owner: String,
|
||||
repository: String,
|
||||
branch: Option<String>,
|
||||
path: String,
|
||||
pages: u32,
|
||||
) -> Result<CommitPage, GotchaError> {
|
||||
let server = self.server()?;
|
||||
@@ -612,11 +613,16 @@ impl GotchaCore {
|
||||
.map(|candidate| candidate.default_branch.clone())
|
||||
.unwrap_or_else(|| "main".into());
|
||||
let branches = load_branches(&server, &owner, &repository, &default_branch).await?;
|
||||
let path = (!path.is_empty()).then_some(path.as_str());
|
||||
let commits = match branch.as_deref() {
|
||||
Some(branch) => {
|
||||
load_branch_commits(&server, &owner, &repository, branch, pages.max(1)).await?
|
||||
load_branch_commits(&server, &owner, &repository, branch, path, pages.max(1))
|
||||
.await?
|
||||
}
|
||||
None => {
|
||||
load_all_commits(&server, &owner, &repository, &branches, path, pages.max(1))
|
||||
.await?
|
||||
}
|
||||
None => load_all_commits(&server, &owner, &repository, &branches, pages.max(1)).await?,
|
||||
};
|
||||
Ok(commit_page(
|
||||
branches,
|
||||
|
||||
Reference in New Issue
Block a user