diff options
| author | Edward Thomson <ethomson@microsoft.com> | 2015-09-29 12:18:17 -0400 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-10-05 22:59:50 +0200 |
| commit | 6c014bcc54fb9923490f9af917dc43e3661e5782 (patch) | |
| tree | 14aab64697551506df5e038d3093278cbc6d6c64 /src/diff_patch.c | |
| parent | e43520660c6dba6470af28ce3be822be401f5788 (diff) | |
| download | libgit2-6c014bcc54fb9923490f9af917dc43e3661e5782.tar.gz | |
diff: don't feed large files to xdiff
Diffstat (limited to 'src/diff_patch.c')
| -rw-r--r-- | src/diff_patch.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/diff_patch.c b/src/diff_patch.c index 0628da6f2..50faa3b3f 100644 --- a/src/diff_patch.c +++ b/src/diff_patch.c @@ -30,6 +30,10 @@ static void diff_patch_update_binary(git_patch *patch) (patch->nfile.file->flags & GIT_DIFF_FLAG_BINARY) != 0) patch->delta->flags |= GIT_DIFF_FLAG_BINARY; + else if (patch->ofile.file->size > GIT_XDIFF_MAX_SIZE || + patch->nfile.file->size > GIT_XDIFF_MAX_SIZE) + patch->delta->flags |= GIT_DIFF_FLAG_BINARY; + else if ((patch->ofile.file->flags & DIFF_FLAGS_NOT_BINARY) != 0 && (patch->nfile.file->flags & DIFF_FLAGS_NOT_BINARY) != 0) patch->delta->flags |= GIT_DIFF_FLAG_NOT_BINARY; |
