Skip to content

Commit

Permalink
Eliminate infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Meinhardt committed Mar 30, 2019
1 parent 3358788 commit 2f7cf18
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions git/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,11 @@ func (s service) Command(cmd string) (*exec.Cmd, error) {

func (s service) GitRepoPath() (string, error) {
if s.pathToRepo == "" {
cmd, err := s.Command("git rev-parse --show-toplevel")
if err != nil {
return "", err
}
cmd := exec.Command("git rev-parse --show-toplevel")
var stdout, stderr bytes.Buffer
cmd.Stderr = &stderr
cmd.Stdout = &stdout
err = cmd.Run()
err := cmd.Run()
return strings.TrimSuffix(stdout.String(), "\n"), errors.Wrap(err, fmt.Sprintf("pkg(git) GitRepoPath(): %s", stderr.String()))
} else {
return s.pathToRepo, nil
Expand Down

0 comments on commit 2f7cf18

Please sign in to comment.