git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
	Johannes Schindelin via GitGitGadget <gitgitgadget@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH 1/1] t0001: fix on case-insensitive filesystems
Date: Wed, 19 Jun 2019 22:17:47 +0200 (CEST)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.1906192201200.44@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <xmqqo935o0yi.fsf@gitster-ct.c.googlers.com>

Hi,

On Mon, 10 Jun 2019, Junio C Hamano wrote:

> "brian m. carlson" <sandals@crustytoothpaste.net> writes:
>
> >>  test_expect_success 'init with separate gitdir' '
> >>  	rm -rf newdir &&
> >>  	git init --separate-git-dir realgitdir newdir &&
> >>  	echo "gitdir: $(pwd)/realgitdir" >expected &&
> >> +	downcase_on_case_insensitive_fs expected newdir/.git &&
> >
> > I wonder if there's maybe a simpler way. If we canonicalize paths when
> > writing them to the gitdir file, then writing "$(pwd -P)" on the line
> > above should produce the right result.

When you execute `pwd -P` in Git for Windows' SDK's Bash (which is an
MSYS2 Bash), you get the emulated Unix path. For example, in my main Git
worktree, this results in

	$ pwd -P
	/usr/src/git

However, the actual (i.e. Windows) path seen by `git.exe` is
`C:/git-sdk-64/usr/src/git`.

> > Now, technically, POSIX doesn't require case canonicalization of the
> > path with "pwd -P", but then again, POSIX doesn't permit
> > case-insensitive file systems,

I was not sure about this statement (that POSIX does not permit
case-insensitive file systems), so I whipped up this gem in a quick web
search (https://unix.stackexchange.com/a/358407):

	According to the POSIX specification:

	    The system may provide non-standard extensions. These are
	    features not required by POSIX.1-2008 and may include, but are
	    not limited to:

	--snip--

		Non-conforming file systems (for example, legacy file
		systems for which _POSIX_NO_TRUNC is false,
		case-insensitive file systems, or network file systems)

Which means that I now know once and for all that POSIX does not dictate
whether a file system should, or should not, be case-insensitive.

> > and we know the behavior on macOS uses bash, which does the right
> > thing in this case because it calls realpath(3). I've tested that it
> > also does the right thing on Linux when the worktree containing the
> > Git checkout is in a path with symlinks.

I am honestly not a big fan of relying on testing things on the major
three platforms and then assuming that everything will work also on the
long tail of operating systems/setups.

That is exactly the kind of thinking that led me to believe that relying
on REG_STARTEND was a sane thing, and it simply wasn't. It caused quite a
bit of pain, and my original approach would have prevented that, and after
testing on the major three platforms I let myself be talked into dropping
the original approach.

> > I don't know how that works on Windows, but if it does, it might be
> > simpler.
>
> Yup, it would be a worthwhile avenue to pursue; on the negative
> side, a single-liner "no, unfortunately that would not work on
> Windows" would also be useful.

1) no, unfortunately that would not work on Windows. In a PowerShell, when
   I call `c:` followed by `cd \GIT-SDK-64`, it reports the current
   directory as `C:\GIT-SDK-64` (i.e. with the wrong case, the real name,
   on disk, is `C:\git-sdk-64`). When I then call Git's Bash to execute
   `git -PW` (the `W` stands for: gimme a Windows path), it reports
   `C:/GIT-SDK-64`. Incorrect case.

2) It might look more elegant from the design perspective, but oh my
   goodness do I not want to be a developer who has no knowledge of this
   design decision, being tasked to debug any related issue.

   It would be very "magic" that Git relies on its having written a
   normalized path, not dealing well with Git worktrees initialized by
   alternative Git implementations that did not normalize that path, or
   previous Git versions that also did not, for example.

   And normalizing the path for the sake of having this test case pass?
   Nah. I like it explicit. And that's what my patch does. No magic.

Ciao,
Dscho

  reply	other threads:[~2019-06-19 20:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-08 14:43 [PATCH 0/1] Fix a test on NTFS (and probably HFS+) Johannes Schindelin via GitGitGadget
2019-06-08 14:43 ` [PATCH 1/1] t0001: fix on case-insensitive filesystems Johannes Schindelin via GitGitGadget
2019-06-09 19:23   ` Martin Ågren
2019-06-19 20:24     ` Johannes Schindelin
2019-06-09 20:13   ` brian m. carlson
2019-06-10 16:32     ` Junio C Hamano
2019-06-19 20:17       ` Johannes Schindelin [this message]
2019-06-21 19:33     ` Ævar Arnfjörð Bjarmason
     [not found] ` <pull.151.v2.git.gitgitgadget@gmail.com>
     [not found]   ` <c2fdcf28e725c91a1a48c34226223866ad14bc0a.1560978437.git.gitgitgadget@gmail.com>
2019-06-21 14:34     ` [PATCH v2 " Johannes Schindelin
2019-06-21 17:31       ` Junio C Hamano
2019-06-24 10:13         ` Johannes Schindelin
2019-06-24 17:09           ` Junio C Hamano
2019-06-24 17:38             ` Johannes Schindelin
2019-06-24 19:22               ` Junio C Hamano
     [not found]   ` <pull.151.v3.git.gitgitgadget@gmail.com>
     [not found]     ` <1f0ceee8687e9032a7777f764b34b1c9ccc68f38.1561379363.git.gitgitgadget@gmail.com>
2019-06-24 17:40       ` [PATCH v3 " Johannes Schindelin
2019-06-24 18:55         ` Junio C Hamano
2019-06-25 10:50           ` vger vs GitGitGadget, was " Johannes Schindelin
2019-06-25 19:42             ` Junio C Hamano

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=nycvar.QRO.7.76.6.1906192201200.44@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=sandals@crustytoothpaste.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).