From: Stefan Sperling Subject: Re: add a dry run to got patch To: Omar Polo Cc: gameoftrees@openbsd.org Date: Sun, 13 Mar 2022 20:32:57 +0100 On Sun, Mar 13, 2022 at 07:34:11PM +0100, Omar Polo wrote: > Hello, > > the following diff adds a dry-run mode for got patch. In this mode the > patch is only faked and the changes are not really done to the work > tree. > > I chosen -n because it stands for "nop" which I like. For comparison, > Subversions seems to have --dry-run, git-apply(1) --check and patch(1) > has -C, --dry-run and --check. (I don't really like to type capital > letters ;-) > > It carries the same issues that patch(1) has: if the patchfile contains > multiple diffs that affect the same file, got patch -n could report a > failure even if 'got patch' would succeed. > > (eventually we could sort the patches and try to apply them to the same > temp file to handle also this case, but I'm not sure and this is a start > anyway) Good idea, I like it. Some man page input below. > @@ -1333,6 +1333,19 @@ Such cahnges can be viewed with > and can be reverted with > .Cm got revert > if needed. > +.Pp > +The options for > +.Cm got patch > +are as follows: > +.Bl -tag -width Ds > +.It Fl n > +Check that the patch would apply cleanly but don't do any edits to the > +worktree. How about: ".It Fl n Do not make any modifications to the work tree. This can be used to check whether a patch would apply without issues." > +Note that if > +.Ar patchfile > +contains diffs that affect the same file multiple times Note that, in manual pages, "Note that" is discouraged ;) https://marc.info/?l=openbsd-tech&m=163770139630230&w=2 "If the .Ar patchfile contains ... " is better. In general, man pages should never address the reader in first person. > the results won't > +likely be correct. "... the results displayed may be incorrect." ? > +.El