Re: [PATCH v3] reflog: close leak of reflog expire entry

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

 



Jeff King <peff@xxxxxxxx> writes:

> Subject: [PATCH] t1410: add test of gc.<pattern>.reflogExpire config
>
> We have long supported the ability to set reflog expiration config for
> individual, going back to 3cb22b8efe (Per-ref reflog expiry
> configuration, 2008-06-15). But we have never had any tests.

Yikes.  I completely forgot adding that feature, but it seems I also
forgot to add tests when I added it.  My bad.

"individual" -> "individual refs" or something?  I was confused
after my initial read, which sounded as if we are talking about
allowing individual users to set the configuration variable ;-)

> Let's add a very basic one that checks that we apply the config
> correctly to a subset of refs (and not elsewhere). This also
> triggers the leaky code fixed by the previous commit.

Thanks.

> Signed-off-by: Jeff King <peff@xxxxxxxx>
> ---
>  t/t1410-reflog.sh | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
>
> diff --git a/t/t1410-reflog.sh b/t/t1410-reflog.sh
> index 42b501f163..362e90d7d6 100755
> --- a/t/t1410-reflog.sh
> +++ b/t/t1410-reflog.sh
> @@ -320,6 +320,34 @@ test_expect_success 'git reflog expire unknown reference' '
>  	test_grep "error: reflog could not be found: ${SQ}does-not-exist${SQ}" stderr
>  '
>  
> +test_expect_success 'expire with pattern config' '
> +	# Split refs/heads/ into two roots so we can apply config to each. Make
> +	# two branches per root to verify that config is applied correctly
> +	# multiple times.
> +	git branch root1/branch1 &&
> +	git branch root1/branch2 &&
> +	git branch root2/branch1 &&
> +	git branch root2/branch2 &&
> +
> +	test_config "gc.reflogexpire" "never" &&
> +	test_config "gc.refs/heads/root2/*.reflogExpire" "now" &&
> +	git reflog expire \
> +		root1/branch1 root1/branch2 \
> +		root2/branch1 root2/branch2 &&
> +
> +	cat >expect <<-\EOF &&
> +	root1/branch1@{0}
> +	root1/branch2@{0}
> +	EOF
> +	git log -g --branches="root*" --format=%gD >actual.raw &&
> +	# The sole reflog entry of each branch points to the same commit, so
> +	# the order in which they are shown is nondeterministic. We just care
> +	# about the what was expired (and what was not), so sort to get a known
> +	# order.
> +	sort <actual.raw >actual.sorted &&
> +	test_cmp expect actual.sorted
> +'
> +
>  test_expect_success 'checkout should not delete log for packed ref' '
>  	test $(git reflog main | wc -l) = 4 &&
>  	git branch foo &&




[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