Subject: Re: [PATCH 11/25] t7400: fix broken "submodule add/reconfigure --force" test

From: Eric Sunshine <[email-masked]>
Date: Mon, 16 Jul 2018 19:05:35 -0400

On Mon, Jul 16, 2018 at 02:37:32PM -0700, Junio C Hamano wrote:
> Eric Sunshine <[email-masked]> writes:
> > On Mon, Jul 16, 2018 at 11:51 AM Johannes Schindelin
> > <[email-masked]> wrote:
> >> On Mon, 16 Jul 2018, Johannes Schindelin wrote:
> >> > > -           git submodule add --force bogus-url submod &&
> >> > > +           git submodule add --force /bogus-url submod &&
> >> > This breaks on Windows because of the absolute Unix-y path having to be
> >> > translated to a Windows path:
> >> > I could imagine that using "$(pwd)/bogus-url" (which will generate a
> >> > Windows-y absolute path on Windows) would work, though.
> >>
> >> Yes, this works indeed, see the patch below. Could you please squash it in
> >> if you send another iteration of your patch series? Junio, could you
> >> please add this as a SQUASH??? commit so that `pu` is fixed on Windows?
> >
> > So, this SQUASH looks like the correct way forward. Hopefully, Junio
> > can just squash it so I don't have to flood the list again with this
> > long series.
> 
> The topic already has another dependent topic so rerolling or
> squashing would be a bit cumbersome.  I'll see what I could do but
> it may not be until tomorrow's pushout.

No problem. Here's Dscho's fix in the form of a proper patch if
that makes it easier for you (it just needs his sign-off):

--- >8 ---
From: Johannes Schindelin <[email-masked]>
Subject: [PATCH] t7400: make "submodule add/reconfigure --force" work on
 Windows

On Windows, the "Unixy" path /bogus-url gets translated automatically to
a Windows-style path (such as C:/git-sdk/bogus_url). This is normally
not problem, since it's still a valid and usable path in that form,
however, this test wants to do a comparison against the original path.
$(pwd) was invented exactly for this case, so use it to make the path
comparison work.

[es: commit message]

Signed-off-by: Eric Sunshine <[email-masked]>
---
 t/t7400-submodule-basic.sh | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/t/t7400-submodule-basic.sh b/t/t7400-submodule-basic.sh
index 76cf522a08..bfb09dd566 100755
--- a/t/t7400-submodule-basic.sh
+++ b/t/t7400-submodule-basic.sh
@@ -171,10 +171,11 @@ test_expect_success 'submodule add to .gitignored path with --force' '
 test_expect_success 'submodule add to reconfigure existing submodule with --force' '
 	(
 		cd addtest-ignore &&
-		git submodule add --force /bogus-url submod &&
+		bogus_url="$(pwd)/bogus-url" &&
+		git submodule add --force "$bogus_url" submod &&
 		git submodule add --force -b initial "$submodurl" submod-branch &&
-		test "/bogus-url" = "$(git config -f .gitmodules submodule.submod.url)" &&
-		test "/bogus-url" = "$(git config submodule.submod.url)" &&
+		test "$bogus_url" = "$(git config -f .gitmodules submodule.submod.url)" &&
+		test "$bogus_url" = "$(git config submodule.submod.url)" &&
 		# Restore the url
 		git submodule add --force "$submodurl" submod &&
 		test "$submodurl" = "$(git config -f .gitmodules submodule.submod.url)" &&
-- 
2.18.0.233.g985f88cf7e