Download raw body.
got patch: add flag to ignore whitespace?
Stefan Sperling <stsp@stsp.name> wrote:
> On Sat, Jul 02, 2022 at 10:22:30PM +0200, Omar Polo wrote:
> > Stefan Sperling <stsp@stsp.name> wrote:
> > > @@ -295,7 +305,7 @@ hunk contains mangled whitespace
> >
> > I like the idea! Diff belows keeps the behavior, drops -w and adds this
> > visual aid. I've added it with a lower precedence, so if a hunk is
> > applied at a different offset _and_ with mangled whitespaces only the
> > "applied at offset" info will be printed.
> >
> > We avoid adding a flag, love it :)
>
> Sure. Less options is better.
>
> > Rather than a flag specific for whitespaces, a "strict mode" that
> > considers an error a non-perfect application of the diff seems more
> > useful.
>
> Makes sense. ok stsp, with two nits below:
>
> > diff refs/heads/main refs/heads/pw
> > commit - f5b0315f0e07bfd36a4eb37d91884fcd8614745a
> > commit + 393c10527c09d54aa19c1f121b2cc74c31ac4746
> > blob - d2db3f11b55b0dcd7008e9f4662210887aa2742b
> > blob + a79c8a428a21ddd30f49aa132dd4457a73135fa1
> > --- got/got.1
> > +++ got/got.1
> > @@ -1347,6 +1347,9 @@ If a change does not match at its exact line number, a
> > apply it somewhere else in the file if a good spot can be found.
> > Otherwise, the patch will fail to apply.
> > .Pp
> > +Whitespaces may be ignored when trying to match the context of a
> > +change, as they may have been mangled.
> > +.Pp
>
> Are you sure this is worth documenting? Diffs with some whitespace
> issues should now "just work", and we already print a hint about it
> during regular operation. People will expect that 'got patch' will do
> its best to make sense of the provided input. They won't look into the
> man page to check details about whitespace before trying to apply a patch.
agreed, i felt into the trap of over-documenting.
> Once we add a 'strict' mode, that would be a good place to document
> this. We will need to explain how behaviour changes in strict mode, and
> should then of course mention differences in treatment of whitespace.
>
> > + else
> > + printf("hunk contains mangled whitespaces\n");
>
> The above should say just "whitespace" (singular), not "whitespaces".
Sorry, you wrote it in the sigular form in the previous email but that
's' slipped. Committed in the singular form.
> > + echo 'M hello.c' > $testroot/stdout.expected
> > + echo '@@ -5,5 +5,5 @@ hunk contains mangled whitespaces' \
>
> And of course the test would need the same change here.
Thanks!
got patch: add flag to ignore whitespace?