diff options
author | Alexandr Krylovskiy <alexandr.krylovskiy@gmail.com> | 2017-12-04 21:47:31 +0100 |
---|---|---|
committer | Alexandr Krylovskiy <alexandr.krylovskiy@gmail.com> | 2017-12-04 21:47:31 +0100 |
commit | 16544846f85e23a2b817daf8c9fdfceeb835f4a2 (patch) | |
tree | 22495839dcdba5f59cac19597e4e3ff46fec8e78 /plumbing/object/patch.go | |
parent | 02723bf0e5b97fc7855467b2fad700a4f318ab3e (diff) | |
download | go-git-16544846f85e23a2b817daf8c9fdfceeb835f4a2.tar.gz |
Ignore empty patches when calculating stats (fixes #654)
Diffstat (limited to 'plumbing/object/patch.go')
-rw-r--r-- | plumbing/object/patch.go | 5 |
1 files changed, 5 insertions, 0 deletions
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 { |