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

Re: Getting an odd diff

From
JZJack Adrian Zappa <adrianh.bsc@gmail.com>
Date
May 2, 2022, 18:04 UTC
Message-ID
<CAKepmahchaMVvOoWhnHzeBzKoYEHvmMJgHJ6fNBJ6C8bKMDjrA@mail.gmail.com>
In-Reply-To
<1c11f705-596f-9e51-8017-2b59cac5f19d@kdbg.org>
On Sat, Apr 30, 2022 at 3:16 AM Johannes Sixt <j6t@kdbg.org> wrote:
Show 11 quoted lines
> I am a bit reluctant to diagnose what exactly is happening here because
> your word regex is outside the design space. It is definitely not a good
> idea to declare whitespace and even line breaks as part of a word. And
> in fact, when you remove the trailing (\\r\\n?|\\n\\r?)?, you get a more
> sensible word diff:
>
> var result =[-((-] resx.State == ResultState.Succeeded[-) &&-]
> [-string.IsNullOrEmpty(res.ErrorCode) )-] ? (byte)0 : (byte)1;
>
> But if I were you, I would remove all subexpressions that match any form
> of whitespace.

Interesting... IIRC, the reason for the leading and trailing line breaks in the regex is to stop the diff from messing up the alignment of multiple edited lines. I don't remember the exact sequence I was seeing, but removing them doesn't appear to mess up the alignment so badly anymore. Still, I'm surprised that removing that trailing line break capture would have caused the issue seen here. For now, I'll remove the captures and if I see what I was seeing before, I'll report back to the group.

Thanks,
Jaz
Previous: Johannes Sixt
Message 3 of 3 in “Getting an odd diff”
  1. Jack Adrian ZappaApr 29, 2022
  2. Johannes SixtApr 30, 2022
  3. Jack Adrian ZappaMay 2, 2022

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.