mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-08 03:15:46 +00:00
Minor bug fixes in diff code
In looking at PR #878, I found a few small bugs in the diff code, mostly related to work that can be avoided when processing tree- to-tree diffs that was always being carried out. This commit has some small fixes in it.
This commit is contained in:
parent
cfda29e382
commit
5fdc41e765
@ -470,7 +470,8 @@ static int maybe_modified(
|
|||||||
|
|
||||||
/* on platforms with no symlinks, preserve mode of existing symlinks */
|
/* on platforms with no symlinks, preserve mode of existing symlinks */
|
||||||
if (S_ISLNK(omode) && S_ISREG(nmode) &&
|
if (S_ISLNK(omode) && S_ISREG(nmode) &&
|
||||||
!(diff->diffcaps & GIT_DIFFCAPS_HAS_SYMLINKS))
|
!(diff->diffcaps & GIT_DIFFCAPS_HAS_SYMLINKS) &&
|
||||||
|
new_iter->type == GIT_ITERATOR_WORKDIR)
|
||||||
nmode = omode;
|
nmode = omode;
|
||||||
|
|
||||||
/* on platforms with no execmode, just preserve old mode */
|
/* on platforms with no execmode, just preserve old mode */
|
||||||
|
@ -162,7 +162,7 @@ static int file_is_binary_by_attr(
|
|||||||
mirror_new = (delta->new_file.path == delta->old_file.path ||
|
mirror_new = (delta->new_file.path == delta->old_file.path ||
|
||||||
strcmp(delta->new_file.path, delta->old_file.path) == 0);
|
strcmp(delta->new_file.path, delta->old_file.path) == 0);
|
||||||
if (mirror_new)
|
if (mirror_new)
|
||||||
delta->new_file.flags &= (delta->old_file.flags & BINARY_DIFF_FLAGS);
|
delta->new_file.flags |= (delta->old_file.flags & BINARY_DIFF_FLAGS);
|
||||||
else
|
else
|
||||||
error = update_file_is_binary_by_attr(diff->repo, &delta->new_file);
|
error = update_file_is_binary_by_attr(diff->repo, &delta->new_file);
|
||||||
|
|
||||||
@ -397,6 +397,7 @@ int git_diff_foreach(
|
|||||||
|
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
delta->new_file.flags |= GIT_DIFF_FILE_VALID_OID;
|
||||||
|
|
||||||
/* since we did not have the definitive oid, we may have
|
/* since we did not have the definitive oid, we may have
|
||||||
* incorrect status and need to skip this item.
|
* incorrect status and need to skip this item.
|
||||||
|
@ -30,7 +30,8 @@ int diff_file_fn(
|
|||||||
|
|
||||||
GIT_UNUSED(progress);
|
GIT_UNUSED(progress);
|
||||||
|
|
||||||
e-> at_least_one_of_them_is_binary = delta->binary;
|
if (delta->binary)
|
||||||
|
e->at_least_one_of_them_is_binary = true;
|
||||||
|
|
||||||
e->files++;
|
e->files++;
|
||||||
switch (delta->status) {
|
switch (delta->status) {
|
||||||
|
Loading…
Reference in New Issue
Block a user