git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH jk/checkout-attribute-lookup] t2003: work around path mangling issue on Windows
@ 2013-03-20  8:47 Johannes Sixt
  2013-03-20 17:10 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Sixt @ 2013-03-20  8:47 UTC (permalink / raw)
  To: Git Mailing List

From: Johannes Sixt <j6t@kdbg.org>

MSYS bash considers the part "/g" in the sed expression "s/./=/g" as an
absolute path after an assignment, and mangles it to a C:/something
string. Do not attract bash's attention by avoiding the equals sign.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 t/t2003-checkout-cache-mkdir.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/t/t2003-checkout-cache-mkdir.sh b/t/t2003-checkout-cache-mkdir.sh
index 4c97468..ff163cf 100755
--- a/t/t2003-checkout-cache-mkdir.sh
+++ b/t/t2003-checkout-cache-mkdir.sh
@@ -94,14 +94,14 @@ test_expect_success 'apply filter from working tree .gitattributes with --prefix
 	rm -fr path0 path1 path2 tmp* &&
 	mkdir path1 &&
 	mkdir tmp &&
-	git config filter.replace-all.smudge "sed -e s/./=/g" &&
+	git config filter.replace-all.smudge "sed -e s/./,/g" &&
 	git config filter.replace-all.clean cat &&
 	git config filter.replace-all.required true &&
 	echo "file1 filter=replace-all" >path1/.gitattributes &&
 	git checkout-index --prefix=tmp/ -f -a &&
 	echo frotz >expected &&
 	test_cmp expected tmp/path0 &&
-	echo ====== >expected &&
+	echo ,,,,,, >expected &&
 	test_cmp expected tmp/path1/file1
 '
 
-- 
1.8.2.1433.g0074116

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH jk/checkout-attribute-lookup] t2003: work around path mangling issue on Windows
  2013-03-20  8:47 [PATCH jk/checkout-attribute-lookup] t2003: work around path mangling issue on Windows Johannes Sixt
@ 2013-03-20 17:10 ` Junio C Hamano
  2013-03-21  6:46   ` Johannes Sixt
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2013-03-20 17:10 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Git Mailing List

Johannes Sixt <j.sixt@viscovery.net> writes:

> From: Johannes Sixt <j6t@kdbg.org>
>
> MSYS bash considers the part "/g" in the sed expression "s/./=/g" as an
> absolute path after an assignment, and mangles it to a C:/something
> string. Do not attract bash's attention by avoiding the equals sign.

If this breakage is about path mangling, I suspect it may be cleaner
to work it around by not using / as the pattern separator, e.g.

	sed -e s!.!=!g

Or perhaps use SHELL_PATH to point at a more reasonable
implementation of shell that does not have such an idiocy?

> Signed-off-by: Johannes Sixt <j6t@kdbg.org>
> ---
>  t/t2003-checkout-cache-mkdir.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t2003-checkout-cache-mkdir.sh b/t/t2003-checkout-cache-mkdir.sh
> index 4c97468..ff163cf 100755
> --- a/t/t2003-checkout-cache-mkdir.sh
> +++ b/t/t2003-checkout-cache-mkdir.sh
> @@ -94,14 +94,14 @@ test_expect_success 'apply filter from working tree .gitattributes with --prefix
>  	rm -fr path0 path1 path2 tmp* &&
>  	mkdir path1 &&
>  	mkdir tmp &&
> -	git config filter.replace-all.smudge "sed -e s/./=/g" &&
> +	git config filter.replace-all.smudge "sed -e s/./,/g" &&
>  	git config filter.replace-all.clean cat &&
>  	git config filter.replace-all.required true &&
>  	echo "file1 filter=replace-all" >path1/.gitattributes &&
>  	git checkout-index --prefix=tmp/ -f -a &&
>  	echo frotz >expected &&
>  	test_cmp expected tmp/path0 &&
> -	echo ====== >expected &&
> +	echo ,,,,,, >expected &&
>  	test_cmp expected tmp/path1/file1
>  '

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH jk/checkout-attribute-lookup] t2003: work around path mangling issue on Windows
  2013-03-20 17:10 ` Junio C Hamano
@ 2013-03-21  6:46   ` Johannes Sixt
  0 siblings, 0 replies; 3+ messages in thread
From: Johannes Sixt @ 2013-03-21  6:46 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing List

Am 3/20/2013 18:10, schrieb Junio C Hamano:
> Johannes Sixt <j.sixt@viscovery.net> writes:
> 
>> From: Johannes Sixt <j6t@kdbg.org>
>>
>> MSYS bash considers the part "/g" in the sed expression "s/./=/g" as an
>> absolute path after an assignment, and mangles it to a C:/something
>> string. Do not attract bash's attention by avoiding the equals sign.
> 
> If this breakage is about path mangling, I suspect it may be cleaner
> to work it around by not using / as the pattern separator, e.g.
> 
> 	sed -e s!.!=!g

Half a year down the road you'd scratch your head why you were not using
'/' as separator. As the replacement character is irrelevant here, it's
better to exchange that. Therefore, I still prefer my version.

> Or perhaps use SHELL_PATH to point at a more reasonable
> implementation of shell that does not have such an idiocy?

Well, POSIX and DOS paths look inherently different, particularly absolute
paths. You can't write a reasonably portable shell script if the shell
doesn't help in some way.

Not to mention that the supply of POSIX shells on Windows is inherently
scarce.

-- Hannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-21  6:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-20  8:47 [PATCH jk/checkout-attribute-lookup] t2003: work around path mangling issue on Windows Johannes Sixt
2013-03-20 17:10 ` Junio C Hamano
2013-03-21  6:46   ` Johannes Sixt

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