Subject: Re: [PATCH v8] revision.c: implement --max-count-oldest

From: Junio C Hamano <[email-masked]>
Date: Wed, 20 May 2026 15:02:34 +0900

Mirko Faina <[email-masked]> writes:

> --max-count is a commit limiting option sets a maximum amount of commits
> to be shown. If a user wants to see only the first N commits of the
> history (the oldest commits) they'd have to do something like
>
>     git log $(git rev-list HEAD | tail -n N | head -n 1)
>
> This is not very user-friendly.
>
> Teach get_revision() the --max-count-oldest option.
>
> Signed-off-by: Mirko Faina <[email-masked]>
> ---

This breaks CI

  https://github.com/git/git/actions/runs/26138986677/job/76880268854#step:4:2072

Squash something like this to fix.

--- >8 ---
Subject: [PATCH] SQUASH??? test portability and other fixes

* "test_when_finished" should use "rm -f", not an error-detecting
  "rm", as the execution may not have reached to the point to create
  the "actual" file it is removing.

* Do not hide exit status of "git log" by piping its output into
  another process.

* Do not expect output of "wc -l" is portable.  macOS puts extra
  whitespaces in front, while GNU/Linux does not.
---
 t/t4202-log.sh | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index c3c1b862d3..75edb0eb38 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -1916,11 +1916,10 @@ test_expect_success 'log --max-count-oldest=1000 --graph --boundary' '
 '
 
 test_expect_success 'log --oneline --graph --boundary --max-count-oldest=1' '
-	test_when_finished rm actual &&
-	echo 2 >expect &&
-	git log --oneline --graph --boundary --max-count-oldest=1 HEAD~1..HEAD \
-	| wc -l >actual &&
-	test_cmp expect actual
+	test_when_finished rm -f actual &&
+	git log --oneline --graph --boundary --max-count-oldest=1 \
+		HEAD~1..HEAD >actual &&
+	test_line_count = 2 actual
 '
 
 cat >expect <<-\EOF
-- 
2.54.0-398-ga4b2d32071