diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2019-04-24 15:20:51 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2019-04-24 15:20:51 +0200 |
commit | 5c6d199dc675465f5e103ea36c0bfcb9d3ebc565 (patch) | |
tree | adeb9c554654b499c08abc6ce4611d6f2c25f8d3 /plumbing | |
parent | bbca4e0ccc8fee164e6da28edebbd76d69cdfd9b (diff) | |
download | go-git-5c6d199dc675465f5e103ea36c0bfcb9d3ebc565.tar.gz |
plumbing: commit.Stats, fix panic on empty chucks
Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
Diffstat (limited to 'plumbing')
-rw-r--r-- | plumbing/object/patch.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/plumbing/object/patch.go b/plumbing/object/patch.go index 068589e..1efd0b1 100644 --- a/plumbing/object/patch.go +++ b/plumbing/object/patch.go @@ -321,6 +321,10 @@ func getFileStatsFromFilePatches(filePatches []fdiff.FilePatch) FileStats { for _, chunk := range fp.Chunks() { s := chunk.Content() + if len(s) == 0 { + continue + } + switch chunk.Type() { case fdiff.Add: cs.Addition += strings.Count(s, "\n") |