diff options
| author | Vicent Martà <vicent@github.com> | 2013-11-04 08:05:55 -0800 |
|---|---|---|
| committer | Vicent Martà <vicent@github.com> | 2013-11-04 08:05:55 -0800 |
| commit | 5a0b88036f612ce7e9cdc24517c9b9eb6100a3d7 (patch) | |
| tree | 835825d113deeceef856702bfd7b427648579b4d /tests-clar/diff/diff_helpers.c | |
| parent | becb13c0f04c4ba54cf27303136293dbf8abfd73 (diff) | |
| parent | 3e57069e821ecf966c3de9c79923cd77657e923b (diff) | |
| download | libgit2-5a0b88036f612ce7e9cdc24517c9b9eb6100a3d7.tar.gz | |
Merge pull request #1929 from libgit2/rb/misc-diff-fixes
Fix some observed problems with incorrect diffs
Diffstat (limited to 'tests-clar/diff/diff_helpers.c')
| -rw-r--r-- | tests-clar/diff/diff_helpers.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tests-clar/diff/diff_helpers.c b/tests-clar/diff/diff_helpers.c index 466d0ef54..33bb561f6 100644 --- a/tests-clar/diff/diff_helpers.c +++ b/tests-clar/diff/diff_helpers.c @@ -221,11 +221,15 @@ static int diff_print_cb( const git_diff_line *line, void *payload) { - GIT_UNUSED(payload); - GIT_UNUSED(delta); - GIT_UNUSED(hunk); - fprintf((FILE *)payload, "%c%.*s", - line->origin, (int)line->content_len, line->content); + FILE *fp = payload; + + GIT_UNUSED(delta); GIT_UNUSED(hunk); + + if (line->origin == GIT_DIFF_LINE_CONTEXT || + line->origin == GIT_DIFF_LINE_ADDITION || + line->origin == GIT_DIFF_LINE_DELETION) + fputc(line->origin, fp); + fwrite(line->content, 1, line->content_len, fp); return 0; } |
