From: Derrick Stolee <stolee@gmail.com>
To: Patrick Steinhardt <ps@pks.im>,
Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, gitster@pobox.com,
johannes.schindelin@gmx.de, peff@peff.net, me@ttaylorr.com,
johncai86@gmail.com, newren@gmail.com,
christian.couder@gmail.com, kristofferhaugsbakk@fastmail.com,
jonathantanmy@google.com, karthik.188@gmail.com,
Derrick Stolee <derrickstolee@github.com>
Subject: Re: [PATCH v2 4/5] backfill: add --sparse option
Date: Mon, 3 Feb 2025 10:11:28 -0500 [thread overview]
Message-ID: <34379f16-9da6-440b-8656-5d580056c36b@gmail.com> (raw)
In-Reply-To: <Z4jY4rELRYvS2gOk@pks.im>
On 1/16/25 5:01 AM, Patrick Steinhardt wrote:
> On Fri, Dec 20, 2024 at 04:29:52PM +0000, Derrick Stolee via GitGitGadget wrote:
>> + if (ctx->info->pl) {
>> + int dtype;
>> + enum pattern_match_result match;
>> + match = path_matches_pattern_list(path.buf, path.len,
>> + path.buf + base_len, &dtype,
>> + ctx->info->pl,
>> + ctx->repo->index);
>> +
>> + if (ctx->info->pl->use_cone_patterns &&
>> + match == NOT_MATCHED)
>> + continue;
>> + else if (!ctx->info->pl->use_cone_patterns &&
>> + type == OBJ_BLOB &&
>> + match != MATCHED)
>
> For my own understanding: is there as pecific reason why one of the
> branches uses `== NOT_MATCHED` whereas the other one uses `!= MATCHED`?
With cone mode sparse-checkout, 'match' could equal MATCHED,
MATCHED_RECURSIVE, or UNDECIDED, which we want to be considered all the
same case: continue along this path.
When not in cone mode, we can't decide to filter by trees (hence the
OBJ_BLOB restriction) and then the result can be MATCHED, NOT_MATCHED,
and UNDECIDED. This rule matches the following realization:
* MATCHED if there is a positive pattern that matches the path.
* NOT_MATCHED if there is a negative pattern that matches the path.
* UNDECIDED if no pattern matches the path.
This is subtle, but switching this to "match == NOT_MATCHED" will
result in the test failing (and the test is right).
I will make note of this in my commit message in the next version, as
well as adding a test that has nested positive and negative patterns.
Thanks,
-Stolee
next prev parent reply other threads:[~2025-02-03 15:11 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 20:07 [PATCH 0/5] PATH WALK III: Add 'git backfill' command Derrick Stolee via GitGitGadget
2024-12-06 20:07 ` [PATCH 1/5] backfill: add builtin boilerplate Derrick Stolee via GitGitGadget
2025-01-16 10:11 ` Patrick Steinhardt
2025-01-16 17:52 ` Junio C Hamano
2025-02-03 14:38 ` Derrick Stolee
2024-12-06 20:07 ` [PATCH 2/5] backfill: basic functionality and tests Derrick Stolee via GitGitGadget
2024-12-16 8:01 ` Patrick Steinhardt
2024-12-18 15:03 ` Derrick Stolee
2024-12-06 20:07 ` [PATCH 3/5] backfill: add --batch-size=<n> option Derrick Stolee via GitGitGadget
2024-12-16 8:01 ` Patrick Steinhardt
2024-12-18 15:09 ` Derrick Stolee
2025-01-19 17:57 ` Jean-Noël AVILA
2024-12-06 20:07 ` [PATCH 4/5] backfill: add --sparse option Derrick Stolee via GitGitGadget
2024-12-16 8:01 ` Patrick Steinhardt
2024-12-06 20:07 ` [PATCH 5/5] backfill: assume --sparse when sparse-checkout is enabled Derrick Stolee via GitGitGadget
2024-12-08 10:53 ` [PATCH 0/5] PATH WALK III: Add 'git backfill' command Junio C Hamano
2024-12-09 0:34 ` Junio C Hamano
2024-12-20 16:29 ` [PATCH v2 " Derrick Stolee via GitGitGadget
2024-12-20 16:29 ` [PATCH v2 1/5] backfill: add builtin boilerplate Derrick Stolee via GitGitGadget
2024-12-20 16:29 ` [PATCH v2 2/5] backfill: basic functionality and tests Derrick Stolee via GitGitGadget
2025-01-16 10:01 ` Patrick Steinhardt
2025-02-03 14:44 ` Derrick Stolee
2024-12-20 16:29 ` [PATCH v2 3/5] backfill: add --min-batch-size=<n> option Derrick Stolee via GitGitGadget
2025-01-16 10:01 ` Patrick Steinhardt
2024-12-20 16:29 ` [PATCH v2 4/5] backfill: add --sparse option Derrick Stolee via GitGitGadget
2025-01-16 10:01 ` Patrick Steinhardt
2025-02-03 15:11 ` Derrick Stolee [this message]
2024-12-20 16:29 ` [PATCH v2 5/5] backfill: assume --sparse when sparse-checkout is enabled Derrick Stolee via GitGitGadget
2025-01-16 10:00 ` [PATCH v2 0/5] PATH WALK III: Add 'git backfill' command Patrick Steinhardt
2025-01-17 22:37 ` Junio C Hamano
2025-02-03 17:11 ` [PATCH v3 " Derrick Stolee via GitGitGadget
2025-02-03 17:11 ` [PATCH v3 1/5] backfill: add builtin boilerplate Derrick Stolee via GitGitGadget
2025-02-03 17:11 ` [PATCH v3 2/5] backfill: basic functionality and tests Derrick Stolee via GitGitGadget
2025-02-03 17:11 ` [PATCH v3 3/5] backfill: add --min-batch-size=<n> option Derrick Stolee via GitGitGadget
2025-02-03 17:11 ` [PATCH v3 4/5] backfill: add --sparse option Derrick Stolee via GitGitGadget
2025-02-03 17:11 ` [PATCH v3 5/5] backfill: assume --sparse when sparse-checkout is enabled Derrick Stolee via GitGitGadget
2025-02-04 0:18 ` [PATCH v3 0/5] PATH WALK III: Add 'git backfill' command Junio C Hamano
2025-02-05 7:15 ` Patrick Steinhardt
2025-02-05 17:07 ` 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=34379f16-9da6-440b-8656-5d580056c36b@gmail.com \
--to=stolee@gmail.com \
--cc=christian.couder@gmail.com \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
--cc=johncai86@gmail.com \
--cc=jonathantanmy@google.com \
--cc=karthik.188@gmail.com \
--cc=kristofferhaugsbakk@fastmail.com \
--cc=me@ttaylorr.com \
--cc=newren@gmail.com \
--cc=peff@peff.net \
--cc=ps@pks.im \
/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).