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

Re: Bug in fetch-pack.c, please confirm

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 15, 2015, 07:30 UTC
Message-ID
<xmqq3856vhtt.fsf@gitster.dls.corp.google.com>
In-Reply-To
<xmqqa8zevhya.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 18 quoted lines
> "Kyle J. McKay" <mackyle@gmail.com> writes:
>
>> Hi guys,
>>
>> So I was looking at fetch-pack.c (from master @ 52cae643, but I think  
>> it's the same everywhere):
>>
> ...
>> -		hashcpy(ref->new_sha1, local);
>> +		hashcpy(ref->new_sha1, o->sha1);
>>  		if (!args->verbose)
>>  			continue;
>>  		fprintf(stderr,
>>  			"already have %s (%s)\n", sha1_to_hex(remote),
>>  			ref->name);
>>  	}
>>  	return retval;
>> ---

One thing I wonder is if this hashcpy() is doing anything useful, though. Is ref->new_sha1 used after we are done in this codepath, or is the reason nobody noticed it is because it does not matter whatever garbage is in that field nobody looks at it?

Previous: Junio C HamanoNext: Kyle J. McKay
Message 3 of 14 in “Bug in fetch-pack.c, please confirm”
  1. Kyle J. McKayMar 15, 2015
  2. Junio C HamanoMar 15, 2015
  3. Junio C HamanoMar 15, 2015
  4. Kyle J. McKayMar 15, 2015
  5. Jeff KingMar 16, 2015
  6. Junio C HamanoMar 19, 2015
  7. Jeff KingMar 19, 2015
  8. Junio C HamanoMar 19, 2015
  9. Jeff KingMar 19, 2015
  10. 1/4 filter_ref: avoid overwriting ref->old_sha1 with garbageJeff King, Mar 19, 2015
  11. Junio C HamanoMar 19, 2015
  12. 2/4 filter_ref: make a copy of extra "sought" entriesJeff King, Mar 19, 2015
  13. 3/4 fetch_refs_via_pack: free extra copy of refsJeff King, Mar 19, 2015
  14. 4/4 fetch-pack: remove dead assignment to ref->new_sha1Jeff King, Mar 19, 2015

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.