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

Re: [PATCH] commit: write out cache-tree information

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 2, 2011, 21:15 UTC
Message-ID
<7vfwljecqv.fsf@alter.siamese.dyndns.org>
In-Reply-To
<7vmxfrel63.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
Show 12 quoted lines
>> While write-tree has code to write out the cache-tree information
>> (since we have to compute it anyway if the cache is stale), commit
>> lost this capability when it became a builtin and moved away from
>> using write-tree.
>
> Earlier the code read from the index, made sure that it is not unmerged by
> running cache_tere_update(), before running prepare-commit-msg hook. The
> hook used to see the index that was read in this codepath which is the
> same as what pre-commit left us.
>
> Why run an extra I/O here? The index file could be quite large, and I do
> not want people to writing it out without good reason.

One possible good reason is if you did this only when we are committing the whole index. Then theoretically the next operation after commit could start from a fully populated cache-tree in the index.

When we are running a partial commit, the index file you are writing back is a temporary index only to build a tree object to record in the commit, which we already have done, and the temporary will be discarded.

Previous: Junio C HamanoNext: Thomas Rast
Message 3 of 4 in “commit: write out cache-tree information”
  1. commit: write out cache-tree informationtrast@student.ethz.ch, Aug 2, 2011
  2. Junio C HamanoAug 2, 2011
  3. Junio C HamanoAug 2, 2011
  4. Thomas RastAug 2, 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.