From a5ecd669150b36a6058efee1cb46375fc1f25a74 Mon Sep 17 00:00:00 2001 From: Sayafdine Said Date: Sun, 22 Jan 2023 16:45:55 +0100 Subject: [PATCH] fix(lib): limit value to number of commits --- git-cliff/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/git-cliff/src/lib.rs b/git-cliff/src/lib.rs index 84a28e02f2..36a40fa957 100644 --- a/git-cliff/src/lib.rs +++ b/git-cliff/src/lib.rs @@ -148,7 +148,9 @@ fn process_repository<'a>( args.exclude_path.clone(), )?; if let Some(commit_limit_value) = config.git.limit_commits { - commits = commits.drain(..commit_limit_value).collect(); + commits = commits + .drain(..commits.len().min(commit_limit_value)) + .collect(); } // Update tags.