MCPcopy Index your code
hub / github.com/conventionalcommit/commitlint / getCommitMsg

Function getCommitMsg

internal/cmd/lint.go:98–119  ·  view source on GitHub ↗
(fileInput string)

Source from the content-addressed store, hash-verified

96}
97
98func getCommitMsg(fileInput string) (string, error) {
99 commitMsg, err := readStdInPipe()
100 if err != nil {
101 return "", err
102 }
103
104 if commitMsg != "" {
105 return commitMsg, nil
106 }
107
108 // TODO: check if currentDir is inside git repo?
109 if fileInput == "" {
110 fileInput = "./.git/COMMIT_EDITMSG"
111 }
112
113 fileInput = filepath.Clean(fileInput)
114 inBytes, err := os.ReadFile(fileInput)
115 if err != nil {
116 return "", err
117 }
118 return string(inBytes), nil
119}
120
121func trimRightSpace(s string) string {
122 return strings.TrimRightFunc(s, unicode.IsSpace)

Callers 1

runLintFunction · 0.85

Calls 1

readStdInPipeFunction · 0.85

Tested by

no test coverage detected