diff options
| author | Gregory Herrero <gregory.herrero@oracle.com> | 2019-11-07 13:08:51 +0100 |
|---|---|---|
| committer | Gregory Herrero <gregory.herrero@oracle.com> | 2019-11-19 09:33:12 +0100 |
| commit | b921964b25c14c8dfeb26d1a5efedb28ee9e7284 (patch) | |
| tree | 4951bf22e505d7921c975f1545e692243ecb7d7b /src/diff_print.c | |
| parent | accd78486523ef875a941ed65b02c56902074d76 (diff) | |
| download | libgit2-b921964b25c14c8dfeb26d1a5efedb28ee9e7284.tar.gz | |
diff_print: add support for GIT_DIFF_FORMAT_PATCH_ID.
Git is generating patch-id using a stripped down version of a patch
where hunk header and index information are not present.
Signed-off-by: Gregory Herrero <gregory.herrero@oracle.com>
Diffstat (limited to 'src/diff_print.c')
| -rw-r--r-- | src/diff_print.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/diff_print.c b/src/diff_print.c index 4124bcb2e..369e5c1e6 100644 --- a/src/diff_print.c +++ b/src/diff_print.c @@ -571,7 +571,7 @@ static int diff_print_patch_file( (pi->flags & GIT_DIFF_FORCE_BINARY); bool show_binary = !!(pi->flags & GIT_DIFF_SHOW_BINARY); int id_strlen = pi->id_strlen; - bool print_index = true; + bool print_index = (pi->format != GIT_DIFF_FORMAT_PATCH_ID); if (binary && show_binary) id_strlen = delta->old_file.id_abbrev ? delta->old_file.id_abbrev : @@ -677,6 +677,11 @@ int git_diff_print( print_hunk = diff_print_patch_hunk; print_line = diff_print_patch_line; break; + case GIT_DIFF_FORMAT_PATCH_ID: + print_file = diff_print_patch_file; + print_binary = diff_print_patch_binary; + print_line = diff_print_patch_line; + break; case GIT_DIFF_FORMAT_PATCH_HEADER: print_file = diff_print_patch_file; break; |
