# Squashed 3 commits

- main3
- test2
- test1
This commit is contained in:
2023-12-05 19:39:21 +00:00
parent 7c332f66ba
commit bd03ce5c4c
3 changed files with 27 additions and 11 deletions

View File

@@ -1,10 +1,16 @@
package git
import "os/exec"
import (
"log"
"os/exec"
"strings"
)
// Execute runs a git command and returns the stdout
func (g *Git) Execute(args ...string) (string, error) {
log.Println("git", strings.Join(args, " "))
cmd := exec.Command("git", args...)
if g.WorkingDir != "" {
cmd.Dir = g.WorkingDir
@@ -15,5 +21,6 @@ func (g *Git) Execute(args ...string) (string, error) {
if err != nil {
return "", err
}
return string(out), nil
return strings.TrimSuffix(string(out), "\n"), nil
}