git_apply() adds the deleted files to the index even if 1 is returned from git_apply_delta_cb
GloriousPtr opened this issue · comments
Mohit Sethi commented
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