diff mbox series

[01/12] t: introduce DEFAULT_REPO_FORMAT prereq

Message ID 239ca38efdbe3195e6319be4423b17d2b42e0b9f.1703067989.git.ps@pks.im (mailing list archive)
State Superseded
Headers show
Series Introduce `refStorage` extension | expand

Commit Message

Patrick Steinhardt Dec. 20, 2023, 10:54 a.m. UTC
A limited number of tests require repositories to have the default
repository format or otherwise they would fail to run, e.g. because they
fail to detect the correct hash function. While the hash function is the
only extension right now that creates problems like this, we are about
to add a second extensions for the ref format.

Introduce a new DEFAULT_REPO_FORMAT prereq that can easily be amended
whenever we add new format extensions. Next to making any such changes
easier on us, the prerequisite's name should also help to clarify the
intent better.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 t/t3200-branch.sh | 2 +-
 t/test-lib.sh     | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Karthik Nayak Dec. 22, 2023, 11:41 a.m. UTC | #1
Patrick Steinhardt <ps@pks.im> writes:

> A limited number of tests require repositories to have the default
> repository format or otherwise they would fail to run, e.g. because they
> fail to detect the correct hash function. While the hash function is the
> only extension right now that creates problems like this, we are about
> to add a second extensions for the ref format.
>

Nit: s/extensions/extension

> -test_expect_success SHA1 'git branch -m q q2 without config should succeed' '
> +test_expect_success DEFAULT_REPO_FORMAT 'git branch -m q q2 without config should succeed' '
>  	git branch -m q q2 &&
>  	git branch -m q2 q
>  '

My only concern is whether we'll end up blindly adding
DEFAULT_REPO_FORMAT for tests where only SHA1 is a prereq or only where
the new format extension is a prereq.
Patrick Steinhardt Dec. 28, 2023, 8:55 a.m. UTC | #2
On Fri, Dec 22, 2023 at 03:41:10AM -0800, Karthik Nayak wrote:
> Patrick Steinhardt <ps@pks.im> writes:
[snip]
> > -test_expect_success SHA1 'git branch -m q q2 without config should succeed' '
> > +test_expect_success DEFAULT_REPO_FORMAT 'git branch -m q q2 without config should succeed' '
> >  	git branch -m q q2 &&
> >  	git branch -m q2 q
> >  '
> 
> My only concern is whether we'll end up blindly adding
> DEFAULT_REPO_FORMAT for tests where only SHA1 is a prereq or only where
> the new format extension is a prereq.

Yeah, this is of course a possibility with this new prereq. I don't
really know what to do about it though, and think that it does serve a
sensible purpose. So... dunno.

Patrick
diff mbox series

Patch

diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index 6a316f081e..de7d3014e4 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -519,7 +519,7 @@  EOF
 
 mv .git/config .git/config-saved
 
-test_expect_success SHA1 'git branch -m q q2 without config should succeed' '
+test_expect_success DEFAULT_REPO_FORMAT 'git branch -m q q2 without config should succeed' '
 	git branch -m q q2 &&
 	git branch -m q2 q
 '
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 876b99562a..dc03f06b8e 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1936,6 +1936,10 @@  test_lazy_prereq SHA1 '
 	esac
 '
 
+test_lazy_prereq DEFAULT_REPO_FORMAT '
+	test_have_prereq SHA1
+'
+
 # Ensure that no test accidentally triggers a Git command
 # that runs the actual maintenance scheduler, affecting a user's
 # system permanently.