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

Re: [PATCH] diff: run arguments through precompose_argv

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 6, 2016, 17:27 UTC
Message-ID
<xmqq60vuy7ek.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<5704BF14.9060100@web.de>
Torsten Bögershausen <tboegi@web.de> writes:
> May be something like this, (but this is highly a personal taste question)

My observation was not a suggestion to rewrite the log message, but primarily about describing the change in behaviour.

I didn't mean to nitpick the phrasing but let me think aloud about it, using this as a template. I rewrapped overlong lines from the original.

Show 5 quoted lines
> When running diff commands, file paths containing decomposed
> unicode code points are not converted to precomposed unicode form
> under Mac OS X.
>
> As a result, no diff is displayed.

Add ", but we normalize the paths in the index and the history to precomposed form on that platform." at the end of the first sentence, to make sure you mention both causes of "As a result" that follows. Also, these are better to be a single paragraph. I.e.

    When running diff commands, a pathspec containing decomposed
    unicode code points is not converted to precomposed unicode form
    under Mac OS X, but we normalize the paths in the index and the
    history to precomposed form on that platform.  As a result, the
    pathspec would not match and no diff is shown.
Show 7 quoted lines
> Opposite to most builtin commands, the diff builtin is missing the
> parse_options call, which internally runs arguments through the
> precompose_argv call, which ensures all arguments are in precomposed
> unicode form.
>
> Fix the problem by adding a precompose_argv call to diff,
> diff-index, diff-files and diff-tree.

Perhaps it is just me but I found "Opposite to most" harder to grok for some reason.

And the "backward compatibility note" is missing. I'd write these two paragraphs like this if I were doing this patch.

    Unlike many builtin commands, the "diff" family of commands do
    not use parse_options(), which is how other builtin commands
    indirectly call precompose_argv() to normalize argv[] into
    precomposed form on Mac OSX.  Teach these commands to call
    precompose_argv() themselves.
    Note that precomopose_argv() normalizes not just paths but all
    command line arguments, so things like "git diff -G $string"
    when $string has the decomposed form would first normalized into
    the precomposed form and would stop hitting the same string in
    the decomposed form in the diff output with this change.  It is
    not a problem per-se, as "log" family of commands already use
    parse_options() and call precompose_argv()--we can think of it
    as making the "diff" family of commands behave in a similar way
    as the commands in the "log" family.
Previous: Torsten BögershausenNext: Junio C Hamano
Message 9 of 12 in “diff: run arguments through precompose_argv”
  1. diff: run arguments through precompose_argvAlexander Rinass, Apr 4, 2016
  2. diff: run arguments through precompose_argvAlexander Rinass, Apr 4, 2016
  3. Junio C HamanoApr 5, 2016
  4. Johannes SixtApr 5, 2016
  5. Torsten BögershausenApr 5, 2016
  6. Junio C HamanoApr 5, 2016
  7. Alexander RinassApr 6, 2016
  8. Torsten BögershausenApr 6, 2016
  9. Junio C HamanoApr 6, 2016
  10. Junio C HamanoMay 11, 2016
  11. Alexander RinassMay 12, 2016
  12. Junio C HamanoMay 12, 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.