Page MenuHomeFreeBSD

patch: omit filename if the prompt was ignored
ClosedPublic

Authored by kevans on Jan 24 2023, 5:35 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 8, 1:51 PM
Unknown Object (File)
Sat, Oct 19, 9:38 PM
Unknown Object (File)
Oct 9 2024, 12:04 PM
Unknown Object (File)
Oct 9 2024, 7:33 AM
Unknown Object (File)
Sep 30 2024, 1:37 PM
Unknown Object (File)
Sep 19 2024, 12:51 AM
Unknown Object (File)
Sep 18 2024, 6:18 PM
Unknown Object (File)
Sep 18 2024, 6:33 AM
Subscribers

Details

Summary

When a file is missing, patch(1) will prompt for a filename to try and
patch it. If we're doing a dry-run, we'll output that the patch to the
source file was either ignored/failed. If you ignore the prompt in a
dry-run (i.e. just hit enter), we'll output:

X out of X hunks ignored while patching (null)

Let's improve the aesthetics a bit and just omit the last part if the
prompt was ignored:

X out of X hunks ignored

Unfortunately we can't really test this without expect(1) because both
force and batch mode will use the first best guess, which is wiped out
by the "File to patch:" prompt. We could record the initially derived
bestguess there and use *that*, but given that this is only possible in
an interactive session I think it's fine to just omit the filename
rather than adding a fair amount of complexity (which could also break
other scenarios I haven't considered yet)..

Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable