mbox series

[0/3] Fix stash apply in sparse checkouts (and a submodule test)

Message ID pull.919.git.git.1605891222.gitgitgadget@gmail.com (mailing list archive)
Headers show
Series Fix stash apply in sparse checkouts (and a submodule test) | expand

Message

Philippe Blain via GitGitGadget Nov. 20, 2020, 4:53 p.m. UTC
Heavier usage of sparse-checkouts at $DAYJOB is commencing. And an issue
with git stash apply was found.

git stash's implementation as a pipeline of forked commands presents some
problems, especially when implemented atop of three commands that all behave
differently in the presence of sparse checkouts. Add a testcase
demonstrating some issues with git stash apply in a repository with a
different set of sparse-checkout patterns at apply vs create time, clean up
the relevant section of git stash code, and incidentally fix a submodule
testcase unrelated to sparse checkouts. Provide some detailed commit
messages explaining the issues along the way.

NOTE: I found a couple minor issues with other commands in sparse checkouts
while debugging this issue, but I don't yet have fixes for them and I can
submit them separately.

Elijah Newren (3):
  t7012: add a testcase demonstrating stash apply bugs in sparse
    checkouts
  stash: remove unnecessary process forking
  stash: fix stash application in sparse-checkouts

 builtin/stash.c                  | 130 +++++++++++++++++++++----------
 t/lib-submodule-update.sh        |  16 ++--
 t/t7012-skip-worktree-writing.sh |  88 +++++++++++++++++++++
 3 files changed, 184 insertions(+), 50 deletions(-)


base-commit: faefdd61ec7c7f6f3c8c9907891465ac9a2a1475
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-919%2Fnewren%2Fsparse-checkout-fixups-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-919/newren/sparse-checkout-fixups-v1
Pull-Request: https://github.com/git/git/pull/919

Comments

Junio C Hamano Nov. 25, 2020, 10:14 p.m. UTC | #1
"Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Heavier usage of sparse-checkouts at $DAYJOB is commencing. And an issue
> with git stash apply was found.
>
> git stash's implementation as a pipeline of forked commands presents some
> problems, especially when implemented atop of three commands that all behave
> differently in the presence of sparse checkouts. Add a testcase
> demonstrating some issues with git stash apply in a repository with a
> different set of sparse-checkout patterns at apply vs create time, clean up
> the relevant section of git stash code, and incidentally fix a submodule
> testcase unrelated to sparse checkouts. Provide some detailed commit
> messages explaining the issues along the way.
>
> NOTE: I found a couple minor issues with other commands in sparse checkouts
> while debugging this issue, but I don't yet have fixes for them and I can
> submit them separately.

Any comments on this from reviewers?  The second patch is a but too
busy looking and I am having a bit of trouble convincing myself that
it is doing the right thing.

Thanks.
Elijah Newren Nov. 26, 2020, 5:31 a.m. UTC | #2
On Wed, Nov 25, 2020 at 2:14 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > Heavier usage of sparse-checkouts at $DAYJOB is commencing. And an issue
> > with git stash apply was found.
> >
> > git stash's implementation as a pipeline of forked commands presents some
> > problems, especially when implemented atop of three commands that all behave
> > differently in the presence of sparse checkouts. Add a testcase
> > demonstrating some issues with git stash apply in a repository with a
> > different set of sparse-checkout patterns at apply vs create time, clean up
> > the relevant section of git stash code, and incidentally fix a submodule
> > testcase unrelated to sparse checkouts. Provide some detailed commit
> > messages explaining the issues along the way.
> >
> > NOTE: I found a couple minor issues with other commands in sparse checkouts
> > while debugging this issue, but I don't yet have fixes for them and I can
> > submit them separately.
>
> Any comments on this from reviewers?  The second patch is a but too
> busy looking and I am having a bit of trouble convincing myself that
> it is doing the right thing.

Hmm, that diff is a little hard to read.  It's a removal of two
functions, and an addition of a new one, but the way the diff reads it
looks like I'm modifying the existing functions because it catches
some comment line markers and thinks they're similar.  Maybe it'd be
easier to read if I inserted that function elsewhere in the file?

I'll send a re-roll with that and add a comment or two to help explain
it (as well as fix up the small issues Chris highlighted).