1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Return an empty Hunk in case there's no diff

This commit is contained in:
joshvera 2016-03-01 17:00:30 -05:00
parent 291c66696c
commit c9d8786347

View File

@ -94,7 +94,7 @@ hunks diff blobs = hunksInRows (Both (1, 1)) . Prelude.fst $ splitDiffByLines di
-- | patch.
hunksInRows :: Both (Sum Int) -> [Row (SplitDiff a Info)] -> [Hunk (SplitDiff a Info)]
hunksInRows start rows = case nextHunk start rows of
Nothing -> []
Nothing -> [Hunk { offset = Both (0, 0), changes = [], trailingContext = [] }]
Just (hunk, rest) -> hunk : hunksInRows (offset hunk <> hunkLength hunk) rest
-- | Given beginning line numbers, return the next hunk and the remaining rows