Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: "Torsten Bögershausen" <>
To: Jun T <>
Subject: Re: [BUG] 'ls-files path' fails if absolute path of workdir contains NFD (macOS)
Date: Tue, 30 Apr 2024 09:12:47 +0200	[thread overview]
Message-ID: <20240430071247.GB1504@tb-raspi4> (raw)
In-Reply-To: <>

On Tue, Apr 30, 2024 at 12:27:02PM +0900, Jun T wrote:
> On macOS, 'git ls-files path' does not work (gives an error)
> if the absolute 'path' contains characters in NFD (decomposed).
> I guess this is a (minor) bug of git.
> [1] How to reproduce the problem
> On macOS, git 2.39.3 or branch),
> file system can be APFS or HFS.
> with zsh or bash:
> % cd /somewhere         # some safe place, /tmp or ~/tmp etc.
> % mkdir $'u\xcc\x88'    # ü in NFD
> % cd ü                  # or cd $'u\xcc\x88' or cd $'\xc3\xbc'
> % git init
> % git ls-files $'/somewhere/u\xcc\x88'   # NFD
> fatal: /somewhere/ü: '/somewhere/ü' is outside repository at '/somewhere/ü'
> % git ls-files $'/somewhere/\xc3\xbc'    # NFC
> (the same error as above)
> In the 'fatal:' error message, there are three ü;
> the 1st and 2nd are in NFC, the 3rd is in NFD.
> [2] Some analysis
> The path on the command line $'/somewhere/u\xcc\x88'
> is converted to NFC by precompose_argv_prefix(),
> called at git.c:451 in run_builtin().
> But get_git_work_tree() (called at setup.c:50, in
> abspath_part_inside_repo()) returns the work_tree in NFD,
> and comparing it with the path in NFC (setup.c:92) fails.
> I'm not familiar with git internals, but maybe
> get_git_work_tree() should return NFC (on macoS)?
> --
> Jun (Jun-ichi Takimoto)

Thanks for an excellent bug report and analyzes.
I am familar with the NFC/NFD stuff, but not with get_git_work_tree(),
at least not yet.

If you have a suggestion for a patch, would you like to share it ?
A 'git diff' may be a good start, I am happy to review things.


  reply	other threads:[~2024-04-30  7:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-30  3:27 [BUG] 'ls-files path' fails if absolute path of workdir contains NFD (macOS) Jun T
2024-04-30  7:12 ` Torsten Bögershausen [this message]
2024-04-30 15:52   ` Jun. T
2024-04-30 16:58     ` Torsten Bögershausen

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:

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

  git send-email \
    --in-reply-to=20240430071247.GB1504@tb-raspi4 \ \ \ \

* 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 read-only IMAP folder(s) and NNTP newsgroup(s).