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

Re: "fatal: git-write-tree: error building trees" from `git stash`

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 27, 2012, 20:11 UTC
Message-ID
<7vhan7l0g6.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20121227190542.GB28811@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
> but I suspect it is not sufficient:
>
>   1. There are other code paths that will end up in write-tree which
>      should probably be protected, too.

Among 6 calls to write-tree, only the first ones in create_stash and apply_stash are about the index the user originally had. If the only expected failure case is unmerged entries, it should be sufficient to protect these two (and the one in apply_stash is already covered, I think).

>   2. Unmerged entries are only one reason that write-tree might fail.
>      It's OK not to catch them all (since ultimately write-tree will
>      complain if need be), but we may want to also handle intent-to-add
>      entries with a nicer message.
Hrmph.

We used to fail write-tree when I-T-A entries existed and relied on that behaviour to implement "no state lost"; as we broke write-tree recently by allowing to write a tree out by pretending that I-T-A entries do not exist, I think we broke it. Stashing with I-T-A and then unstashing it may lose the file. Sigh...

Previous: Jeff KingNext: Junio C Hamano
Message 5 of 6 in “"fatal: git-write-tree: error building trees" from `git stash`”
  1. Alex VandiverDec 27, 2012
  2. Junio C HamanoDec 27, 2012
  3. Alex VandiverDec 27, 2012
  4. Jeff KingDec 27, 2012
  5. Junio C HamanoDec 27, 2012
  6. Junio C HamanoDec 27, 2012

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.