MCPcopy Create free account
hub / github.com/remotemobprogramming/mob / sayLastCommitsList

Function sayLastCommitsList

mob.go:1030–1045  ·  view source on GitHub ↗
(currentBaseBranch Branch, currentWipBranch Branch, configuration config.Configuration)

Source from the content-addressed store, hash-verified

1028}
1029
1030func sayLastCommitsList(currentBaseBranch Branch, currentWipBranch Branch, configuration config.Configuration) {
1031 commitsBaseWipBranch := currentBaseBranch.String() + ".." + currentWipBranch.String()
1032 log, err := silentgitignorefailure("--no-pager", "log", commitsBaseWipBranch, "--pretty=format:%h %cr <%an>", "--abbrev-commit")
1033 if err != nil {
1034 commitsBaseWipBranch = currentBaseBranch.remote(configuration).String() + ".." + currentWipBranch.String()
1035 log = silentgit("--no-pager", "log", commitsBaseWipBranch, "--pretty=format:%h %cr <%an>", "--abbrev-commit")
1036 }
1037 lines := strings.Split(log, "\n")
1038 if len(lines) > 5 {
1039 say.Info("wip branch '" + currentWipBranch.String() + "' contains " + strconv.Itoa(len(lines)) + " commits. The last 5 were:")
1040 lines = lines[:5]
1041 }
1042 ReverseSlice(lines)
1043 output := strings.Join(lines, "\n")
1044 say.Say(output)
1045}
1046
1047func ReverseSlice(s interface{}) {
1048 size := reflect.ValueOf(s).Len()

Callers 2

statusFunction · 0.85
startFunction · 0.85

Calls 7

InfoFunction · 0.92
SayFunction · 0.92
silentgitignorefailureFunction · 0.85
silentgitFunction · 0.85
ReverseSliceFunction · 0.85
StringMethod · 0.80
remoteMethod · 0.80

Tested by

no test coverage detected