Re: [PATCH v2 2/2] refs: allow @{n} to work with n-sized reflog

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

 



On Wed, Jan 06, 2021 at 01:01:54AM -0800, Denton Liu wrote:
> diff --git a/t/t1508-at-combinations.sh b/t/t1508-at-combinations.sh
> index 4a9964e9dc..15aac6e77a 100755
> --- a/t/t1508-at-combinations.sh
> +++ b/t/t1508-at-combinations.sh
> @@ -99,4 +99,20 @@ test_expect_success 'create path with @' '
>  check "@:normal" blob content
>  check "@:fun@ny" blob content
>  
> +test_expect_success '@{1} works with only one reflog entry' '
> +	git checkout -B newbranch master &&
> +	git reflog expire --expire=now refs/heads/newbranch &&
> +	git commit --allow-empty -m "first after expiration" &&
> +	git rev-parse newbranch~ >expect &&
> +	git rev-parse newbranch@{1} >actual &&
> +	test_cmp expect actual
> +'
> +
> +test_expect_success '@{0} works with empty reflog' '
> +	git checkout -B newbranch master &&
> +	git reflog expire --expire=now refs/heads/newbranch &&
> +	git rev-parse newbranch >expect &&
> +	git rev-parse newbranch@{0} >actual &&
> +	test_cmp expect actual

You could use 'test_cmp_rev' in these two tests to spare a few lines
and to get a bit friendlier error message on failure.




[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