Re: [PATCH v7 3/3] completion: handle unusual characters for sparse-checkout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 07, 2022 at 05:31:45PM +0000, Lessley Dennington via GitGitGadget wrote:
> <snip>
> 
> Note there are two tests for this new functionality - one for spaces and
> accents and one for backslashes and tabs. The backslashes and tabs test
> uses FUNNYNAMES to avoid running on Windows. This is because:
> 
> 1. Backslashes are explicitly not allowed in Windows file paths.
> 2. Although tabs appear to be allowed when creating a file in a Windows
> bash shell, they actually are not renderable (and appear as empty boxes
> in the shell).
> 
> <snip>
> diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
> index b38a7302249..da6c86c64b3 100755
> --- a/t/t9902-completion.sh
> +++ b/t/t9902-completion.sh
> @@ -1508,6 +1508,55 @@ test_expect_success 'cone mode sparse-checkout completes directory names' '
> <snip>
> +# use FUNNYNAMES to avoid running on Windows, which doesn't permit backslashes or tabs in paths
> +test_expect_success FUNNYNAMES 'cone mode sparse-checkout completes directory names with backslashes and tabs' '
> +	# reset sparse-checkout
> +	git -C sparse-checkout sparse-checkout disable &&
> +	(
> +		cd sparse-checkout &&
> +		mkdir "directory\with\backslashes" &&
> +		mkdir "$(printf "directory\twith\ttabs")" &&
> +		>"directory\with\backslashes/randomfile" &&
> +		>"$(printf "directory\twith\ttabs")/randomfile" &&
> +		git add . &&
> +		git commit -m "Add directory with backslashes and directory with tabs" &&
> +		git sparse-checkout set --cone "directory\with\backslashes" \
> +			"$(printf "directory\twith\ttabs")" &&
> +		test_completion "git sparse-checkout add dir" <<-\EOF &&
> +		directory\with\backslashes/
> +		directory	with	tabs/
> +		EOF
> +		rm -rf "directory\with\backslashes" &&
> +		rm -rf "$(printf "directory\twith\ttabs")" &&
> +		git add . &&
> +		git commit -m "Remove directory with backslashes and directory with tabs"
> +	)
> +'
> +
>  test_expect_success 'non-cone mode sparse-checkout uses bash completion' '
>  	# reset sparse-checkout repo to non-cone mode
>  	git -C sparse-checkout sparse-checkout disable &&

On Cygwin this test is failing: `FUNNYNAMES` checks (a) the system isn't
MinGW, and (b) the filesystem supports tabs, quotes and newlines.
Cygwin isn't MinGW, and its interface to the file system supports all
those characters, but doesn't support backslashes.

I think the ideal solution here would be to split this test into two:
one part to cover the tab part, which will work on Cygwin, and a
separate part that has another prereq (which might be a new variant of
FUN*NAMES, or might be something more explicit like
SLASHALLOWEDINPATHCOMPONENTS, or might just be FUNNYNAMES,!CYGWIN).  But
it might be easier to just gate this test on FUNNYNAMES,!CYGWIN and not
worry about not being able to test the tab handling on Cygwin systems,
as the chances of a Cygwin-specific regression that'd only be caught by
this test seems pretty low to me.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux