git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/3] bundle-uri: remove GIT_TEST_BUNDLE_URI env variable

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Dec 20, 2022, 20:41 UTC
Message-ID
<221220.86o7rxx0so.gmgdl@evledraar.gmail.com>
In-Reply-To
<de1aca07-dd03-3f46-9f56-1cc7616b573a@github.com>
On Tue, Dec 20 2022, Derrick Stolee wrote:
Show 34 quoted lines
> On 12/19/22 6:09 AM, Ævar Arnfjörð Bjarmason wrote:
>> 
>> On Mon, Dec 12 2022, Derrick Stolee via GitGitGadget wrote:
>> 
>>> From: Derrick Stolee <derrickstolee@github.com>
>>>
>>> The GIT_TEST_BUNDLE_URI environment variable is used in the t573* suite
>>> of tests that consume the bundle URIs advertised by the Git server. This
>>> variable is equivalent to setting transfer.bundleURI=true, so we can do
>>> that in these tests instead.
>> 
>> I think this is probably OK. I can't remember why I added both the env
>> variable and the setting in what became 0ef961dda05 (bundle-uri client:
>> add boolean transfer.bundleURI setting, 2022-12-05).
>> 
>> But I think this commit message really doesn't explain why it's OK to
>> remove it. In general we do have GIT_TEST_* settings that duplicate
>> config, e.g. GIT_TEST_PROTOCOL_VERSION.
>> 
>> We do so because we'd like the environment variable to override the
>> setting, or the other way around (I think depending on the GIT_TEST_*
>> variable it's either-or, it's a mess).
>
> If the variable is named GIT_TEST_* then it should be intended for
> use within tests. However, it provides _no value_ over the existing
> config option, so the tests are updated to use the config value
> instead.
>
> As mentioned, the one exception is where we don't want to uddate
> every test to use the config variable and instead want to set the
> GIT_TEST_* variable across all tests and see how it interacts with
> other tests. However, _as mentioned in the commit message_ this
> variable would not have any effect in other tests because the
> advertisement depends on other config options on the server side.

Makes sense, I think I had a bit of a mental block on it in my initial look at it. Re-reading your commit message it does make sense.

I think it makes sense to squash this in:
	
	diff --git a/transport.c b/transport.c
	index 77a61a9d7bb..efc8fa43183 100644
	--- a/transport.c
	+++ b/transport.c
	@@ -1523,7 +1523,7 @@ int transport_fetch_refs(struct transport *transport, struct ref *refs)
	 
	 int transport_get_remote_bundle_uri(struct transport *transport)
	 {
	-	int value = 0;
	+	int value;
	 	const struct transport_vtable *vtable = transport->vtable;
	 
	 	/* Check config only once. */

The reason we init'd the variable was because we were looking for this either in the environment or the config, so we needed to have a fallback in case we used the env var.

But with the logic after your fix-up we know that if we end up in the RHS of the "||" that "value" was initialized, as we returned 0 from the config API call.

Previous: Derrick StoleeNext: Derrick Stolee via GitGitGadget
Message 8 of 17 in “Bundle URIs 4.5: fixups from part IV”
  1. 0/3 Bundle URIs 4.5: fixups from part IVDerrick Stolee via GitGitGadget, Dec 12, 2022
  2. 2/3 bundle-uri: advertise based on repo configDerrick Stolee via GitGitGadget, Dec 12, 2022
  3. Ævar Arnfjörð BjarmasonDec 19, 2022
  4. Derrick StoleeDec 20, 2022
  5. 3/3 bundle-uri: remove GIT_TEST_BUNDLE_URI env variableDerrick Stolee via GitGitGadget, Dec 12, 2022
  6. Ævar Arnfjörð BjarmasonDec 19, 2022
  7. Derrick StoleeDec 20, 2022
  8. Ævar Arnfjörð BjarmasonDec 20, 2022
  9. 1/3 bundle-uri: drop unused 'uri' parameterDerrick Stolee via GitGitGadget, Dec 12, 2022
  10. Ævar Arnfjörð BjarmasonDec 19, 2022
  11. Junio C HamanoDec 20, 2022
  12. Derrick StoleeDec 20, 2022
  13. Ævar Arnfjörð BjarmasonDec 20, 2022
  14. Derrick StoleeDec 20, 2022
  15. Ævar Arnfjörð BjarmasonDec 20, 2022
  16. Victoria DyeDec 12, 2022
  17. Jeff KingDec 12, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.