Skip to content

Commit 5e51671

Browse files
authored
Fix file name in CLI error messages (#14)
1 parent b646665 commit 5e51671

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cmd/patch2pr/main.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,11 @@ func execute(ctx context.Context, client *github.Client, patchFile string, opts
183183
applier := patch2pr.NewApplier(client, repo, commit)
184184
for _, file := range files {
185185
if _, err := applier.Apply(ctx, file); err != nil {
186-
// TODO(bkeyes): NewName is probably /dev/null for deletes...
187-
return nil, fmt.Errorf("apply failed: %s: %w", file.NewName, err)
186+
name := file.NewName
187+
if name == "" {
188+
name = file.OldName
189+
}
190+
return nil, fmt.Errorf("apply failed: %s: %w", name, err)
188191
}
189192
}
190193

0 commit comments

Comments
 (0)