From 7b64e300b6009087e0dc137f5b8dcc029675280f Mon Sep 17 00:00:00 2001 From: Paul Campbell Date: Tue, 30 Jul 2024 16:40:39 +0100 Subject: [PATCH] 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 --- crates/core/src/git/repository/open/oreal.rs | 2 +- crates/core/src/git/repository/open/tests/commit_log.rs | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/core/src/git/repository/open/oreal.rs b/crates/core/src/git/repository/open/oreal.rs index 85d38aa..a7dd192 100644 --- a/crates/core/src/git/repository/open/oreal.rs +++ b/crates/core/src/git/repository/open/oreal.rs @@ -133,7 +133,7 @@ impl super::OpenRepositoryLike for RealOpenRepository { ) -> Result, git::commit::log::Error> { let limit = match find_commits.is_empty() { true => 1, - false => 50, + false => 25, }; self.0 .read() diff --git a/crates/core/src/git/repository/open/tests/commit_log.rs b/crates/core/src/git/repository/open/tests/commit_log.rs index fe3655e..b1f9bc5 100644 --- a/crates/core/src/git/repository/open/tests/commit_log.rs +++ b/crates/core/src/git/repository/open/tests/commit_log.rs @@ -19,18 +19,17 @@ fn should_return_single_item_in_commit_log_when_not_searching() -> TestResult { #[test] // 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 branch_name = given::a_branch_name(); let gitdir = GitDir::new(fs.base().to_path_buf(), StoragePathType::Internal); let test_repository = git::repository::test(fs.clone()); let_assert!(Ok(open_repository) = test_repository.open(&gitdir)); - for _ in [0; 60] { - // create 60 commits + for _ in [0; 25] { then::create_a_commit_on_branch(&fs, &gitdir, &branch_name)?; } let_assert!(Ok(result) = open_repository.commit_log(&branch_name, &[given::a_commit()])); - assert_eq!(result.len(), 50); + assert_eq!(result.len(), 25); Ok(()) }