Skip to content

Commit 5d644d2

Browse files
committed
Silence stderr in git push during pr create but show it on failures
1 parent 5bfcab8 commit 5d644d2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

command/pr_create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func prCreate(cmd *cobra.Command, _ []string) error {
4040
}
4141

4242
if err = git.Push(remote, fmt.Sprintf("HEAD:%s", head)); err != nil {
43-
return fmt.Errorf("was not able to push to remote '%s': %s", remote, err)
43+
return err
4444
}
4545

4646
title, err := cmd.Flags().GetString("title")

git/git.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ func UncommittedChangeCount() (int, error) {
109109
}
110110

111111
func Push(remote string, ref string) error {
112-
cmd := GitCommand("push", "--set-upstream", remote, ref)
113-
return cmd.Run()
112+
pushCmd := GitCommand("push", "--set-upstream", remote, ref)
113+
return utils.PrepareCmd(pushCmd).Run()
114114
}
115115

116116
type BranchConfig struct {

0 commit comments

Comments
 (0)