Skip to content

stash apply: be prepared to run in a worktree's subdirectory #354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

dscho
Copy link
Member

@dscho dscho commented Sep 25, 2019

I saw this issue a couple times in my setup, and always wondered why nobody else seemed to be hit by this. When I finally found/made some time to investigate, I found out that it really requires a specific setup: I have many worktrees connected to my main git.git clone, often run inside t/ and I do stash quite often (now that git stash's performance is a joy on Windows).

Changes since v1:

  • We now make sure to also set GIT_DIR.

@dscho dscho added the ready to submit Has commits that have not been submitted yet label Sep 25, 2019
@dscho
Copy link
Member Author

dscho commented Sep 25, 2019

/submit

@dscho dscho removed the ready to submit Has commits that have not been submitted yet label Sep 25, 2019
@gitgitgadget
Copy link

gitgitgadget bot commented Sep 25, 2019

Submitted as [email protected]

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 4, 2019

This branch is now known as js/stash-apply-in-secondary-worktree.

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 4, 2019

This patch series was integrated into pu via git@be1984d.

@gitgitgadget gitgitgadget bot added the pu label Oct 4, 2019
@gitgitgadget
Copy link

gitgitgadget bot commented Oct 4, 2019

This patch series was integrated into pu via git@89ae45e.

When Git wants to spawn a child Git process inside a worktree's
subdirectory while `GIT_DIR` is set, we need to take care of specifying
the work tree's top-level directory explicitly because it cannot be
discovered: the current directory is _not_ the top-level directory of
the work tree, and neither is it inside the parent directory of
`GIT_DIR`.

This fixes the problem where `git stash apply` would report pretty much
everything deleted or untracked when run inside a worktree's
subdirectory.

To make sure that we do not introduce the "reverse problem", i.e. when
`GIT_WORK_TREE` is defined but `GIT_DIR` is not, we simply make sure
that both are set.

Signed-off-by: Johannes Schindelin <[email protected]>
@dscho dscho force-pushed the apply-stash-in-subdirectory branch from a687c16 to 4e19436 Compare October 4, 2019 09:22
@dscho
Copy link
Member Author

dscho commented Oct 4, 2019

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 4, 2019

Submitted as [email protected]

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 6, 2019

This patch series was integrated into pu via git@d30cef4.

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 7, 2019

This patch series was integrated into pu via git@2a166ea.

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 7, 2019

This patch series was integrated into next via git@b3474c9.

@gitgitgadget gitgitgadget bot added the next label Oct 7, 2019
@gitgitgadget
Copy link

gitgitgadget bot commented Oct 8, 2019

This patch series was integrated into pu via git@233bd9d.

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 9, 2019

This patch series was integrated into pu via git@04d4789.

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 9, 2019

This patch series was integrated into pu via git@ecaa71c.

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 11, 2019

This patch series was integrated into pu via git@66102cf.

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 11, 2019

This patch series was integrated into next via git@66102cf.

@gitgitgadget
Copy link

gitgitgadget bot commented Oct 11, 2019

This patch series was integrated into master via git@66102cf.

@gitgitgadget gitgitgadget bot added the master label Oct 11, 2019
@gitgitgadget gitgitgadget bot closed this Oct 11, 2019
@gitgitgadget
Copy link

gitgitgadget bot commented Oct 11, 2019

Closed via 66102cf.

@dscho dscho deleted the apply-stash-in-subdirectory branch October 11, 2019 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant