Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f4e3dae

Browse files
author
Edward Thomson
committed
diff_print: change test for skipping binary printing
Instead of skipping printing a binary diff when there is no data, skip printing when we have a status of `UNMODIFIED`. This is more in-line with our internal data model and allows us to expand the notion of binary data. In the future, there may have no data because the files were unmodified (there was no data to produce) or it may have no data because there was no data given to us in a patch. We want to treat these cases separately.
1 parent 4bfd7c6 commit f4e3dae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/diff_print.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -521,13 +521,13 @@ static int diff_print_patch_file_binary(
521521
size_t pre_binary_size;
522522
int error;
523523

524+
if (delta->status == GIT_DELTA_UNMODIFIED)
525+
return 0;
526+
524527
if ((pi->flags & GIT_DIFF_SHOW_BINARY) == 0)
525528
return diff_print_patch_file_binary_noshow(
526529
pi, delta, old_pfx, new_pfx);
527530

528-
if (binary->new_file.datalen == 0 && binary->old_file.datalen == 0)
529-
return 0;
530-
531531
pre_binary_size = pi->buf->size;
532532
git_buf_printf(pi->buf, "GIT binary patch\n");
533533
pi->line.num_lines++;

0 commit comments

Comments
 (0)