git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Torsten Bögershausen" <tboegi@web.de>
To: Alexander Rinass <alex@fournova.com>, git@vger.kernel.org
Subject: Re: git diff does not precompose unicode file paths (OS X)
Date: Fri, 04 Mar 2016 13:16:12 +0100	[thread overview]
Message-ID: <56D97C8C.1060205@web.de> (raw)
In-Reply-To: <0008C25D-C3F0-4A1F-8B50-4EF1E84CA04F@fournova.com>

On 03/04/2016 10:07 AM, Alexander Rinass wrote:
> Hallo,
>
> It appears that the git diff command does not precompose file path arguments, even if the option core.precomposeunicode is set to true (which is the default on OS X).
>
> Passing the decomposed form of a file path to the git diff command will yield no diff for a modified file.
>
> In my case, the decomposed form of the file path is sent by the OS X Cocoa framework's NSTask, wich I am using in an application. It can be simulated on OS X by using $(iconv -f utf-8 -t utf-8-mac <<< FILE_PATH) as file path argument on the shell.
>
> Git commands like add, log, ls-tree, ls-files, mv, ... accept both file path forms, git diff does not.
>
> It can be tested with the following setup on OS X (as iconv's utf-8-mac encoding is only available on OS X):
>
>      git init .
>      git config core.quotepath true
>      git config core.precomposeunicode true # (default on OS X)
>      touch .gitignore && git add .gitignore && git commit -m "Initial commit"
>      
>      echo "." >> Ä
>      git add Ä
>      git commit -m "Create commit with unicode file path"
>      
>      echo "." >> Ä
>      
> This gives the following status, showing the precomposed form of "Ä":
>
>      git status --short
>       M "\303\204"
>      
> Running git add with both forms does work as expected:
>
>      git add Ä
>      git status --short
>      M  "\303\204"
>      
>      git reset HEAD -- Ä
>      
>      git add $(iconv -f utf-8 -t utf-8-mac <<< Ä)
>      git status --short
>      M  "\303\204"
>      
>      git reset HEAD -- Ä
>      
> However, running git diff only works with the precomposed form:
>
>      git status --short
>       M "\303\204"
>      
>      git --no-pager diff -- Ä
>      [...shows diff...]
>      
>      git --no-pager diff -- $(iconv -f utf-8 -t utf-8-mac <<< Ä)
>      [...shows NO diff...]
>
> I took a look at the Git source code, and the builtin/diff*.c do not contain the parse_options call (which does the precompose_argv call) that the other builtins use.
>
> But I am not really familiar with either C or the Git project structure, so this may not mean anything.
>
> Best regards,
> Alexander Rinass
>
Good analyzes, and thanks for the report.
It should be possible to stick in a

precompose_arrgv(argc, argv)

into builtin/diff.c

Do you you can test that ?

  reply	other threads:[~2016-03-04 12:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-04  9:07 git diff does not precompose unicode file paths (OS X) Alexander Rinass
2016-03-04 12:16 ` Torsten Bögershausen [this message]
2016-03-04 14:37   ` Alexander Rinass
2016-03-04 18:36     ` Junio C Hamano
2016-03-04 18:49     ` Ramsay Jones
2016-03-07  7:47       ` Alexander Rinass
2016-03-07  8:54         ` Torsten Bögershausen
     [not found]           ` <5C6A30EF-ED0A-4D64-B971-CF873C64B46E@fournova.com>
2016-03-08 12:30             ` Torsten Bögershausen
2016-03-14 21:45               ` Alexander Rinass
2016-03-15  5:45                 ` Torsten Bögershausen
2016-04-04 20:43                   ` Alexander Rinass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56D97C8C.1060205@web.de \
    --to=tboegi@web.de \
    --cc=alex@fournova.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).