Re: [PATCH v4 2/4] test-read-cache: set up repo after git directory

2 messages, 2 authors, 2021-11-24 · open the first message on its own page

Re: [PATCH v4 2/4] test-read-cache: set up repo after git directory

From: Junio C Hamano <hidden>
Date: 2021-11-23 23:42:55

"Lessley Dennington via GitGitGadget" [off-list ref]
writes:
From: Lessley Dennington <redacted>

Move repo setup to occur after git directory is set up. This will ensure
enabling the sparse index for `diff` (and guarding against the nongit
scenario) will not cause tests to start failing, since that change will include
adding a check to prepare_repo_settings() with the new BUG.
This looks obviously the right thing to do.  Would anything break
because of the "wrong" ordering of events in the original code?

IOW, can this "bugfix" be protected with a new test against
regression?
quoted hunk
Signed-off-by: Lessley Dennington <redacted>
---
 t/helper/test-read-cache.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c
index b52c174acc7..0d9f08931a1 100644
--- a/t/helper/test-read-cache.c
+++ b/t/helper/test-read-cache.c
@@ -39,8 +39,6 @@ int cmd__read_cache(int argc, const char **argv)
 	int table = 0, expand = 0;
 
 	initialize_the_repository();
-	prepare_repo_settings(r);
-	r->settings.command_requires_full_index = 0;
 
 	for (++argv, --argc; *argv && starts_with(*argv, "--"); ++argv, --argc) {
 		if (skip_prefix(*argv, "--print-and-refresh=", &name))
@@ -56,6 +54,9 @@ int cmd__read_cache(int argc, const char **argv)
 	setup_git_directory();
 	git_config(git_default_config, NULL);
 
+	prepare_repo_settings(r);
+	r->settings.command_requires_full_index = 0;
+
 	for (i = 0; i < cnt; i++) {
 		repo_read_index(r);

Re: [PATCH v4 2/4] test-read-cache: set up repo after git directory

From: Lessley Dennington <hidden>
Date: 2021-11-24 15:10:38


On 11/23/21 3:42 PM, Junio C Hamano wrote:
"Lessley Dennington via GitGitGadget" [off-list ref]
writes:
quoted
From: Lessley Dennington <redacted>

Move repo setup to occur after git directory is set up. This will ensure
enabling the sparse index for `diff` (and guarding against the nongit
scenario) will not cause tests to start failing, since that change will include
adding a check to prepare_repo_settings() with the new BUG.
This looks obviously the right thing to do.  Would anything break
because of the "wrong" ordering of events in the original code?

IOW, can this "bugfix" be protected with a new test against
regression?
Yep! Tests 2, 3, 28, and 34 in t1092-sparse-checkout-compatibility.sh
will fail without this change.
quoted
Signed-off-by: Lessley Dennington <redacted>
---
  t/helper/test-read-cache.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c
index b52c174acc7..0d9f08931a1 100644
--- a/t/helper/test-read-cache.c
+++ b/t/helper/test-read-cache.c
@@ -39,8 +39,6 @@ int cmd__read_cache(int argc, const char **argv)
  	int table = 0, expand = 0;
  
  	initialize_the_repository();
-	prepare_repo_settings(r);
-	r->settings.command_requires_full_index = 0;
  
  	for (++argv, --argc; *argv && starts_with(*argv, "--"); ++argv, --argc) {
  		if (skip_prefix(*argv, "--print-and-refresh=", &name))
@@ -56,6 +54,9 @@ int cmd__read_cache(int argc, const char **argv)
  	setup_git_directory();
  	git_config(git_default_config, NULL);
  
+	prepare_repo_settings(r);
+	r->settings.command_requires_full_index = 0;
+
  	for (i = 0; i < cnt; i++) {
  		repo_read_index(r);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help