All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: tboegi@web.de
Cc: git@vger.kernel.org,  takimoto-j@kba.biglobe.ne.jp
Subject: Re: [PATCH v2 1/1] macOS: ls-files path fails if path of workdir is NFD
Date: Thu, 09 May 2024 09:37:41 -0700	[thread overview]
Message-ID: <xmqqikznueju.fsf@gitster.g> (raw)
In-Reply-To: <20240509161110.12121-1-tboegi@web.de> (tboegi@web.de's message of "Thu, 9 May 2024 18:11:10 +0200")

tboegi@web.de writes:

> From: Torsten Bögershausen <tboegi@web.de>
>
> Under macOS, `git ls-files path` does not work (gives an error)
> if the absolute 'path' contains characters in NFD (decomposed).
> ...
>
> Reported-by: Jun T <takimoto-j@kba.biglobe.ne.jp>
> Signed-off-by: Torsten Bögershausen <tboegi@web.de>
> ---

Looks good.  I've queued with a slight rewording to the proposed log
message, and a bit of extra quoting in the test.  Any string that
contains "$aumlcdiar" are enclosed in a pair of double-quotes in the
script, so not just the one given to ls-files, other two references
to it are also quoted now.

Thanks.

1:  a00cec23cf ! 1:  ee6ba4053d macOS: ls-files path fails if path of workdir is NFD
    @@ Commit message
         In the 'fatal:' error message, there are three ü;
         the 1st and 2nd are in NFC, the 3rd is in NFD.
     
    -    This commit adds a test case that follows the bug report,
    -    with the simplification that the 'ü' is replaced by an 'ä',
    -    which is already used as NFD and NFC in t0050.
    +    Add a test case that follows the bug report, with the simplification
    +    that the 'ü' is replaced by an 'ä', which is already used as NFD and
    +    NFC in t0050.
     
    -    The solution is to precompose the result of getcwd(), if needed.
    +    Precompose the result of getcwd(), if needed, just like all other
    +    paths we use internally.  That way, paths comparisons are all done
    +    in NFC and we would correctly notice that the early part of the
    +    path given as an absolute path matches the current directory.
     
         One possible implementation would be to re-define getcwd() similar
    -    to opendir(), readdir() and closedir().
    -    Since there is already a strbuf wrapper around getcwd(), and only this
    -    wrapper is used inside the whole codebase, equip strbuf_getcwd() with
    -    a call to the newly created function precompose_strbuf_if_needed().
    +    to opendir(), readdir() and closedir(), but since there is already a
    +    strbuf wrapper around getcwd(), and only this wrapper is used inside
    +    the whole codebase, equip strbuf_getcwd() with a call to the newly
    +    created function precompose_strbuf_if_needed().
    +
         Note that precompose_strbuf_if_needed() is a function under macOS,
         and is a "no-op" on all other systems.
     
    @@ t/t0050-filesystem.sh: test_expect_success CASE_INSENSITIVE_FS 'checkout with no
      
     +test_expect_success 'git ls-files under NFD' '
     +	(
    -+		mkdir -p somewhere/$aumlcdiar &&
    ++		mkdir -p "somewhere/$aumlcdiar" &&
     +		mypwd=$PWD &&
    -+		cd somewhere/$aumlcdiar &&
    ++		cd "somewhere/$aumlcdiar" &&
     +		git init &&
    -+		git --literal-pathspecs ls-files "$mypwd/somewhere/$aumlcdiar"  2>err &&
    ++		git --literal-pathspecs ls-files "$mypwd/somewhere/$aumlcdiar" 2>err &&
     +		>expected &&
     +		test_cmp expected err
     +	)

  reply	other threads:[~2024-05-09 16:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240430032717281.IXLP.121462.mail.biglobe.ne.jp@biglobe.ne.jp>
2024-05-07  8:44 ` [PATCH v1 1/2] t0050: ls-files path fails if path of workdir is NFD tboegi
2024-05-07 17:30   ` Junio C Hamano
2024-05-07  8:44 ` [PATCH v1 2/2] strbuf_getcwd() needs precompse_strbuf_if_needed() tboegi
2024-05-07 17:22   ` Junio C Hamano
2024-05-09 15:24     ` Junio C Hamano
2024-05-09 15:29       ` Torsten Bögershausen
2024-05-07 17:47   ` Junio C Hamano
2024-05-08  0:32     ` brian m. carlson
2024-05-09 16:11 ` [PATCH v2 1/1] macOS: ls-files path fails if path of workdir is NFD tboegi
2024-05-09 16:37   ` Junio C Hamano [this message]
2024-05-19  7:03   ` Jun. T
2024-05-20 16:06     ` Torsten Bögershausen
2024-05-20 18:08       ` Junio C Hamano
2024-05-20 19:21         ` Torsten Bögershausen
2024-05-21 14:14 ` [PATCH v3 " tboegi
2024-05-21 17:50   ` Junio C Hamano
2024-05-21 20:57     ` Torsten Bögershausen
2024-05-21 22:15       ` Junio C Hamano
2024-05-23 15:33         ` Jun. T
2024-05-25 20:01           ` Torsten Bögershausen
2024-05-31 19:31 ` [PATCH v4 " tboegi
2024-06-01 15:55   ` Junio C Hamano
2024-06-02 19:40     ` Torsten Bögershausen
2024-06-04  0:56   ` Jun T

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=xmqqikznueju.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=takimoto-j@kba.biglobe.ne.jp \
    --cc=tboegi@web.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.