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

Re: Can't diff against the 00000000 revision

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 12, 2016, 18:52 UTC
Message-ID
<xmqqpox6tyti.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<jwvr3hmwz1n.fsf-monnier+gmane.comp.version-control.git@gnu.org>
Stefan Monnier <monnier@iro.umontreal.ca> writes:
Show 11 quoted lines
>> And hopefully that explains why "000000" does not necessarily make a
>> good placeholder for "the empty thing". There are multiple empty things,
>> and it is not clear what:
>
>>   git diff 0000000 1234abcd
>
>> means. Is 0000000 a tree? A blob?
>
> Well, Git is the one who uses 000000 to refer to an empty thing, but
> indeed it seems like it does inconsistently: it's sometimes used as the
> "empty blob" and sometimes as an "empty tree".

Git does not use 0*40 to refer to "an empty thing" at all. It is used to denote a "missing thing". A change to _create_ a new file and a diff to _modify_ an existing empty file are conceptually two different things, and are shown differently.

It would be incorrect to say "it used to be an empty blob" by using e69de29bb2d1d on the left hand side of a patch that creates a new file.

Previous: Jeff KingNext: Andreas Schwab
Message 6 of 8 in “Can't diff against the 00000000 revision”
  1. Stefan MonnierJan 12, 2016
  2. Jeff KingJan 12, 2016
  3. Jeff KingJan 12, 2016
  4. Stefan MonnierJan 12, 2016
  5. Jeff KingJan 12, 2016
  6. Junio C HamanoJan 12, 2016
  7. Andreas SchwabJan 12, 2016
  8. Jeff KingJan 12, 2016

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.