"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: regress: strip trailing / from -r tmpdir
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Tue, 10 Jan 2023 12:48:37 +0100

Download raw body.

Thread
On Tue, Jan 10, 2023 at 12:41:32PM +0100, Omar Polo wrote:
> One midly annoying thing when manually running some test cases is that
> you need to remember to remove the trailing / from the path given as -r:
> 
> 	% ./diff -r ~/tmp/got-tmp
> 	everything's ok
> 	% ./diff -r ~/tmp/got-tmp/
> 	most tests fails because they expect
> 	~/tmp/got-tmp/foo instead of
> 	~/tmp/got-tmp//foo ...
> 
> this is just to scratch an itch.  given that the shell' tab-completion
> adds a trailing / for directories, what not stripping it?
> 
> ok?

Yes, thanks. I have run into this before, too.
 
> diff /home/op/w/got
> commit - 34d80a0ff3357761ddb975a1a96d3ee795218e41
> path + /home/op/w/got
> blob - 09788e37096319afffa06cca64d7a215c112d476
> file + regress/cmdline/common.sh
> --- regress/cmdline/common.sh
> +++ regress/cmdline/common.sh
> @@ -231,7 +231,7 @@ test_parseargs()
>  		case $flag in
>  		q)	export GOT_TEST_QUIET=1
>  			;;
> -		r)	export GOT_TEST_ROOT=$OPTARG
> +		r)	export GOT_TEST_ROOT=${OPTARG%/}
>  			;;
>  		?)	echo "Supported options:"
>  			echo "  -q: quiet mode"
> 
>