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

Re: [PATCH] fetch: remove fetch_if_missing=0

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 2, 2019, 05:55 UTC
Message-ID
<xmqqv9s23jr5.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20191101220537.GA249573@google.com>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 25 quoted lines
>> @@ -1755,8 +1756,6 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
>>  
>>  	packet_trace_identity("fetch");
>>  
>> -	fetch_if_missing = 0;
>> -
>
> This is the scary part, but in an "uncomfortably exciting" sense rather
> than a worrying one.  Thanks for adding a test.
>
> [...]
>> --- a/fetch-pack.c
>> +++ b/fetch-pack.c
>> @@ -673,7 +673,8 @@ static void mark_complete_and_common_ref(struct fetch_negotiator *negotiator,
>>  		struct object *o;
>>  
>>  		if (!has_object_file_with_flags(&ref->old_oid,
>> -						OBJECT_INFO_QUICK))
>> +						OBJECT_INFO_QUICK |
>> +							OBJECT_INFO_SKIP_FETCH_OBJECT))
>
> Should we make OBJECT_INFO_QUICK always imply
> OBJECT_INFO_SKIP_FETCH_OBJECT?  I would suspect that if we are willing to
> avoid checking thoroughly locally, checking remotely would be even more
> undesirable.

I think I've seen this mentioned a few times during this cycle in the list archive ;-)

Show 6 quoted lines
>> +	for i in $(seq 1 100)
>> +	do
>> +		echo line $i >>big-blob.txt
>> +	done &&
>
> Should this use test_seq for better portability?
Yup.
> nit: can avoid a subshell:
>
> 	test_seq 1 100 | sed -e 's/^/line /' >big-blob.txt

Yeah, but it costs process start-up and "sed" that may be rather heavyweight. At least

	for i in $(test_seq ...)
	do
		echo line $i
	done >big-blob.txt
would save repeated opening and closing the file, I'd think.
Show 9 quoted lines
>> +	git hash-object big-blob.txt >hash &&
>> +	grep "want $(cat hash)" trace
>
> nit: can avoid using cat:
>
> 	hash=$(git hash-object big-blob.txt) &&
> 	grep "want $hash" trace
>
> Thanks and hope that helps,
Thanks, both.
Previous: Jonathan NiederNext: Eric Sunshine
Message 3 of 12 in “fetch: remove fetch_if_missing=0”
  1. fetch: remove fetch_if_missing=0Jonathan Tan, Nov 1, 2019
  2. Jonathan NiederNov 1, 2019
  3. Junio C HamanoNov 2, 2019
  4. Eric SunshineNov 2, 2019
  5. Junio C HamanoNov 2, 2019
  6. Jonathan TanNov 5, 2019
  7. Jonathan NiederNov 5, 2019
  8. fetch: remove fetch_if_missing=0Jonathan Tan, Nov 5, 2019
  9. Eric SunshineNov 5, 2019
  10. Junio C HamanoNov 6, 2019
  11. Junio C HamanoNov 8, 2019
  12. Junio C HamanoNov 8, 2019

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.