Skip to content
This repository has been archived by the owner on Mar 16, 2024. It is now read-only.

Commit

Permalink
route stderr and stdout of the git functions to the terminal
Browse files Browse the repository at this point in the history
Signed-off-by: Oscar Ward <[email protected]>
  • Loading branch information
Oscar Ward committed Oct 13, 2023
1 parent 253eb2d commit b07ca68
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/vcs/vcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ func ImageInfoFromApp(ctx context.Context, app *apiv1.App, cloneDir string) (str
func gitClone(ctx context.Context, workdir, remote string) (err error) {
args := []string{"clone", remote, workdir}
cmd := exec.CommandContext(ctx, "git", args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmdErr := cmd.Run()
if cmdErr != nil {
err = fmt.Errorf("failed to clone repository %q: %v", remote, err)
Expand All @@ -175,6 +177,8 @@ func gitClone(ctx context.Context, workdir, remote string) (err error) {
func gitRemoteAdd(ctx context.Context, workdir, remoteName, remote string) (err error) {
args := []string{"-C", workdir, "remote", "add", remoteName, remote}
cmd := exec.CommandContext(ctx, "git", args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmdErr := cmd.Run()
if cmdErr != nil {
err = fmt.Errorf("failed to add remote %q to repository %q: %v", remote, workdir, err)
Expand All @@ -185,6 +189,8 @@ func gitRemoteAdd(ctx context.Context, workdir, remoteName, remote string) (err
func gitFetch(ctx context.Context, workdir, remote string) (err error) {
args := []string{"-C", workdir, "fetch", remote}
cmd := exec.CommandContext(ctx, "git", args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmdErr := cmd.Run()
if cmdErr != nil {
err = fmt.Errorf("failed to fetch remote %q in repository %q: %v", remote, workdir, err)
Expand All @@ -195,6 +201,8 @@ func gitFetch(ctx context.Context, workdir, remote string) (err error) {
func gitCheckout(ctx context.Context, workdir, revision string) (err error) {
args := []string{"-C", workdir, "checkout", revision}
cmd := exec.CommandContext(ctx, "git", args...)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
cmdErr := cmd.Run()
if cmdErr != nil {
err = fmt.Errorf("failed to checkout revision %q: %v", revision, err)
Expand Down

0 comments on commit b07ca68

Please sign in to comment.