diff options
author | Edward Thomson <ethomson@github.com> | 2016-09-02 11:26:16 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2016-09-02 11:26:16 -0500 |
commit | f4e3dae75ff7246952f6707ad2a2fdea758e03ea (patch) | |
tree | bdb0c8ee7ee3b21d87ed64a79e7e72bc2add21a6 | |
parent | 4bfd7c63fcd920af8366e521b7e985ded7cb3e84 (diff) | |
download | libgit2-f4e3dae75ff7246952f6707ad2a2fdea758e03ea.tar.gz |
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.
-rw-r--r-- | src/diff_print.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/diff_print.c b/src/diff_print.c index f72ca8935..264bd19e9 100644 --- a/src/diff_print.c +++ b/src/diff_print.c @@ -521,13 +521,13 @@ static int diff_print_patch_file_binary( size_t pre_binary_size; int error; + if (delta->status == GIT_DELTA_UNMODIFIED) + return 0; + if ((pi->flags & GIT_DIFF_SHOW_BINARY) == 0) return diff_print_patch_file_binary_noshow( pi, delta, old_pfx, new_pfx); - if (binary->new_file.datalen == 0 && binary->old_file.datalen == 0) - return 0; - pre_binary_size = pi->buf->size; git_buf_printf(pi->buf, "GIT binary patch\n"); pi->line.num_lines++; |