Skip to content
This repository has been archived by the owner on May 27, 2022. It is now read-only.

Commit

Permalink
avoid git -C
Browse files Browse the repository at this point in the history
  • Loading branch information
djsutherland committed Sep 6, 2019
1 parent 6615513 commit 8e017b8
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions project/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,14 @@ func (g gitProject) Download() error {
func (g gitProject) Update() error {
fmt.Println("updating:", g.URL)
// #nosec
if bts, err := exec.Command(
"git", "-C", g.folder, "pull",
cmd := exec.Command(
"git", "pull",
"--recurse-submodules",
"origin",
g.Version,
).CombinedOutput(); err != nil {
)
cmd.Dir = g.folder
if bts, err := cmd.CombinedOutput(); err != nil {
log.Println("git update failed for", g.folder, string(bts))
return err
}
Expand All @@ -122,9 +124,9 @@ func (g gitProject) Update() error {

func branch(folder string) (string, error) {
// #nosec
branch, err := exec.Command(
"git", "-C", folder, "rev-parse", "--abbrev-ref", "HEAD",
).Output()
cmd := exec.Command("git", "rev-parse", "--abbrev-ref", "HEAD")
cmd.Dir = folder
branch, err := cmd.Output()
return strings.Replace(string(branch), "\n", "", -1), err
}

Expand Down

0 comments on commit 8e017b8

Please sign in to comment.