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)
Dec 20 2023, 6:21 AM
Unknown Object (File)
Jul 7 2023, 11:52 PM
Unknown Object (File)
May 11 2023, 3:38 PM
Unknown Object (File)
May 11 2023, 3:37 PM
Unknown Object (File)
Apr 6 2023, 1:51 PM
Unknown Object (File)
Mar 21 2023, 10:16 AM
Unknown Object (File)
Mar 8 2023, 8:33 PM
Unknown Object (File)
Feb 13 2023, 7:14 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