git.vger.kernel.org archive mirror
 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 v3 1/1] macOS: ls-files path fails if path of workdir is NFD
Date: Tue, 21 May 2024 10:50:25 -0700	[thread overview]
Message-ID: <xmqqttir9hr2.fsf@gitster.g> (raw)
In-Reply-To: <20240521141452.26210-1-tboegi@web.de> (tboegi@web.de's message of "Tue, 21 May 2024 16:14:52 +0200")

tboegi@web.de writes:

> Add a missing call to precompose_string_if_needed() to this code
> in setup.c :
> `work_tree = precompose_string_if_needed(get_git_work_tree());`

This is new in this iteration, I presume?  The old one did the
precompose only in strbuf_getcwd().  We now precompose also the
result of get_git_work_tree().

Two questions.

 * It is unclear to me why this makes a difference only when the
   precompuse configuration is set only in the local configuration.

 * As the leading part of the value placed in get_git_work_tree()
   comes from strbuf_getcwd() called by abspath.c:real_pathdup()
   that is called by repository.c:repo_set_worktree(), doesn't this
   potentially call precompse twice on the already precomposed early
   parth of the get_git_work_tree() result?

I suspect that with the arrangement in your test, the argument given
to set_git_work_tree() from setup.c:setup_discovered_git_dir() is
always ".", and that dot is passed to repository.c:repo_set_worktree()
which calls abspath.c:real_pathdup() to turn it into an absolute,
where it has a call to strbuf_getcwd().

So with the provided test, I suspect there is no difference between
the previous and this iteration in behaviour, as what is fed to
precompose should be identical?

What this iteration does differently is that inside real_pathdup(),
if the string given to repo_set_worktree() is more than the trivial
".", it is appended to the result of strbuf_getcwd(), and the new
code precomposes after such appending in real_pathdup() happens.  It
will convert the leading part twice [*] and more importantly the
appended part is now converted, unlike the previous one?

	Side note: [*] hopefully precompose is idempotent?  Relying
	on that property somewhat feels yucky, though.

Puzzled...

Will replace and queue, but I couldn't figure out what is going on
with the help by the proposed log message, so...

Thanks.


  reply	other threads:[~2024-05-21 17:50 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
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 [this message]
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=xmqqttir9hr2.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 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).