From 16544846f85e23a2b817daf8c9fdfceeb835f4a2 Mon Sep 17 00:00:00 2001 From: Alexandr Krylovskiy Date: Mon, 4 Dec 2017 21:47:31 +0100 Subject: Ignore empty patches when calculating stats (fixes #654) --- plumbing/object/patch.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'plumbing') diff --git a/plumbing/object/patch.go b/plumbing/object/patch.go index a920631..aa96a96 100644 --- a/plumbing/object/patch.go +++ b/plumbing/object/patch.go @@ -271,6 +271,11 @@ func getFileStatsFromFilePatches(filePatches []fdiff.FilePatch) FileStats { var fileStats FileStats for _, fp := range filePatches { + // ignore empty patches (binary files, submodule refs updates) + if len(fp.Chunks()) == 0 { + continue + } + cs := FileStat{} from, to := fp.Files() if from == nil { -- cgit