Re: [PATCH v2 1/1] t0001: fix on case-insensitive filesystems
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jun 24, 2019, 10:13 UTC
- Message-ID
- <nycvar.QRO.7.76.6.1906241212220.44@tvgsbejvaqbjf.bet>
- In-Reply-To
- <xmqqh88ikfpb.fsf@gitster-ct.c.googlers.com>
Hi Junio,
On Fri, 21 Jun 2019, Junio C Hamano wrote:
Show 7 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes: > > > [Re-sending, as the Git mailing list seems to have decided to silently > > drop this patch, I cannot see it on public-inbox.org, at least] > > Move that below the three-dash lines; otherwise the above two lines > will make your in-body From: ineffective.
Indeed, sorry, I forgot.
Show 22 quoted lines
> > diff --git a/t/t0001-init.sh b/t/t0001-init.sh
> > index 42a263cada..68f713884f 100755
> > --- a/t/t0001-init.sh
> > +++ b/t/t0001-init.sh
> > @@ -307,10 +307,22 @@ test_expect_success 'init prefers command line to GIT_DIR' '
> > test_path_is_missing otherdir/refs
> > '
> >
> > +downcase_on_case_insensitive_fs () {
> > + test true = "$(git config --get --type=bool core.ignorecase)" ||
> > + return 0
> > +
> > + for f
> > + do
> > + tr A-Z a-z <"$f" >"$f".downcased &&
> > + mv -f "$f".downcased "$f" || return 1
>
> It is easier to read to enclose the whole filename inside dq pair,
> i.e.
>
> tr A-Z a-z <"$f" >"$f.downcased" &&
> mv -f "$f.downcased" "$f" || return 1Okay.
Show 23 quoted lines
> Not grave enough to be worthy of a reroll on this one alone, though. > > > 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 && > > It is somewhat brittle to munge what is in "newdir/.git", which will > affect later tests that use newdir/ as a repository (this one will > be removed soon, but the last one in the sequence this patch touches > will persist and is used by other tests). It's not like we are > testing that Git will function OK even after futzing with the ".git" > pointer file (if so, we'd want a separate test that specifically is > designed to test that behaviour). > > I wonder if we want (possibly local) test_cmp_fspath that can be > used more like > > test_cmp_fspath "$(pwd)/realgitdir" "$(sed -e "s/^gitdir: //" newdir/.git)" > > to compare two paths, honoring the case sensitivity of the > filesystem.
I agree that that's a much better approach to fix the issue.
Thanks, Dscho
Show 23 quoted lines
> > > test_cmp expected newdir/.git && > > test_path_is_dir realgitdir/refs > > ' > > @@ -365,6 +377,7 @@ test_expect_success 're-init to update git link' ' > > git init --separate-git-dir ../surrealgitdir > > ) && > > echo "gitdir: $(pwd)/surrealgitdir" >expected && > > + downcase_on_case_insensitive_fs expected newdir/.git && > > test_cmp expected newdir/.git && > > test_path_is_dir surrealgitdir/refs && > > test_path_is_missing realgitdir/refs > > @@ -378,6 +391,7 @@ test_expect_success 're-init to move gitdir' ' > > git init --separate-git-dir ../realgitdir > > ) && > > echo "gitdir: $(pwd)/realgitdir" >expected && > > + downcase_on_case_insensitive_fs expected newdir/.git && > > test_cmp expected newdir/.git && > > test_path_is_dir realgitdir/refs > > ' > > -- > > gitgitgadget >