Skip to content

Commit

Permalink
refactor(remote): add static COMMIT_COUNT
Browse files Browse the repository at this point in the history
  • Loading branch information
benpueschel committed Jul 6, 2024
1 parent a92eae9 commit b3ec28d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/remote/gitea.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ impl GiteaRemote {
stat: false,
verification: false,
files: false,
limit: Some(25),
limit: Some(super::COMMIT_COUNT as i64),
..Default::default()
};
let commits = self.client.get_commits(owner, name, &commit_option).await;
Expand Down
7 changes: 5 additions & 2 deletions src/remote/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,11 @@ impl GitHubRemote {
base: RepoHandler<'_>,
repo: models::Repository,
) -> Result<Repository, Error> {
static COMMIT_COUNT: u8 = 25;
let commits = base.list_commits().per_page(COMMIT_COUNT).send().await;
let commits = base
.list_commits()
.per_page(super::COMMIT_COUNT)
.send()
.await;
let ssh_url = match repo.ssh_url {
Some(url) => url.to_string(),
None => format!(
Expand Down
2 changes: 2 additions & 0 deletions src/remote/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ pub struct RepoCreateInfo {
pub init: bool,
}

pub static COMMIT_COUNT: u8 = 25;

#[async_trait]
pub trait Remote: Sync {
/// Create a new remote with the given configuration.
Expand Down

0 comments on commit b3ec28d

Please sign in to comment.