Re: [PATCH 1/5] fetch test: use more robust test for filtered objects

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

 



On 12/23/2019 7:59 PM, Jonathan Nieder wrote:
>  	# Ensure that object is not inadvertently fetched
> -	test_must_fail git -C client cat-file -e $(git hash-object server/one.t)
> +	commit=$(git -C server rev-parse HEAD) &&
> +	blob=$(git hash-object server/one.t) &&
> +	git -C client rev-list --objects --missing=allow-any "$commit" >oids &&
> +	! grep "$blob" oids
>  '
>  
>  test_expect_success 'filtering by size has no effect if support for it is not advertised' '
> @@ -929,7 +932,10 @@ test_expect_success 'filtering by size has no effect if support for it is not ad
>  	git -C client fetch-pack --filter=blob:limit=0 ../server HEAD 2> err &&
>  
>  	# Ensure that object is fetched
> -	git -C client cat-file -e $(git hash-object server/one.t) &&
> +	commit=$(git -C server rev-parse HEAD) &&
> +	blob=$(git hash-object server/one.t) &&
> +	git -C client rev-list --objects --missing=allow-any "$commit" >oids &&
> +	grep "$blob" oids &&
>  
>  	test_i18ngrep "filtering not recognized by server" err
>  '
> @@ -951,9 +957,11 @@ fetch_filter_blob_limit_zero () {
>  	git -C client fetch --filter=blob:limit=0 origin HEAD:somewhere &&
>  
>  	# Ensure that commit is fetched, but blob is not
> -	test_config -C client extensions.partialclone "arbitrary string" &&
> -	git -C client cat-file -e $(git -C "$SERVER" rev-parse two) &&
> -	test_must_fail git -C client cat-file -e $(git hash-object "$SERVER/two.t")
> +	commit=$(git -C "$SERVER" rev-parse two) &&
> +	blob=$(git hash-object server/two.t) &&
> +	git -C client rev-list --objects --missing=allow-any "$commit" >oids &&
> +	grep "$commit" oids &&
> +	! grep "$blob" oids

At first glance, I saw this and thought the "three is many" rule would imply
the boilerplate in these tests should be de-duplicated with a function.
However, the use of the "commit" and "blob" variables is different in each
test, so I did not find a convenient way to make this simpler.

Thanks,
-Stolee




[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