freebsd-dev/usr.bin/patch
Kyle Evans 7e688ed493 patch: omit filename if the prompt was ignored
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)..

Reviewed by:	des
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D38179
2023-02-13 00:15:08 -06:00
..
tests patch(1): give /dev/null patches special treatment 2019-11-04 03:07:01 +00:00
backupfile.c usr.bin/patch: remove unneeded header. 2021-05-02 09:27:32 -07:00
backupfile.h
common.h
inp.c patch: cleanup variable initialization a bit. 2021-07-22 14:23:22 -05:00
inp.h
Makefile
Makefile.depend
mkpath.c
patch.1 patch(1): Fix a few mandoc related issues 2020-12-19 13:00:17 +00:00
patch.c patch: omit filename if the prompt was ignored 2023-02-13 00:15:08 -06:00
pathnames.h
pch.c patch: cleanup variable initialization a bit. 2021-07-22 14:23:22 -05:00
pch.h patch(1): give /dev/null patches special treatment 2019-11-04 03:07:01 +00:00
util.c patch(1): give /dev/null patches special treatment 2019-11-04 03:07:01 +00:00
util.h