Subject: Re: [PATCH 03/24] t9300 (fast-import): guard "export large marks" test setup

From: Ramkumar Ramachandra <[email-masked]>
Date: Fri, 24 Sep 2010 15:08:52 +0530

Hi,

Jonathan Nieder writes:
>  test_expect_success 'A: export marks with large values' '
> +	test_tick &&
> +	mt=$(git hash-object --stdin </dev/null) &&
> +	>input.blob &&
> +	>marks.exp &&
> +	>tree.exp &&
> +
> +	cat >input.commit <<-EOF &&
> +	commit refs/heads/verify--dump-marks
> +	committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
> +	data <<COMMIT
> +	test the sparse array dumping routines with exponentially growing marks

Ok, so we want marks to grow exponentially.

> +	COMMIT
> +	EOF
> +
> +	(
> +		i=0 &&
> +		l=4 &&
> +		m=6 &&
> +		n=7 &&

Maybe use slightly less cryptic variable names?

> +		while test "$i" -lt 27

Something like for i in `seq 1 10` will atleast make it clear that i
is just a loop variable. That's one arbitrary variable less.

> +		do
> +			cat >>input.blob <<-EOF &&
> +			blob
> +			mark :$l
> +			data 0
> +			blob
> +			mark :$m
> +			data 0
> +			blob
> +			mark :$n
> +			data 0
> +			EOF
> +			{
> +				echo "M 100644 :$l l$i" &&
> +				echo "M 100644 :$m m$i" &&
> +				echo "M 100644 :$n n$i"
> +			} >>input.commit &&
> +			{
> +				echo ":$l $mt" &&
> +				echo ":$m $mt" &&
> +				echo ":$n $mt"
> +			} >>marks.exp &&
> +			{
> +				printf "100644 blob $mt\tl$i\n" &&
> +				printf "100644 blob $mt\tm$i\n" &&
> +				printf "100644 blob $mt\tn$i\n"
> +			} >>tree.exp &&
> +			l=$(($l + $l)) &&
> +			m=$(($m + $m)) &&
> +			n=$(($l + $n)) &&

Maybe l=$(($l * 2)) and similarly for m to emphasize that they're
doubling in every loop iteration?

-- Ram