Skip to content

Commit

Permalink
Refactor: Extract say to its own file
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorriegler committed Sep 20, 2022
1 parent 53731a5 commit 6d2b68b
Show file tree
Hide file tree
Showing 5 changed files with 306 additions and 295 deletions.
20 changes: 10 additions & 10 deletions coauthors.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ func collectCoauthorsFromWipCommits(file *os.File) []Author {
// For details and background, see https://github.com/remotemobprogramming/mob/issues/81

coauthors := parseCoauthors(file)
debugInfo("Parsed coauthors")
debugInfo(strings.Join(coauthors, ","))
DebugInfo("Parsed coauthors")
DebugInfo(strings.Join(coauthors, ","))

coauthors = removeElementsContaining(coauthors, gitUserEmail())
debugInfo("Parsed coauthors without committer")
debugInfo(strings.Join(coauthors, ","))
DebugInfo("Parsed coauthors without committer")
DebugInfo(strings.Join(coauthors, ","))

coauthors = removeDuplicateValues(coauthors)
debugInfo("Unique coauthors without committer")
debugInfo(strings.Join(coauthors, ","))
DebugInfo("Unique coauthors without committer")
DebugInfo(strings.Join(coauthors, ","))

sortByLength(coauthors)
debugInfo("Sorted unique coauthors without committer")
debugInfo(strings.Join(coauthors, ","))
DebugInfo("Sorted unique coauthors without committer")
DebugInfo(strings.Join(coauthors, ","))

return coauthors
}
Expand Down Expand Up @@ -94,11 +94,11 @@ func removeDuplicateValues(slice []string) []string {

func appendCoauthorsToSquashMsg(gitDir string) error {
squashMsgPath := path.Join(gitDir, "SQUASH_MSG")
debugInfo("opening " + squashMsgPath)
DebugInfo("opening " + squashMsgPath)
file, err := os.OpenFile(squashMsgPath, os.O_APPEND|os.O_RDWR, 0644)
if err != nil {
if os.IsNotExist(err) {
debugInfo(squashMsgPath + " does not exist")
DebugInfo(squashMsgPath + " does not exist")
// No wip commits, nothing to squash, this isn't really an error
return nil
}
Expand Down
Loading

0 comments on commit 6d2b68b

Please sign in to comment.