"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: got patch: add flag to ignore whitespace?
To:
Christian Weisgerber <naddy@mips.inka.de>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 3 Jul 2022 21:35:17 +1000

Download raw body.

Thread
  • Mark Jamsek:

    got patch: add flag to ignore whitespace?

  • On 22-07-03 12:24am, Christian Weisgerber wrote:
    > Omar Polo:
    > 
    > > The last patch from Mark reminded me that I thought some time ago to add
    > > a "-w" flag for got patch to ignore white spaces.  It's conceptually
    > > similar to patch(1) -l/--ignore-whitespace or git-apply(1)
    > > --ignore-whitespace.
    
    Firstly, I think this option is great. Thanks, op :)
    
    > > The diff does exactly what one would expect.
    > 
    > Well, I'm dense.  What does "ignore whitespace" mean exactly?
    > Note that diff(1) has two ways to do this, -b and -w.
    
    I had the same ambiguity when reading the docs for this too.
    Also, regarding "Ignore whitespaces in context lines."; how is "context
    lines" defined?
    
    For instance, -w made my diff apply cleanly, but the whitespace was on
    a changed line.
    
    > If I understand linecmp() correctly, it's like diff -w?
    > 
    > Meanwhile patch -l seems to be more like diff -b?
    
    I like Fossil's semantics for this:
    
      -w|--ignore-all-space       Ignore white space when comparing lines
      -Z|--ignore-trailing-space  Ignore changes to end-of-line whitespace
    
    but I think -w and -W might be better flags than -w and -Z.
    
    I'm not sure how I feel about this being the default though. I admit,
    it's nice not having failed patches, but as far as I'm aware, no other
    patch implementations do it by default so it might fail the Rule of
    Least Surprise. And--ironically coming from the person who sent out the
    mangled diff that instigated this--it shouldn't happen often. I can't
    even remember the last time I did it. Plus, with the:
    
    "@@ -295,7 +305,7 @@ hunk contains mangled whitespace"
    
    output, users can then rerun with -w.
    
    That said, I really am ambivalent and can't decide which way I fall on
    this.
    
    -- 
    Mark Jamsek <fnc.bsdbox.org>
    GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68
    
  • Mark Jamsek:

    got patch: add flag to ignore whitespace?