Skip to content

Commit 54dce9a

Browse files
rolandshoemakergopherbot
authored andcommitted
internal/task: return useful errors in priv patch workflow
For golang/go#65756. Change-Id: Iefa4395f381e1306837cac048ea5e9b1c68d7610 Reviewed-on: https://go-review.googlesource.com/c/build/+/567035 Reviewed-by: Dmitri Shuralyov <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Auto-Submit: Roland Shoemaker <[email protected]>
1 parent 0b09433 commit 54dce9a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

internal/task/privx.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ func (x *PrivXPatch) NewDefinition(tagx *TagXReposTasks) *wf.Definition {
9999
// Beyond this point we don't want to retry any of the following steps.
100100
ctx.DisableRetries()
101101

102-
ctx.Printf("pusing to %s", x.PublicRepoURL(repoName))
102+
ctx.Printf("pushing to %s", x.PublicRepoURL(repoName))
103103
// We are unable to use repo.RunCommand here, because of strange i/o
104104
// changes that git made. The messages sent by the remote are printed by
105105
// git to stderr, and no matter what combination of options you pass it
@@ -110,13 +110,13 @@ func (x *PrivXPatch) NewDefinition(tagx *TagXReposTasks) *wf.Definition {
110110
var stdout, stderr bytes.Buffer
111111
err = repo.git.runGitStreamed(ctx.Context, &stdout, &stderr, repo.dir, "push", x.PublicRepoURL(repoName), refspec)
112112
if err != nil {
113-
return nil, err
113+
return nil, fmt.Errorf("git push failed: %v, stdout: %q stderr: %q", err, stdout.String(), stderr.String())
114114
}
115115

116116
// Extract the CL number from the output using a quick and dirty regex.
117117
re, err := regexp.Compile(fmt.Sprintf(`https:\/\/go-review.googlesource.com\/c\/%s\/\+\/(\d+)`, regexp.QuoteMeta(repoName)))
118118
if err != nil {
119-
return nil, err
119+
return nil, fmt.Errorf("failed to compile regex: %s", err)
120120
}
121121
matches := re.FindSubmatch(stderr.Bytes())
122122
if len(matches) != 2 {

0 commit comments

Comments
 (0)