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

Re: [PATCHv3] diff.c: emit moved lines with a different color

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 7, 2016, 17:54 UTC
Message-ID
<xmqq7fanoas6.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAGZ79ka7VV6Pqw-rcVFv0xU4J4D9dHWPg-oocPPWJdY5JVhT+A@mail.gmail.com>
Stefan Beller <sbeller@google.com> writes:
> as we do not want to see dashes ('moved-old'), I think I'l go with
> "movedfrom" and "movedto".

OK. They would be color.diff.movedFrom and color.diff.movedTo in the doc, and "movedfrom" and "movedto" in the code (as the caller already downcased them for you to strcmp()).

Show 7 quoted lines
> When going through the second pass and actually emitting colored lines
> we only find matches in the hash map if the current line AND the previous line
> match as we lookup by hash code, i.e. if we have a moved line, but the
> previous line
> changed we do not find it in the hashmap and we don't color it, such
> that the reviewer
> can spot a permutation.

Hmph. Does this have impact on a line that was at the beginning or the end of a file that got moved to the beginning or the end of a file (four permutations, of 9 if you throw in "middle"), because some cases it does not have a "previous" line?

Previous: Jacob KellerNext: Stefan Beller
Message 5 of 7 in “[PATCHv3] diff.c: emit moved lines with a different color”
  1. Stefan BellerSep 4, 2016
  2. Jacob KellerSep 6, 2016
  3. Stefan BellerSep 6, 2016
  4. Jacob KellerSep 6, 2016
  5. Junio C HamanoSep 7, 2016
  6. Stefan BellerSep 7, 2016
  7. Jacob KellerSep 7, 2016

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.