diff mbox series

[v4,19/24] t/test-lib-functions.sh: support `--notick` in `test_commit_bulk()`

Message ID 936f6d1b7e392367bb87a755d014633d7171f0ab.1716499565.git.me@ttaylorr.com (mailing list archive)
State Accepted
Commit 8e41468ef3b0b8435918bae2b5bda2a5d3facdca
Headers show
Series pack-bitmap: pseudo-merge reachability bitmaps | expand

Commit Message

Taylor Blau May 23, 2024, 9:27 p.m. UTC
One of the tests we'll want to add for pseudo-merge bitmaps needs to be
able to generate a large number of commits at a specific date.

Support the `--notick` option (with identical semantics to the
`--notick` option for `test_commit()`) within `test_commit_bulk` as a
prerequisite for that. Callers can then set the various _DATE variables
themselves.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
---
 t/test-lib-functions.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Jeff King May 25, 2024, 3:25 a.m. UTC | #1
On Thu, May 23, 2024 at 05:27:08PM -0400, Taylor Blau wrote:

> One of the tests we'll want to add for pseudo-merge bitmaps needs to be
> able to generate a large number of commits at a specific date.
> 
> Support the `--notick` option (with identical semantics to the
> `--notick` option for `test_commit()`) within `test_commit_bulk` as a
> prerequisite for that. Callers can then set the various _DATE variables
> themselves.

Looks good. I expected to see you add "--date" _also_, but it looks like
you just set $GIT_COMMITTER_DATE yourself. Which I think is fine for our
purposes here.

-Peff
diff mbox series

Patch

diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 862d80c9748..427b375b392 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -458,6 +458,7 @@  test_commit_bulk () {
 	indir=.
 	ref=HEAD
 	n=1
+	notick=
 	message='commit %s'
 	filename='%s.t'
 	contents='content %s'
@@ -488,6 +489,9 @@  test_commit_bulk () {
 			filename="${1#--*=}-%s.t"
 			contents="${1#--*=} %s"
 			;;
+		--notick)
+			notick=yes
+			;;
 		-*)
 			BUG "invalid test_commit_bulk option: $1"
 			;;
@@ -507,7 +511,10 @@  test_commit_bulk () {
 
 	while test "$total" -gt 0
 	do
-		test_tick &&
+		if test -z "$notick"
+		then
+			test_tick
+		fi &&
 		echo "commit $ref"
 		printf 'author %s <%s> %s\n' \
 			"$GIT_AUTHOR_NAME" \