Skip to content

Commit 5c6187d

Browse files
committed
Account for conflict format in command
1 parent ab5e88b commit 5c6187d

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

applier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ func base64Apply(data []byte, name string, f *gitdiff.File) (string, error) {
360360
return b.String(), nil
361361
}
362362

363-
// apply runs gitdiff.Apply, wrapping any conflicts in patch2pr's Conflict type.
363+
// apply runs gitdiff.Apply, wrapping any conflicts in patch2pr's Conflict type.
364364
func apply(dst io.Writer, src io.ReaderAt, name string, f *gitdiff.File) error {
365365
if err := gitdiff.Apply(dst, src, f); err != nil {
366366
var applyErr *gitdiff.ApplyError

cmd/patch2pr/main.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,15 @@ func execute(ctx context.Context, client *github.Client, patchFiles []string, op
249249
for _, patch := range allPatches {
250250
for _, file := range patch.files {
251251
if _, err := applier.Apply(ctx, file); err != nil {
252-
name := file.NewName
253-
if name == "" {
254-
name = file.OldName
252+
var namePart string
253+
if !errors.Is(err, &patch2pr.Conflict{}) {
254+
name := file.NewName
255+
if name == "" {
256+
name = file.OldName
257+
}
258+
namePart = name + ": "
255259
}
256-
return nil, fmt.Errorf("apply failed: %s: %w", name, err)
260+
return nil, fmt.Errorf("apply failed: %s%w", namePart, err)
257261
}
258262
}
259263

0 commit comments

Comments
 (0)