diff --git a/src/Commands/Diff.cs b/src/Commands/Diff.cs index 6edeff540..4a2f30664 100644 --- a/src/Commands/Diff.cs +++ b/src/Commands/Diff.cs @@ -204,6 +204,12 @@ private bool ParseChunkBodyLine(string line, ArraySegment lineBytes) { var prefix = line[0]; var content = line.Substring(1); + + // Strip the trailing '\r' carried over from CRLF/CR line endings; + // RawContent keeps the raw bytes for patch generation. + if (content.Length > 0 && content[^1] == '\r') + content = content[..^1]; + if (ParseLFSChange(prefix, content)) return true;