commit - 8993f42562696079866fc2dec7191877b6cc1f18
commit + 1edd9c2b609adfa7ed93dbd839b7d683e695feaa
blob - 304efb917050acadd79aae06eec9473ae5fdc797
blob + e2f352bf17421cfdc1dd349b9740f53d91599b2e
--- include/diff_output.h
+++ include/diff_output.h
int diff_output_plain(struct diff_output_info **output_info, FILE *dest,
const struct diff_input_info *info,
- const struct diff_result *result);
+ const struct diff_result *result,
+ int hunk_headers_only);
int diff_output_unidiff(struct diff_output_info **output_info,
FILE *dest, const struct diff_input_info *info,
const struct diff_result *result,
blob - 60533bd949aeec8ada84abec88bf7e58e93f5ff5
blob + 7b0082bd1b84c999c55bbf418266fd4a41017a0c
--- lib/diff_output_plain.c
+++ lib/diff_output_plain.c
output_plain_chunk(struct diff_output_info *outinfo,
FILE *dest, const struct diff_input_info *info,
const struct diff_result *result,
- struct diff_chunk_context *cc, off_t *outoff)
+ struct diff_chunk_context *cc, off_t *outoff, bool headers_only)
{
off_t *offp;
int left_start, left_len, right_start, right_len;
* additions and deletions when this happens.
*/
int c_idx;
- for (c_idx = cc->chunk.start; c_idx < cc->chunk.end; c_idx++) {
+ for (c_idx = cc->chunk.start; !headers_only && c_idx < cc->chunk.end;
+ c_idx++) {
const struct diff_chunk *c = &result->chunks.head[c_idx];
if (c->left_count && !c->right_count)
rc = diff_output_lines(outinfo, dest,
int
diff_output_plain(struct diff_output_info **output_info,
FILE *dest, const struct diff_input_info *info,
- const struct diff_result *result)
+ const struct diff_result *result, int hunk_headers_only)
{
struct diff_output_info *outinfo = NULL;
struct diff_chunk_context cc = {};
continue;
}
rc = output_plain_chunk(outinfo, dest, info, result, &cc,
- &outoff);
+ &outoff, hunk_headers_only);
if (rc != DIFF_RC_OK)
return rc;
cc = next;
}
if (!diff_chunk_context_empty(&cc))
return output_plain_chunk(outinfo, dest, info, result, &cc,
- &outoff);
+ &outoff, hunk_headers_only);
return DIFF_RC_OK;
}