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

weird diff output?

From
Jacob Keller <jacob.keller@gmail.com>
Date
Mar 29, 2016, 00:26 UTC
Message-ID
<CA+P7+xoiFUiBwDU2Wo9nVukchBvJSknON2XN572b6rSHnOSWaQ@mail.gmail.com>
On Mon, Mar 28, 2016 at 4:28 PM, Stefan Beller <sbeller@google.com> wrote:
Show 24 quoted lines
>  cat > expect <<EOF
> +Entering '../nested1'
> +Entering '../nested1/nested2'
> +Entering '../nested1/nested2/nested3'
> +Entering '../nested1/nested2/nested3/submodule'
> +Entering '../sub1'
> +Entering '../sub2'
> +Entering '../sub3'
> +EOF
> +
> +test_expect_failure 'test messages from "foreach --recursive" from subdirectory' '
> +       (
> +               cd clone2 &&
> +               mkdir untracked &&
> +               cd untracked &&
> +               git submodule foreach --recursive >../../actual
> +       ) &&
> +       test_i18ncmp expect actual
> +'
> +
> +cat > expect <<EOF
>  nested1-nested1
>  nested2-nested2
>  nested3-nested3
Complete tangent here. The diff above looks like

<old-line> + + + + +<old-line>

is it possible to get diff output that would look more like

+<old-line> + + + + + <old-line>

instead? This is one of those huge readability issues with diff formatting that seems like both are completely correct, but the second way is much easier in general to read what was added.

I don't understand why diff algorithms result in the former instead of the latter, and am curious if anyone knows whether this has ever been thought about or solved by someone.

I've tried using various diffing algorithms (histogram, etc) and they always produce the same result above, and never what I would prefer.

Regards, Jake

Next: Stefan Beller
Message 1 of 27 in “weird diff output?”
  1. Jacob KellerMar 29, 2016
  2. Stefan BellerMar 29, 2016
  3. Junio C HamanoMar 29, 2016
  4. Stefan BellerMar 29, 2016
  5. Jacob KellerMar 29, 2016
  6. Junio C HamanoMar 30, 2016
  7. Jeff KingMar 30, 2016
  8. Stefan BellerMar 30, 2016
  9. Jacob KellerMar 30, 2016
  10. Jacob KellerMar 30, 2016
  11. Jacob KellerMar 30, 2016
  12. Stefan BellerMar 30, 2016
  13. Junio C HamanoApr 1, 2016
  14. Jeff KingMar 31, 2016
  15. Jacob KellerApr 6, 2016
  16. Stefan BellerApr 12, 2016
  17. Davide LibenziApr 14, 2016
  18. Jeff KingApr 14, 2016
  19. Stefan BellerApr 14, 2016
  20. Implement better chunk heuristics.Stefan Beller, Apr 15, 2016
  21. Jacob KellerApr 15, 2016
  22. Stefan BellerApr 15, 2016
  23. Jacob KellerApr 15, 2016
  24. Junio C HamanoApr 15, 2016
  25. Stefan BellerApr 15, 2016
  26. Jacob KellerApr 15, 2016
  27. Jeff KingApr 15, 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.