Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/Commands/Diff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ public partial class Diff : Command
private const string SPECIAL_NO_NEWLINE = " No newline at end of file";
private const string SPECIAL_SUBMODULE = "Subproject commit ";

private const int MAX_INLINE_CONTENT_LENGTH = 1024;
private const int MAX_INLINE_CHUNKS_PER_LINE = 16;

public Diff(string repo, Models.DiffOption opt, int numContextLines, bool ignoreWhitespace, bool ignoreCRAtEOL)
{
_result.TextDiff = new Models.TextDiff();
Expand Down Expand Up @@ -330,11 +333,11 @@ private void ProcessInlineHighlights()
var left = _deleted[i];
var right = _added[i];

if (left.Content.Length > 1024 || right.Content.Length > 1024)
if (left.Content.Length > MAX_INLINE_CONTENT_LENGTH || right.Content.Length > MAX_INLINE_CONTENT_LENGTH)
continue;

var chunks = Models.TextInlineChange.Compare(left.Content, right.Content);
if (chunks.Count > 4)
if (chunks.Count > MAX_INLINE_CHUNKS_PER_LINE)
continue;

foreach (var chunk in chunks)
Expand Down