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

Re: [BUG] stash.index=true leaves a redundant stash entry after an autostash fast-forward

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Sep 17, 2026, 09:24 UTC
Message-ID
<fd4c2cc3-d457-49b0-bf3c-96063e40700d@gmail.com>
In-Reply-To
<0BCA251B-9536-46E3-A6C5-7F917366F92D@gmail.com>
Hi Ben
On 16/09/2026 15:30, Ben Knoble wrote:
Show 13 quoted lines
>> Le 16 sept. 2026 à 09:35, Phillip Wood <phillip.wood123@gmail.com> a écrit :
>> Taking a step back, this code applies the stashed index changes
>> into the current index, writes the result to a tree and then resets
>> the index to HEAD. We could avoid touching the index at all if we
>> used merge_incore_nonrecursive() to cherry pick the index changes
>> instead. That way we'd get a proper three-way merge and avoid
>> spawning subprocesses for "git diff-tree", "git apply --cached",
>> and "git reset". We're already using merge_ort_nonrecursive() to
>> merge the working tree changes in that function so we have nearly
>> everything we need already set up to merge the index changes as
>> well. Essentially, when merging the index, we just need to call
>> merge_incore_nonrecursive() instead of merge_ort_nonrecursive()
>> and use info->i_tree instead of info->w_tree.
> 
> Wow, I wish I’d had this info this morning! I spent a couple hours
 > trying to understand this flow and still don’t have it in my head :)
 > Thanks for the pointers.
It is a bit confusing the way it updates the index, then resets it only 
to update it again at the end. I don't think we can avoid that though if 
we want to error out when there are conflicts merging the index.
> I may try to summarize my own notes (= questions about the existing
 > code) and send those out later today, though, since I’d love to make
 > my understanding line up with yours!
I'm happy to try and answer any questions, on or off the list - it would 
be really nice if we can merge the index changes and avoid a bunch a 
subprocesses.
Thanks
Phillip
Previous: D. Ben KnobleNext: D. Ben Knoble
Message 7 of 12 in “[BUG] stash.index=true leaves a redundant stash entry after an autostash fast-forward”
  1. Eli BarzilaySep 7, 2026
  2. D. Ben KnobleSep 15, 2026
  3. Phillip WoodSep 16, 2026
  4. Ben KnobleSep 16, 2026
  5. Eli BarzilaySep 16, 2026
  6. D. Ben KnobleSep 17, 2026
  7. Phillip WoodSep 17, 2026
  8. D. Ben KnobleSep 17, 2026
  9. Phillip WoodSep 17, 2026
  10. Phillip WoodSep 19, 2026
  11. D. Ben KnobleSep 19, 2026
  12. D. Ben KnobleSep 19, 2026

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.