Skip to content

Commit cb0d5c3

Browse files
Refactor: Extract say to its own file (remotemobprogramming#312)
1 parent b046bf8 commit cb0d5c3

File tree

5 files changed

+312
-297
lines changed

5 files changed

+312
-297
lines changed

coauthors.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package main
33
import (
44
"bufio"
55
"fmt"
6+
"github.com/remotemobprogramming/mob/v3/say"
67
"os"
78
"path"
89
"regexp"
@@ -24,20 +25,20 @@ func collectCoauthorsFromWipCommits(file *os.File) []Author {
2425
// For details and background, see https://github.com/remotemobprogramming/mob/issues/81
2526

2627
coauthors := parseCoauthors(file)
27-
debugInfo("Parsed coauthors")
28-
debugInfo(strings.Join(coauthors, ","))
28+
say.Debug("Parsed coauthors")
29+
say.Debug(strings.Join(coauthors, ","))
2930

3031
coauthors = removeElementsContaining(coauthors, gitUserEmail())
31-
debugInfo("Parsed coauthors without committer")
32-
debugInfo(strings.Join(coauthors, ","))
32+
say.Debug("Parsed coauthors without committer")
33+
say.Debug(strings.Join(coauthors, ","))
3334

3435
coauthors = removeDuplicateValues(coauthors)
35-
debugInfo("Unique coauthors without committer")
36-
debugInfo(strings.Join(coauthors, ","))
36+
say.Debug("Unique coauthors without committer")
37+
say.Debug(strings.Join(coauthors, ","))
3738

3839
sortByLength(coauthors)
39-
debugInfo("Sorted unique coauthors without committer")
40-
debugInfo(strings.Join(coauthors, ","))
40+
say.Debug("Sorted unique coauthors without committer")
41+
say.Debug(strings.Join(coauthors, ","))
4142

4243
return coauthors
4344
}
@@ -94,11 +95,11 @@ func removeDuplicateValues(slice []string) []string {
9495

9596
func appendCoauthorsToSquashMsg(gitDir string) error {
9697
squashMsgPath := path.Join(gitDir, "SQUASH_MSG")
97-
debugInfo("opening " + squashMsgPath)
98+
say.Debug("opening " + squashMsgPath)
9899
file, err := os.OpenFile(squashMsgPath, os.O_APPEND|os.O_RDWR, 0644)
99100
if err != nil {
100101
if os.IsNotExist(err) {
101-
debugInfo(squashMsgPath + " does not exist")
102+
say.Debug(squashMsgPath + " does not exist")
102103
// No wip commits, nothing to squash, this isn't really an error
103104
return nil
104105
}

0 commit comments

Comments
 (0)