git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCHv1bis 1/2] git apply: option to ignore whitespace differences

From
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Date
Jul 2, 2009, 19:28 UTC
Message-ID
<cb7bb73a0907021228q7e9d2791vafead8e0c5b06b79@mail.gmail.com>
In-Reply-To
<cb7bb73a0907021202ra322425pc64b54953f4f544d@mail.gmail.com>

On Thu, Jul 2, 2009 at 9:02 PM, Giuseppe Bilotta<giuseppe.bilotta@gmail.com> wrote:

Show 21 quoted lines
> On Thu, Jul 2, 2009 at 8:27 PM, Junio C Hamano<gitster@pobox.com> wrote:
>>> +/*
>>> + * Returns true if the given lines (buffer + len) match
>>> + * according to the ignore_whitespace setting
>>> + */
>>> +static int lines_match(const char *s1, size_t n1, const char *s2, size_t n2)
>>> +{
>>> +     if (ignore_whitespace)
>>> +             return !memcmp_ignore_whitespace(s1, n1, s2, n2);
>>> +     else
>>> +             return (n1 == n2) && !memcmp(s1, s2, n1);
>>> +}
>>> +
>>
>> I think this still is an abstraction at the wrong level.  For one thing,
>> if ignore-whitespace is set, you do not even need nor want to do the "fix
>> only the ws breakages we are going to fix anyway according to the ws_rule"
>> transformation applied to the preimage.
>
> I've thought some more about this, and you are right. We still want to
> ws fix the postimage, but that's done elsewhere.

Sorry for repying to myself here, but I'm not convinced again. Or to be more specific: I think this kind of refactoring is totally out of the scope of this patch. So although I agree with you in priciple, if you don't mind I'll keep the first two patches simpler and less invasive. I'll look into the refactoring as a third step.

-- 
Giuseppe "Oblomov" Bilotta
Previous: Giuseppe BilottaNext: Junio C Hamano
Message 6 of 12 in “[PATCHv1bis 0/2] git apply: cope with whitespace differences”
  1. Giuseppe BilottaJul 2, 2009
  2. 1/2 git apply: option to ignore whitespace differencesGiuseppe Bilotta, Jul 2, 2009
  3. 2/2 git apply: preserve original whitespace with --ignore-whitespaceGiuseppe Bilotta, Jul 2, 2009
  4. Junio C HamanoJul 2, 2009
  5. Giuseppe BilottaJul 2, 2009
  6. Giuseppe BilottaJul 2, 2009
  7. Junio C HamanoJul 2, 2009
  8. Giuseppe BilottaJul 2, 2009
  9. Junio C HamanoJul 2, 2009
  10. Giuseppe BilottaJul 2, 2009
  11. Junio C HamanoJul 2, 2009
  12. Giuseppe BilottaJul 3, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.