@@ -9,28 +9,28 @@ import (
99)
1010
1111func commit (repoPath string ) error {
12- err , outb := GitCommand (repoPath , []string {"status" , "--porcelain" })
12+ outb , err := GitCommand (repoPath , []string {"status" , "--porcelain" })
1313
1414 if err == nil {
1515 if len (outb .Bytes ()) == 0 {
1616 return nil
1717 }
1818 }
1919
20- err , _ = GitCommand (repoPath , []string {"add" , "--all" })
20+ _ , err = GitCommand (repoPath , []string {"add" , "--all" })
2121 if err != nil {
2222 return tracerr .Wrap (err )
2323 }
2424
25- err , _ = GitCommand (repoPath , []string {"commit" , "-m" , outb .String ()})
25+ _ , err = GitCommand (repoPath , []string {"commit" , "-m" , outb .String ()})
2626 if err != nil {
2727 return tracerr .Wrap (err )
2828 }
2929
3030 return nil
3131}
3232
33- func GitCommand (repoPath string , args []string ) (error , bytes.Buffer ) {
33+ func GitCommand (repoPath string , args []string ) (bytes.Buffer , error ) {
3434 var outb , errb bytes.Buffer
3535
3636 statusCmd := exec .Command ("git" , args ... )
@@ -41,7 +41,8 @@ func GitCommand(repoPath string, args []string) (error, bytes.Buffer) {
4141
4242 if err != nil {
4343 fullCmd := "git " + strings .Join (args , " " )
44- return tracerr .Errorf ("%w: Command: %s\n StdOut: %s\n StdErr: %s" , err , fullCmd , outb .String (), errb .String ()), outb
44+ err := tracerr .Errorf ("%w: Command: %s\n StdOut: %s\n StdErr: %s" , err , fullCmd , outb .String (), errb .String ())
45+ return outb , err
4546 }
46- return nil , outb
47+ return outb , nil
4748}
0 commit comments