git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: 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 <stolee@gmail.com>,
	Derrick Stolee <derrickstolee@github.com>
Subject: Re: [PATCH v2 4/5] backfill: add --sparse option
Date: Thu, 16 Jan 2025 11:01:06 +0100	[thread overview]
Message-ID: <Z4jY4rELRYvS2gOk@pks.im> (raw)
In-Reply-To: <2723143afb397507cbc794375525c37497046dc2.1734712193.git.gitgitgadget@gmail.com>

On Fri, Dec 20, 2024 at 04:29:52PM +0000, Derrick Stolee via GitGitGadget wrote:
> diff --git a/path-walk.c b/path-walk.c
> index 136ec08fb0e..c7456a9c1c0 100644
> --- a/path-walk.c
> +++ b/path-walk.c
> @@ -12,6 +12,7 @@
>  #include "object.h"
>  #include "oid-array.h"
>  #include "prio-queue.h"
> +#include "repository.h"
>  #include "revision.h"
>  #include "string-list.h"
>  #include "strmap.h"
> @@ -173,6 +174,23 @@ static int add_tree_entries(struct path_walk_context *ctx,
>  		if (type == OBJ_TREE)
>  			strbuf_addch(&path, '/');
>  
> +		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`?

> diff --git a/t/helper/test-path-walk.c b/t/helper/test-path-walk.c
> index 7f2d409c5bc..61e845e5ec2 100644
> --- a/t/helper/test-path-walk.c
> +++ b/t/helper/test-path-walk.c
> @@ -65,7 +67,7 @@ static int emit_block(const char *path, struct oid_array *oids,
>  
>  int cmd__path_walk(int argc, const char **argv)
>  {
> -	int res;
> +	int res, stdin_pl = 0;
>  	struct rev_info revs = REV_INFO_INIT;
>  	struct path_walk_info info = PATH_WALK_INFO_INIT;
>  	struct path_walk_test_data data = { 0 };
> @@ -80,6 +82,8 @@ int cmd__path_walk(int argc, const char **argv)
>  			 N_("toggle inclusion of tree objects")),
>  		OPT_BOOL(0, "prune", &info.prune_all_uninteresting,
>  			 N_("toggle pruning of uninteresting paths")),
> +		OPT_BOOL(0, "stdin-pl", &stdin_pl,
> +			 N_("read a pattern list over stdin")),
>  		OPT_END(),
>  	};
>  

I was about to suggest giving this a more descriptive name, as it might
be confusing for anybody not intimately familiar with the code. But then
I noticed that this is part of the test helper, only, so it doesn't
matter as much. So feel free to ignore.

Patrick

  reply	other threads:[~2025-01-16 10:01 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 [this message]
2025-02-03 15:11       ` Derrick Stolee
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=Z4jY4rELRYvS2gOk@pks.im \
    --to=ps@pks.im \
    --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=stolee@gmail.com \
    /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).