feat!: reduce the max commit dev can be ahead of main

From 50 to 25.

Aim to make this a configuration option from git-next-server.toml
This commit is contained in:
Paul Campbell 2024-07-30 16:40:39 +01:00
parent f6bc2e1283
commit 7b64e300b6
2 changed files with 4 additions and 5 deletions

View file

@ -133,7 +133,7 @@ impl super::OpenRepositoryLike for RealOpenRepository {
) -> Result<Vec<git::Commit>, git::commit::log::Error> { ) -> Result<Vec<git::Commit>, git::commit::log::Error> {
let limit = match find_commits.is_empty() { let limit = match find_commits.is_empty() {
true => 1, true => 1,
false => 50, false => 25,
}; };
self.0 self.0
.read() .read()

View file

@ -19,18 +19,17 @@ fn should_return_single_item_in_commit_log_when_not_searching() -> TestResult {
#[test] #[test]
// assumes running in the git-next repo which should have main, next and dev as remote branches // assumes running in the git-next repo which should have main, next and dev as remote branches
fn should_return_capacity_50_in_commit_log_when_searching_for_garbage() -> TestResult { fn should_return_capacity_25_in_commit_log_when_searching_for_garbage() -> TestResult {
let_assert!(Ok(fs) = kxio::fs::temp()); let_assert!(Ok(fs) = kxio::fs::temp());
let branch_name = given::a_branch_name(); let branch_name = given::a_branch_name();
let gitdir = GitDir::new(fs.base().to_path_buf(), StoragePathType::Internal); let gitdir = GitDir::new(fs.base().to_path_buf(), StoragePathType::Internal);
let test_repository = git::repository::test(fs.clone()); let test_repository = git::repository::test(fs.clone());
let_assert!(Ok(open_repository) = test_repository.open(&gitdir)); let_assert!(Ok(open_repository) = test_repository.open(&gitdir));
for _ in [0; 60] { for _ in [0; 25] {
// create 60 commits
then::create_a_commit_on_branch(&fs, &gitdir, &branch_name)?; then::create_a_commit_on_branch(&fs, &gitdir, &branch_name)?;
} }
let_assert!(Ok(result) = open_repository.commit_log(&branch_name, &[given::a_commit()])); let_assert!(Ok(result) = open_repository.commit_log(&branch_name, &[given::a_commit()]));
assert_eq!(result.len(), 50); assert_eq!(result.len(), 25);
Ok(()) Ok(())
} }