瀏覽代碼

Fix empty people burndown

Vadim Markovtsev 6 年之前
父節點
當前提交
0b338b10ed
共有 3 個文件被更改,包括 13 次插入4 次删除
  1. 1 1
      Makefile
  2. 1 1
      internal/plumbing/identity/identity.go
  3. 11 2
      leaves/burndown.go

+ 1 - 1
Makefile

@@ -39,5 +39,5 @@ ${GOPATH}/pkg/$(PKG)/gopkg.in/bblfsh/client-go.v2: ${GOPATH}/src/gopkg.in/bblfsh
 	cd ${GOPATH}/src/gopkg.in/bblfsh/client-go.v2 && \
 	make dependencies
 
-${GOPATH}/bin/hercules${EXE}: *.go */*.go */*/*.go ${GOPATH}/pkg/$(PKG)/gopkg.in/bblfsh/client-go.v2 internal/pb/pb.pb.go internal/pb/pb_pb2.py cmd/hercules/plugin_template_source.go
+${GOPATH}/bin/hercules${EXE}: *.go */*.go */*/*.go */*/*/*.go ${GOPATH}/pkg/$(PKG)/gopkg.in/bblfsh/client-go.v2 internal/pb/pb.pb.go internal/pb/pb_pb2.py cmd/hercules/plugin_template_source.go
 	go get -tags "$(TAGS)" -ldflags "-X gopkg.in/src-d/hercules.v4.BinaryGitHash=$(shell git rev-parse HEAD)" gopkg.in/src-d/hercules.v4/cmd/hercules

+ 1 - 1
internal/plumbing/identity/identity.go

@@ -9,7 +9,7 @@ import (
 	"gopkg.in/src-d/go-git.v4"
 	"gopkg.in/src-d/go-git.v4/plumbing/object"
 	"gopkg.in/src-d/hercules.v4/internal/core"
-)
+	)
 
 // Detector determines the author of a commit. Same person can commit under different
 // signatures, and we apply some heuristics to merge those together.

+ 11 - 2
leaves/burndown.go

@@ -319,13 +319,22 @@ func (analyser *BurndownAnalysis) Merge(branches []core.PipelineItem) {
 
 // Finalize returns the result of the analysis. Further Consume() calls are not expected.
 func (analyser *BurndownAnalysis) Finalize() interface{} {
+	globalHistory := analyser.groupSparseHistory(analyser.globalHistory)
 	fileHistories := map[string]DenseHistory{}
 	for key, history := range analyser.fileHistories {
 		fileHistories[key] = analyser.groupSparseHistory(history)
 	}
 	peopleHistories := make([]DenseHistory, analyser.PeopleNumber)
 	for i, history := range analyser.peopleHistories {
-		peopleHistories[i] = analyser.groupSparseHistory(history)
+		if len(history) > 0 {
+			// there can be people with only trivial merge commits and without own lines
+			peopleHistories[i] = analyser.groupSparseHistory(history)
+		} else {
+			peopleHistories[i] = make(DenseHistory, len(globalHistory))
+			for j, gh := range globalHistory {
+				peopleHistories[i][j] = make([]int64, len(gh))
+			}
+		}
 	}
 	peopleMatrix := make(DenseHistory, analyser.PeopleNumber)
 	for i, row := range analyser.matrix {
@@ -341,7 +350,7 @@ func (analyser *BurndownAnalysis) Finalize() interface{} {
 		}
 	}
 	return BurndownResult{
-		GlobalHistory:      analyser.groupSparseHistory(analyser.globalHistory),
+		GlobalHistory:      globalHistory,
 		FileHistories:      fileHistories,
 		PeopleHistories:    peopleHistories,
 		PeopleMatrix:       peopleMatrix,