Re: [PATCH 1/2] t1450: robustify `remove_object()`

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

 



"Johannes Schindelin via GitGitGadget" <gitgitgadget@xxxxxxxxx>
writes:

> -test_expect_success 'setup: helpers for corruption tests' '
> -	sha1_file() {
> -		remainder=${1#??} &&
> -		firsttwo=${1%$remainder} &&
> -		echo ".git/objects/$firsttwo/$remainder"
> -	} &&
> +sha1_file () {
> +	git rev-parse --git-path objects/$(test_oid_to_path "$1")
> +}

Yeah, back when 90cf590f (fsck: optionally show more helpful info
for broken links, 2016-07-17) originally introduced this pattern,
we didn't have nicely abstracted helper, but now we do, and there
is no reason not to use it.  Nice.

> -	remove_object() {
> -		rm "$(sha1_file "$1")"
> -	}
> -'
> +remove_object() {

Just like you did for the other one, let's insert SP before () for
consistency here.

> +	rm "$(sha1_file "$1")"
> +}
>  
>  test_expect_success 'object with bad sha1' '
>  	sha=$(echo blob | git hash-object -w --stdin) &&

Nicely done.  

Reviewed-by: Junio C Hamano <gitster@xxxxxxxxx>



[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