diff --git a/internal/git/git.go b/internal/git/git.go index a432bb1f..400b8b0a 100644 --- a/internal/git/git.go +++ b/internal/git/git.go @@ -237,15 +237,17 @@ func (g *Git) FindAndCheckoutBranch(branchName string) (string, error) { } func (g *Git) Reset(args ...string) error { - logging.Info("Running git reset %s", strings.Join(args, ", ")) // We execute this manually because go-git doesn't support all the options we need args = append([]string{"reset"}, args...) + + logging.Info("Running git %s", strings.Join(args, ", ")) + cmd := exec.Command("git", args...) cmd.Dir = filepath.Join(environment.GetWorkspace(), "repo", environment.GetWorkingDirectory()) cmd.Env = os.Environ() output, err := cmd.CombinedOutput() if err != nil { - return fmt.Errorf("error running `git reset %s`: %w %s", strings.Join(args, ", "), err, string(output)) + return fmt.Errorf("error running `git %s`: %w %s", strings.Join(args, ", "), err, string(output)) } return nil @@ -314,7 +316,7 @@ func (g *Git) GetCurrentBranch() (string, error) { return "", fmt.Errorf("error getting head: %w", err) } - return head.Name().String(), nil + return head.Name().Short(), nil } func (g *Git) DeleteBranch(branchName string) error {