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.