Re: [PATCH 03/12] t1414: convert test to use Git commands instead of writing refs manually

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

 



"John Cai via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:

>  # Create a situation where the reflog and ref database disagree about the latest
>  # state of HEAD.
> -test_expect_success REFFILES 'walk prefers reflog to ref tip' '
> +test_expect_success 'walk prefers reflog to ref tip' '
> +	test_commit A &&
> +	test_commit B &&
> +	git reflog delete HEAD@{0} &&
>  	head=$(git rev-parse HEAD) &&
> +	A=$(git rev-parse A) &&
>  
> +	echo $A >expect &&

You do not need an intermediate variable A, i.e.

	git rev-parse A >expect &&

would suffice.  Also it seems that $head is no longer used
because you do not manufacture a reflog entry yourself, so the two
assignments to $A and $head can be removed.

>  	git log -g --format=%H -1 >actual &&
>  	test_cmp expect actual
>  '

The resulting code makes the intent of the test much clearer.
Nicely done.




[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