From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Jacob Keller <jacob.e.keller@intel.com>,
git@vger.kernel.org, Jacob Keller <jacob.keller@gmail.com>
Subject: Re: [PATCH v3] reflog: close leak of reflog expire entry
Date: Tue, 22 Jul 2025 07:09:20 -0700 [thread overview]
Message-ID: <xmqqms8wuxkf.fsf@gitster.g> (raw)
In-Reply-To: <20250722045456.GA824456@coredump.intra.peff.net> (Jeff King's message of "Tue, 22 Jul 2025 00:54:56 -0400")
Jeff King <peff@peff.net> 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@peff.net>
> ---
> 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 &&
next prev parent reply other threads:[~2025-07-22 14:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-21 23:39 [PATCH v3] reflog: close leak of reflog expire entry Jacob Keller
2025-07-22 4:54 ` Jeff King
2025-07-22 14:09 ` Junio C Hamano [this message]
2025-07-22 23:10 ` Jeff King
2025-07-22 23:10 ` Jacob Keller
2025-07-22 23:21 ` Junio C Hamano
2025-07-22 23:22 ` Jacob Keller
2025-07-22 23:35 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqms8wuxkf.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=jacob.keller@gmail.com \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).