From: Junio C Hamano <gitster@pobox.com>
To: Tuomas Ahola <taahol@utu.fi>
Cc: Jacob Keller <jacob.e.keller@intel.com>, <git@vger.kernel.org>,
Jacob Keller <jacob.keller@gmail.com>
Subject: Re: [PATCH] describe: fix --exclude, --match with --contains and --all
Date: Mon, 01 Jun 2026 09:40:45 +0900 [thread overview]
Message-ID: <xmqq33z7ay9e.fsf@gitster.g> (raw)
In-Reply-To: <20260531234644.97LRl%taahol@utu.fi> (Tuomas Ahola's message of "Mon, 1 Jun 2026 02:46:44 +0300")
Tuomas Ahola <taahol@utu.fi> writes:
> Junio C Hamano <gitster@pobox.com> wrote:
>
>> It is curious that this fails in some but not all CI jobs, and even
>> more curious that these failures look the same.
>>
>> e.g., https://github.com/git/git/actions/runs/26671595367/job/78615760984#step:4:1984
>>
>> +++ diff -u expect actual
>> --- expect 2026-05-30 02:21:23
>> +++ actual 2026-05-30 02:21:23
>> @@ -1 +1 @@
>> -branch_A
>> +remotes/origin/remote_branch_A
>> error: last command exited with $?=1
>> not ok 70 - describe --contains --all --exclude
>> #
>> # echo "branch_A" >expect &&
>> # tagged_commit=$(git rev-parse "refs/tags/A^0") &&
>> # git describe --contains --all --exclude="A" --exclude="c" --exclude="test*" $tagged_commit >actual &&
>> # test_cmp expect actual
>>
>> Rings any bell?
>
> That's way out of my wheelhouse but this seems to fix the failure
> for Alpine at least:
>
> -----8<-----
>
> diff --git a/builtin/name-rev.c b/builtin/name-rev.c
> index d6594ada53..1776ffab46 100644
> --- a/builtin/name-rev.c
> +++ b/builtin/name-rev.c
> @@ -416,7 +416,7 @@ static void name_tips(struct mem_pool *string_pool)
> * Try to set better names first, so that worse ones spread
> * less.
> */
> - QSORT(tip_table.table, tip_table.nr, cmp_by_tag_and_age);
> + STABLE_QSORT(tip_table.table, tip_table.nr, cmp_by_tag_and_age);
> for (i = 0; i < tip_table.nr; i++) {
> struct tip_table_entry *e = &tip_table.table[i];
> if (e->commit) {
Ah, OK, when the test has multiple candidates with the same score,
of course emitting any one of them as the answer is a valid and
correctly working program.
So switching to stable-qsort here may "fix" the test breakage, but
it makes the real-world use cases worse, doesn't it? When any one
of the solutions with the same "goodness" is acceptable, the change
makes the code behave as if the elements in the table before they
are sorted have an "if same score, earlier the better" kind of
relationship between them.
I would have preferred to see a tweak on the test side to avoid
having more than one answer of the same goodness, or perhaps list
all the possible acceptable answers and instead of using test_cmp to
check for the exact answer, take any of the acceptable ones, or
something like that.
Thanks.
next prev parent reply other threads:[~2026-06-01 0:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 23:29 [PATCH] describe: fix --exclude, --match with --contains and --all Jacob Keller
2026-05-30 23:47 ` Junio C Hamano
2026-05-31 23:46 ` Tuomas Ahola
2026-06-01 0:40 ` Junio C Hamano [this message]
2026-06-01 22:35 ` Jacob Keller
2026-06-02 0:10 ` 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=xmqq33z7ay9e.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=jacob.keller@gmail.com \
--cc=taahol@utu.fi \
/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