test: add return value of string for testing

This commit is contained in:
Slug-Boi
2025-05-30 09:46:14 +02:00
committed by Theis
parent dee0ee79f1
commit d010e73e00
2 changed files with 6 additions and 5 deletions
+5 -5
View File
@@ -129,7 +129,7 @@ func group_selection(group []User, excludeMode []string) []string {
return excludeMode return excludeMode
} }
func GitCommitAppender(authors string, hash string, flags []string, t,p bool) error { func GitCommitAppender(authors string, hash string, flags []string, t,p bool) (error, string) {
// Get old commit message // Get old commit message
var cmd *exec.Cmd var cmd *exec.Cmd
@@ -144,7 +144,7 @@ func GitCommitAppender(authors string, hash string, flags []string, t,p bool) er
out, err := cmd.Output() out, err := cmd.Output()
if err != nil { if err != nil {
return fmt.Errorf("error: %s", err) return fmt.Errorf("error: %s", err), ""
} }
// Convert the output to a string // Convert the output to a string
@@ -160,7 +160,7 @@ func GitCommitAppender(authors string, hash string, flags []string, t,p bool) er
if p { if p {
println(old_commit + "\n" + authors) println(old_commit + "\n" + authors)
if t { if t {
return nil return nil, old_commit + "\n" + authors
} }
} }
// append the message to the flags // append the message to the flags
@@ -172,9 +172,9 @@ func GitCommitAppender(authors string, hash string, flags []string, t,p bool) er
cmd_output, err := cmd.CombinedOutput() cmd_output, err := cmd.CombinedOutput()
if err != nil { if err != nil {
return fmt.Errorf("error: %s : %s", err, string(cmd_output)) return fmt.Errorf("error: %s : %s", err, string(cmd_output)), ""
} else { } else {
println(string(cmd_output)) println(string(cmd_output))
} }
return nil return nil, old_commit + "\n" + authors
} }
+1
View File
@@ -0,0 +1 @@
Test content