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

git_apply() adds the deleted files to the index even if 1 is returned from git_apply_delta_cb #6643

Open
MohitSethi99 opened this issue Oct 7, 2023 · 0 comments

Comments

@MohitSethi99
Copy link

MohitSethi99 commented Oct 7, 2023

Reproduction steps

int DeltaCallback(const git_diff_delta* delta, void* payload) { return 1; }
int HunkCallback(const git_diff_hunk* delta, void* payload) { return 1; }

git_diff_options diffOptions = GIT_DIFF_OPTIONS_INIT;
diffOptions.flags = GIT_DIFF_MINIMAL | GIT_DIFF_INDENT_HEURISTIC | GIT_DIFF_UPDATE_INDEX | GIT_DIFF_SHOW_UNTRACKED_CONTENT;
diffOptions.context_lines = contextLines;
git_diff* diff = nullptr;
git_diff_index_to_workdir(&diff, repo, nullptr, &diffOptions);

git_apply_options applyOptions = GIT_APPLY_OPTIONS_INIT;
applyOptions.delta_cb = DeltaCallback;
applyOptions.hunk_cb = HunkCallback;
git_apply(repo, diff, GIT_APPLY_LOCATION_INDEX, &applyOptions);

Expected behavior

Should not add the deleted file to the index

Actual behavior

Adds the deleted file to the index

Version of libgit2 (release number or SHA1)

v1.7.1 (a2bde63)

Operating system(s) tested

Windows 11 x64

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

No branches or pull requests

1 participant