mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-21 18:30:56 +00:00
patch_generate: remove duplicated logic
Under the existing logic, we try to load patch contents differently, depending on whether the patch files stem from the working directory or not. But actually, the executed code paths are completely equal to each other -- so we were always the code despite the condition. Remove the condition altogether and conflate both code paths.
This commit is contained in:
parent
53454be87f
commit
41019152a0
@ -206,35 +206,14 @@ static int patch_generated_load(git_patch_generated *patch, git_patch_generated_
|
||||
((patch->nfile.flags & GIT_DIFF_FLAG__NO_DATA) != 0 ||
|
||||
(patch->nfile.file->flags & GIT_DIFF_FLAG_VALID_ID) != 0));
|
||||
|
||||
/* always try to load workdir content first because filtering may
|
||||
* need 2x data size and this minimizes peak memory footprint
|
||||
*/
|
||||
if (patch->ofile.src == GIT_ITERATOR_TYPE_WORKDIR) {
|
||||
if ((error = git_diff_file_content__load(
|
||||
&patch->ofile, &patch->base.diff_opts)) < 0 ||
|
||||
should_skip_binary(patch, patch->ofile.file))
|
||||
goto cleanup;
|
||||
}
|
||||
if (patch->nfile.src == GIT_ITERATOR_TYPE_WORKDIR) {
|
||||
if ((error = git_diff_file_content__load(
|
||||
&patch->nfile, &patch->base.diff_opts)) < 0 ||
|
||||
should_skip_binary(patch, patch->nfile.file))
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* once workdir has been tried, load other data as needed */
|
||||
if (patch->ofile.src != GIT_ITERATOR_TYPE_WORKDIR) {
|
||||
if ((error = git_diff_file_content__load(
|
||||
&patch->ofile, &patch->base.diff_opts)) < 0 ||
|
||||
should_skip_binary(patch, patch->ofile.file))
|
||||
goto cleanup;
|
||||
}
|
||||
if (patch->nfile.src != GIT_ITERATOR_TYPE_WORKDIR) {
|
||||
if ((error = git_diff_file_content__load(
|
||||
&patch->nfile, &patch->base.diff_opts)) < 0 ||
|
||||
should_skip_binary(patch, patch->nfile.file))
|
||||
goto cleanup;
|
||||
}
|
||||
if ((error = git_diff_file_content__load(
|
||||
&patch->ofile, &patch->base.diff_opts)) < 0 ||
|
||||
should_skip_binary(patch, patch->ofile.file))
|
||||
goto cleanup;
|
||||
if ((error = git_diff_file_content__load(
|
||||
&patch->nfile, &patch->base.diff_opts)) < 0 ||
|
||||
should_skip_binary(patch, patch->nfile.file))
|
||||
goto cleanup;
|
||||
|
||||
/* if previously missing an oid, and now that we have it the two sides
|
||||
* are the same (and not submodules), update MODIFIED -> UNMODIFIED
|
||||
|
Loading…
Reference in New Issue
Block a user