Skip to content
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

Draft: Include 'deleted' files in sparse reapply #40

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cmbartschat
Copy link

This seems to be fixing things. Not sure if this is a sign of something else not working, or if this is expected.

@@ -415,7 +415,7 @@ int git_sparse_checkout__reapply(git_repository *repo, git_sparse *sparse)
/* Don't touch files that aren't current */
if ((error = git_status_file(&status_flags, repo, entry->path)) < 0)
goto done;
if (status_flags != GIT_STATUS_CURRENT)
if (status_flags != GIT_STATUS_CURRENT && status_flags != GIT_STATUS_WT_DELETED)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

status_flags are a bitmask, so seeing equality operators is a bit strange.

Stepping back – GIT_STATUS_CURRENT are files where the Index and working directory match the HEAD ref. git reapply doesn't want obliterate an unstaged or staged change. Arguably this should be allowed with a force flag, regardless, the underlying problem is that git_status_file is showing GIT_STATUS_WT_DELETED when a file is missing from the worktree (I'm guessing because it is not in the sparse checkout).

Perhaps the root fix it to modify git_status_file to that it doesn't return GIT_STATUS_WT_DELETE for sparse-no-checkout files?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants