Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 5c6d199

Browse files
committed
plumbing: commit.Stats, fix panic on empty chucks
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
1 parent bbca4e0 commit 5c6d199

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

plumbing/object/patch.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,10 @@ func getFileStatsFromFilePatches(filePatches []fdiff.FilePatch) FileStats {
321321

322322
for _, chunk := range fp.Chunks() {
323323
s := chunk.Content()
324+
if len(s) == 0 {
325+
continue
326+
}
327+
324328
switch chunk.Type() {
325329
case fdiff.Add:
326330
cs.Addition += strings.Count(s, "\n")

0 commit comments

Comments
 (0)