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

Re: [PATCH jn/fast-import-fix v3] fast-import: treat filemodify with empty tree as delete

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jan 27, 2011, 00:26 UTC
Message-ID
<20110127002607.GA30911@burratino>
In-Reply-To
<7vd3nji54o.fsf@alter.siamese.dyndns.org>
Junio C Hamano wrote:
> Jonathan Nieder <jrnieder@gmail.com> writes:
>> Hmm.  I suppose on top of b2124125 (jn/fast-import-fix).
>
> Hmm, why not on top of v1.7.3-rc0~75^2 aka 334fba6 (Teach fast-import to
> import subtrees named by tree id, 2010-06-30) then?
That could work, too. ;-)

I was too lazy to check if the test case happens to work in the absence of the fixes from the fast-import-fix branch.

Show 12 quoted lines
>> +++ b/fast-import.c
>> @@ -2194,6 +2194,16 @@ static void file_change_m(struct branch *b)
>>  		p = uq.buf;
>>  	}
>>  
>> +	/*
>> +	 * Git does not track empty, non-toplevel directories.
>> +	 */
>> +	if (S_ISDIR(mode) &&
>> +	    !memcmp(sha1, (const unsigned char *) EMPTY_TREE_SHA1_BIN, 20) &&
>
> Do you need this cast?
No, it's not needed.

(EMPTY_TREE_SHA1_BIN is a string constant, originally intended for use in initializers like

	static const unsigned char empty_tree_sha1[20] = EMPTY_TREE_SHA1_BIN;
memcmp does not care about such considerations.)
Previous: Junio C HamanoNext: Jonathan Nieder
Message 15 of 24 in “fast-import: add 'ls' command”
  1. fast-import: add 'ls' commandDavid Barr, Dec 2, 2010
  2. fast-import: add 'ls' commandDavid Barr, Dec 2, 2010
  3. Sverre RabbelierDec 2, 2010
  4. David Michael BarrDec 2, 2010
  5. Jonathan NiederDec 2, 2010
  6. Junio C HamanoDec 2, 2010
  7. David BarrDec 2, 2010
  8. 0/3 fast-import: add 'ls' commandJonathan Nieder, Jan 3, 2011
  9. 1/3 fast-import: clarify handling of cat-blob featureJonathan Nieder, Jan 3, 2011
  10. 2/3 fast-import: treat filemodify with empty tree as deleteJonathan Nieder, Jan 3, 2011
  11. fast-import: treat filemodify with empty tree as deleteJonathan Nieder, Jan 26, 2011
  12. Sverre RabbelierJan 26, 2011
  13. fast-import: treat filemodify with empty tree as deleteJonathan Nieder, Jan 26, 2011
  14. Junio C HamanoJan 27, 2011
  15. Jonathan NiederJan 27, 2011
  16. fast-import: treat filemodify with empty tree as deleteJonathan Nieder, Jan 27, 2011
  17. Peter BaumannJan 27, 2011
  18. Jonathan NiederJan 27, 2011
  19. Peter BaumannJan 27, 2011
  20. Peter BaumannJan 27, 2011
  21. Jonathan NiederJan 28, 2011
  22. 3/3 fast-import: add 'ls' commandJonathan Nieder, Jan 3, 2011
  23. [RFC] fast-import: 'cat-blob' and 'ls' commandsJonathan Nieder, Jan 26, 2011
  24. Sam VilainJan 26, 2011

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.