Skip to content

Commit 04470ec

Browse files
committed
Fix reporting on first commit
1 parent 69fa195 commit 04470ec

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

find_next.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ func findNextTypist(lastCommitters []string, gitUserName string) (nextTypist str
2525
if nextTypist == "" {
2626
// Current committer is new to the session.
2727
numberOfPreviousCommitters := len(previousCommitters)
28-
if numberOfPreviousCommitters == 1 {
28+
if numberOfPreviousCommitters == 2 {
2929
nextTypist = previousCommitters[0]
30-
} else if numberOfPreviousCommitters > 1 {
30+
} else if numberOfPreviousCommitters > 2 {
3131
// Pick the next typist from the list of previous committers only.
3232
reversedPreviousCommitters := reverse(previousCommitters[:len(previousCommitters)-1])
3333
nextTypist, _ = findNextTypist(reversedPreviousCommitters, reversedPreviousCommitters[0])

find_next_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ func TestFindNextTypistNoCommits(t *testing.T) {
1313
equals(t, history, []string(nil))
1414
}
1515

16+
func TestFindNextTypistOnFirstCommit(t *testing.T) {
17+
lastCommitters := []string{"alice"}
18+
19+
nextTypist, history := findNextTypist(lastCommitters, "alice")
20+
21+
equals(t, nextTypist, "")
22+
equals(t, history, []string(nil))
23+
}
24+
1625
func TestFindNextTypistStartingWithFirstCommitterTwice(t *testing.T) {
1726
lastCommitters := []string{"alice", "alice"}
1827

0 commit comments

Comments
 (0)