From: Junio C Hamano <gitster@pobox.com>
To: "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, stolee@gmail.com, avarab@gmail.com,
zhiyou.jx@alibaba-inc.com, jonathantanmy@google.com,
Derrick Stolee <derrickstolee@github.com>
Subject: Re: [PATCH 05/11] list-objects: consolidate traverse_commit_list[_filtered]
Date: Fri, 04 Mar 2022 14:30:06 -0800 [thread overview]
Message-ID: <xmqqzgm5xsep.fsf@gitster.g> (raw)
In-Reply-To: <ec57ed5c37fdcb9fe31a16a09178642a5c219115.1645638911.git.gitgitgadget@gmail.com> (Derrick Stolee via GitGitGadget's message of "Wed, 23 Feb 2022 17:55:05 +0000")
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: Derrick Stolee <derrickstolee@github.com>
>
> Now that all consumers of traverse_commit_list_filtered() populate the
> 'filter' member of 'struct rev_info', we can drop that parameter from
> the method prototype to simplify things. In addition, the only thing
> different now between traverse_commit_list_filtered() and
> traverse_commit_list() is the presence of the 'omitted' parameter, which
> is only non-NULL for one caller. We can consolidate these two methods by
> having one call the other and use the simpler form everywhere the
> 'omitted' paramter would be NULL.
Nice. Modulo "paramter" -> "parameter".
>
> Signed-off-by: Derrick Stolee <derrickstolee@github.com>
> ---
> builtin/pack-objects.c | 6 +++---
> builtin/rev-list.c | 2 +-
> list-objects.c | 25 ++++++++-----------------
> list-objects.h | 12 ++++++++++--
> pack-bitmap.c | 6 +++---
> 5 files changed, 25 insertions(+), 26 deletions(-)
>
> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> index 57f2cf49696..0432ae1e499 100644
> --- a/builtin/pack-objects.c
> +++ b/builtin/pack-objects.c
> @@ -3778,9 +3778,9 @@ static void get_object_list(int ac, const char **av)
>
> if (!fn_show_object)
> fn_show_object = show_object;
> - traverse_commit_list_filtered(revs.filter, &revs,
> - show_commit, fn_show_object, NULL,
> - NULL);
> + traverse_commit_list(&revs,
> + show_commit, fn_show_object,
> + NULL);
>
> if (unpack_unreachable_expiration) {
> revs.ignore_missing_links = 1;
> diff --git a/builtin/rev-list.c b/builtin/rev-list.c
> index 556e78aebb9..3ab727817fd 100644
> --- a/builtin/rev-list.c
> +++ b/builtin/rev-list.c
> @@ -733,7 +733,7 @@ int cmd_rev_list(int argc, const char **argv, const char *prefix)
> oidset_init(&missing_objects, DEFAULT_OIDSET_SIZE);
>
> traverse_commit_list_filtered(
> - revs.filter, &revs, show_commit, show_object, &info,
> + &revs, show_commit, show_object, &info,
> (arg_print_omitted ? &omitted_objects : NULL));
>
> if (arg_print_omitted) {
> diff --git a/list-objects.c b/list-objects.c
> index 2f623f82115..9422625b39e 100644
> --- a/list-objects.c
> +++ b/list-objects.c
> @@ -416,22 +416,7 @@ static void do_traverse(struct traversal_context *ctx)
> strbuf_release(&csp);
> }
>
> -void traverse_commit_list(struct rev_info *revs,
> - show_commit_fn show_commit,
> - show_object_fn show_object,
> - void *show_data)
> -{
> - struct traversal_context ctx;
> - ctx.revs = revs;
> - ctx.show_commit = show_commit;
> - ctx.show_object = show_object;
> - ctx.show_data = show_data;
> - ctx.filter = NULL;
> - do_traverse(&ctx);
> -}
> -
> void traverse_commit_list_filtered(
> - struct list_objects_filter_options *filter_options,
> struct rev_info *revs,
> show_commit_fn show_commit,
> show_object_fn show_object,
> @@ -444,7 +429,13 @@ void traverse_commit_list_filtered(
> ctx.show_object = show_object;
> ctx.show_commit = show_commit;
> ctx.show_data = show_data;
> - ctx.filter = list_objects_filter__init(omitted, filter_options);
> + if (revs->filter)
> + ctx.filter = list_objects_filter__init(omitted, revs->filter);
> + else
> + ctx.filter = NULL;
> +
> do_traverse(&ctx);
> - list_objects_filter__free(ctx.filter);
> +
> + if (ctx.filter)
> + list_objects_filter__free(ctx.filter);
> }
> diff --git a/list-objects.h b/list-objects.h
> index a952680e466..9eaf4de8449 100644
> --- a/list-objects.h
> +++ b/list-objects.h
> @@ -7,7 +7,6 @@ struct rev_info;
>
> typedef void (*show_commit_fn)(struct commit *, void *);
> typedef void (*show_object_fn)(struct object *, const char *, void *);
> -void traverse_commit_list(struct rev_info *, show_commit_fn, show_object_fn, void *);
>
> typedef void (*show_edge_fn)(struct commit *);
> void mark_edges_uninteresting(struct rev_info *revs,
> @@ -18,11 +17,20 @@ struct oidset;
> struct list_objects_filter_options;
>
> void traverse_commit_list_filtered(
> - struct list_objects_filter_options *filter_options,
> struct rev_info *revs,
> show_commit_fn show_commit,
> show_object_fn show_object,
> void *show_data,
> struct oidset *omitted);
>
> +static inline void traverse_commit_list(
> + struct rev_info *revs,
> + show_commit_fn show_commit,
> + show_object_fn show_object,
> + void *show_data)
> +{
> + traverse_commit_list_filtered(revs, show_commit,
> + show_object, show_data, NULL);
> +}
> +
> #endif /* LIST_OBJECTS_H */
> diff --git a/pack-bitmap.c b/pack-bitmap.c
> index 613f2797cdf..cbefaedbf43 100644
> --- a/pack-bitmap.c
> +++ b/pack-bitmap.c
> @@ -822,9 +822,9 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git,
> show_data.bitmap_git = bitmap_git;
> show_data.base = base;
>
> - traverse_commit_list_filtered(revs->filter, revs,
> - show_commit, show_object,
> - &show_data, NULL);
> + traverse_commit_list(revs,
> + show_commit, show_object,
> + &show_data);
>
> revs->include_check = NULL;
> revs->include_check_obj = NULL;
next prev parent reply other threads:[~2022-03-04 22:30 UTC|newest]
Thread overview: 114+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 17:55 [PATCH 00/11] Partial bundles Derrick Stolee via GitGitGadget
2022-02-23 17:55 ` [PATCH 01/11] index-pack: document and test the --promisor option Derrick Stolee via GitGitGadget
2022-02-23 17:55 ` [PATCH 02/11] revision: put object filter into struct rev_info Derrick Stolee via GitGitGadget
2022-03-04 22:15 ` Junio C Hamano
2022-03-07 13:59 ` Derrick Stolee
2022-03-07 16:46 ` Junio C Hamano
2022-02-23 17:55 ` [PATCH 03/11] pack-objects: use rev.filter when possible Derrick Stolee via GitGitGadget
2022-03-04 22:25 ` Junio C Hamano
2022-02-23 17:55 ` [PATCH 04/11] pack-bitmap: drop filter in prepare_bitmap_walk() Derrick Stolee via GitGitGadget
2022-03-04 22:26 ` Junio C Hamano
2022-02-23 17:55 ` [PATCH 05/11] list-objects: consolidate traverse_commit_list[_filtered] Derrick Stolee via GitGitGadget
2022-03-04 22:30 ` Junio C Hamano [this message]
2022-02-23 17:55 ` [PATCH 06/11] MyFirstObjectWalk: update recommended usage Derrick Stolee via GitGitGadget
2022-03-04 22:33 ` Junio C Hamano
2022-03-07 14:05 ` Derrick Stolee
2022-03-07 16:47 ` Junio C Hamano
2022-02-23 17:55 ` [PATCH 07/11] bundle: safely handle --objects option Derrick Stolee via GitGitGadget
2022-02-28 16:00 ` Jeff Hostetler
2022-03-04 22:58 ` Junio C Hamano
2022-03-07 14:09 ` Derrick Stolee
2022-03-04 22:57 ` Junio C Hamano
2022-03-07 15:35 ` Ævar Arnfjörð Bjarmason
2022-02-23 17:55 ` [PATCH 08/11] bundle: parse filter capability Derrick Stolee via GitGitGadget
2022-03-07 15:38 ` Ævar Arnfjörð Bjarmason
2022-03-07 16:14 ` Derrick Stolee
2022-03-07 16:22 ` Ævar Arnfjörð Bjarmason
2022-03-07 16:29 ` Derrick Stolee
2022-03-07 15:55 ` Ævar Arnfjörð Bjarmason
2022-02-23 17:55 ` [PATCH 09/11] rev-list: move --filter parsing into revision.c Derrick Stolee via GitGitGadget
2022-02-23 17:55 ` [PATCH 10/11] bundle: create filtered bundles Derrick Stolee via GitGitGadget
2022-03-04 23:35 ` Junio C Hamano
2022-03-07 14:14 ` Derrick Stolee
2022-03-07 16:49 ` Junio C Hamano
2022-03-07 15:44 ` Ævar Arnfjörð Bjarmason
2022-02-23 17:55 ` [PATCH 11/11] bundle: unbundle promisor packs Derrick Stolee via GitGitGadget
2022-03-04 23:43 ` Junio C Hamano
2022-03-07 14:48 ` Derrick Stolee
2022-03-07 16:56 ` Junio C Hamano
2022-03-07 18:57 ` Derrick Stolee
2022-03-07 19:40 ` Junio C Hamano
2022-03-07 19:49 ` Derrick Stolee
2022-03-07 19:54 ` Junio C Hamano
2022-03-07 20:20 ` Derrick Stolee
2022-03-07 21:35 ` Junio C Hamano
2022-03-07 15:47 ` Ævar Arnfjörð Bjarmason
2022-03-07 16:10 ` Derrick Stolee
2022-02-28 17:00 ` [PATCH 00/11] Partial bundles Jeff Hostetler
2022-02-28 17:54 ` Derrick Stolee
2022-03-01 18:03 ` Jeff Hostetler
2022-03-04 19:19 ` Derrick Stolee
2022-03-07 14:55 ` Ævar Arnfjörð Bjarmason
2022-03-07 14:59 ` Derrick Stolee
2022-03-07 21:50 ` [PATCH v2 00/12] " Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 01/12] index-pack: document and test the --promisor option Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 02/12] revision: put object filter into struct rev_info Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 03/12] pack-objects: use rev.filter when possible Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 04/12] pack-bitmap: drop filter in prepare_bitmap_walk() Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 05/12] list-objects: consolidate traverse_commit_list[_filtered] Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 06/12] MyFirstObjectWalk: update recommended usage Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 07/12] bundle: safely handle --objects option Derrick Stolee via GitGitGadget
2022-03-08 9:37 ` Ævar Arnfjörð Bjarmason
2022-03-08 13:45 ` Derrick Stolee
2022-03-08 13:53 ` Ævar Arnfjörð Bjarmason
2022-03-07 21:50 ` [PATCH v2 08/12] bundle: parse filter capability Derrick Stolee via GitGitGadget
2022-03-08 9:25 ` Ævar Arnfjörð Bjarmason
2022-03-08 13:43 ` Derrick Stolee
2022-03-07 21:50 ` [PATCH v2 09/12] rev-list: move --filter parsing into revision.c Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 10/12] bundle: create filtered bundles Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 11/12] bundle: unbundle promisor packs Derrick Stolee via GitGitGadget
2022-03-07 21:50 ` [PATCH v2 12/12] clone: fail gracefully when cloning filtered bundle Derrick Stolee via GitGitGadget
2022-03-07 22:11 ` [PATCH v2 00/12] Partial bundles Junio C Hamano
2022-03-08 14:39 ` [PATCH v3 " Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 01/12] index-pack: document and test the --promisor option Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 02/12] revision: put object filter into struct rev_info Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 03/12] pack-objects: use rev.filter when possible Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 04/12] pack-bitmap: drop filter in prepare_bitmap_walk() Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 05/12] list-objects: consolidate traverse_commit_list[_filtered] Derrick Stolee via GitGitGadget
2022-03-09 13:24 ` Ævar Arnfjörð Bjarmason
2022-03-08 14:39 ` [PATCH v3 06/12] MyFirstObjectWalk: update recommended usage Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 07/12] list-objects: handle NULL function pointers Ævar Arnfjörð Bjarmason via GitGitGadget
2022-03-08 17:26 ` Junio C Hamano
2022-03-09 13:40 ` Ævar Arnfjörð Bjarmason
2022-03-09 14:16 ` Derrick Stolee
2022-03-09 18:32 ` Junio C Hamano
2022-03-08 14:39 ` [PATCH v3 08/12] bundle: parse filter capability Derrick Stolee via GitGitGadget
2022-03-08 17:29 ` Junio C Hamano
2022-03-09 14:35 ` Derrick Stolee
2022-03-09 13:30 ` Ævar Arnfjörð Bjarmason
2022-03-08 14:39 ` [PATCH v3 09/12] rev-list: move --filter parsing into revision.c Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 10/12] bundle: create filtered bundles Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 11/12] bundle: unbundle promisor packs Derrick Stolee via GitGitGadget
2022-03-08 14:39 ` [PATCH v3 12/12] clone: fail gracefully when cloning filtered bundle Derrick Stolee via GitGitGadget
2022-03-08 16:10 ` Derrick Stolee
2022-03-08 17:19 ` Junio C Hamano
2022-03-09 16:01 ` [PATCH v4 00/13] Partial bundles Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 01/13] index-pack: document and test the --promisor option Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 02/13] list-objects-filter-options: create copy helper Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 03/13] revision: put object filter into struct rev_info Derrick Stolee via GitGitGadget
2022-03-09 18:48 ` Junio C Hamano
2022-03-09 16:01 ` [PATCH v4 04/13] pack-objects: use rev.filter when possible Derrick Stolee via GitGitGadget
2022-03-10 13:11 ` Ævar Arnfjörð Bjarmason
2022-03-10 13:33 ` Derrick Stolee
2022-03-10 14:24 ` Ævar Arnfjörð Bjarmason
2022-03-09 16:01 ` [PATCH v4 05/13] pack-bitmap: drop filter in prepare_bitmap_walk() Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 06/13] list-objects: consolidate traverse_commit_list[_filtered] Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 07/13] MyFirstObjectWalk: update recommended usage Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 08/13] list-objects: handle NULL function pointers Ævar Arnfjörð Bjarmason via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 09/13] bundle: parse filter capability Derrick Stolee via GitGitGadget
2022-03-09 18:41 ` Junio C Hamano
2022-03-09 18:55 ` Derrick Stolee
2022-03-09 16:01 ` [PATCH v4 10/13] rev-list: move --filter parsing into revision.c Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 11/13] bundle: create filtered bundles Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 12/13] bundle: unbundle promisor packs Derrick Stolee via GitGitGadget
2022-03-09 16:01 ` [PATCH v4 13/13] clone: fail gracefully when cloning filtered bundle Derrick Stolee via GitGitGadget
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqzgm5xsep.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=avarab@gmail.com \
--cc=derrickstolee@github.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=jonathantanmy@google.com \
--cc=stolee@gmail.com \
--cc=zhiyou.jx@alibaba-inc.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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).