All of lore.kernel.org
 help / color / mirror / Atom feed
* Sparse-checkout excluded files show as deleted in git status after some operations
@ 2017-04-06 16:39 Ross Allan
  0 siblings, 0 replies; only message in thread
From: Ross Allan @ 2017-04-06 16:39 UTC (permalink / raw)
  To: git

Hi,

Sometimes when working on a repository with files excluded using the
sparse checkout feature, the skip-worktree flag is incorrectly unset
causing files to show as deleted in git status.

Initially I reported this to git-for-windows at
https://github.com/git-for-windows/git/issues/811 but was recommended
to go here as it is not a windows specific issue (my mistake there).

It has happened a few times when merging and cherry picking. Here is
an example repository which can be used to demonstrate the issue:
https://github.com/nallar/git-issue-sparse-checkout

The following commands run into the issue.

git clone https://github.com/nallar/git-issue-sparse-checkout.git
mcve-sparse-checkout
cd mcve-sparse-checkout
git config core.sparseCheckout true
cp sparse-checkout .git/info/sparse-checkout
git checkout -f master
git reset --hard HEAD
# We now have sparse checkout enabled, so the folder "excluded-folder"
should not be present
ls
# We should have no changes so far
git status
# Cherry-pick top commit from the other branch
git cherry-pick other
# That cherry-pick succeeded with no conflicts. We should have no
unstaged changes
git status
# Oh dear, now it shows 'deleted:    excluded-folder/1.txt'
# Workaround, set skip-worktree which for some reason got unset:
git update-index --skip-worktree excluded-folder/1.txt
# Now it's showing the correct result again
git status
# no changes

Full log demonstrating issue:
https://gist.github.com/anonymous/e1e29f0eb9df25b506fdf555827c73ac

Thanks
Ross Allan

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-06 16:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-06 16:39 Sparse-checkout excluded files show as deleted in git status after some operations Ross Allan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.