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

Re: [PATCH 3/3] stash: fix stash application in sparse-checkouts

From
Elijah Newren <newren@gmail.com>
Date
Nov 22, 2020, 03:47 UTC
Message-ID
<CABPp-BELMS9o2+cCsefY-p9fF1j4BiYFaeYpLOHNmYXH3YVrpw@mail.gmail.com>
In-Reply-To
<CAPx1GvfaZ-pRznnOQELBYQ7LCk-sr_-Rd0aPcJ6ghM5yt8LpnA@mail.gmail.com>
On Sat, Nov 21, 2020 at 4:47 AM Chris Torek <chris.torek@gmail.com> wrote:
Show 15 quoted lines
>
> On Fri, Nov 20, 2020 at 8:56 AM Elijah Newren via GitGitGadget
> <gitgitgadget@gmail.com> wrote:
> > branch.  However, this simplistic view doesn't quite work in practice,
> > because stash tweaks it a bit due to two factors: (1) flags like
> > --keep-index and --include-untracked (why we used two different verbs,
> > 'keep' and 'include', is a rant for another day)
>
> :-)
>
> Not that this should affect any of these changes, but I'd also note
> that the fact that using `-u` or  `-a` makes a third commit that cannot
> be ignored later is a problem as well.  (`git stash list` should probably
> annotate the listed stashes as to whether they are two- or three-commit
> stashes.)

Yeah, it seems a bit odd when you compare to saving and applying cached changes; for that, stash requires you to specify BOTH --keep-index to to push/save, AND --index to pop/apply.

However, for saving and applying untracked or ignored changes, you merely need to record them at push/save time and they automatically always apply.

Not very consistent. (But, again, unrelated to these patches, so this is mostly just recreational complaining at this point. I'm not planning to tackle these bits.)

Show 13 quoted lines
> > stash has traditionally gotten this special behavior by first doing a
> > merge, and then when it's clean, applying a pipeline of commands to
> > modify the result.  This series of commands for
> > unstaging-non-newly-added-files came from the following commands:
> >
> >     git diff-index --cached --name-only --diff-filter=A $CTREE >"$a"
> >     git read-tree --reset $CTREE
> >     git update-index --add --stdin <"$a"
> >     rm -f "$a"
> >
> > You might that between the merge that proceeded these commands and these
>
> s/might/might think/, perhaps?  And, s/proceeded/preceded/, probably.
Indeed; thanks for catching those.  I will fix them up.
> (I didn't look closely at the rest of this but the idea seems sound.)
>
> Chris
Previous: Chris TorekNext: Junio C Hamano
Message 6 of 14 in “Fix stash apply in sparse checkouts (and a submodule test)”
  1. 0/3 Fix stash apply in sparse checkouts (and a submodule test)Elijah Newren via GitGitGadget, Nov 20, 2020
  2. 1/3 t7012: add a testcase demonstrating stash apply bugs in sparse checkoutsElijah Newren via GitGitGadget, Nov 20, 2020
  3. 2/3 stash: remove unnecessary process forkingElijah Newren via GitGitGadget, Nov 20, 2020
  4. 3/3 stash: fix stash application in sparse-checkoutsElijah Newren via GitGitGadget, Nov 20, 2020
  5. Chris TorekNov 21, 2020
  6. Elijah NewrenNov 22, 2020
  7. Junio C HamanoNov 25, 2020
  8. Elijah NewrenNov 26, 2020
  9. 0/3 Fix stash apply in sparse checkouts (and a submodule test)Elijah Newren via GitGitGadget, Dec 1, 2020
  10. 2/3 stash: remove unnecessary process forkingElijah Newren via GitGitGadget, Dec 1, 2020
  11. Junio C HamanoDec 1, 2020
  12. Elijah NewrenDec 2, 2020
  13. 3/3 stash: fix stash application in sparse-checkoutsElijah Newren via GitGitGadget, Dec 1, 2020
  14. 1/3 t7012: add a testcase demonstrating stash apply bugs in sparse checkoutsElijah Newren via GitGitGadget, Dec 1, 2020

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.