From: Derrick Stolee <stolee@gmail.com>
To: Stefan Beller <sbeller@google.com>, dstolee@microsoft.com
Cc: git@vger.kernel.org, mhagger@alum.mit.edu
Subject: Re: [PATCH 2/2] refs.c: upgrade for_each_replace_ref to be a each_repo_ref_fn callback
Date: Wed, 18 Jul 2018 06:58:44 -0400 [thread overview]
Message-ID: <6c74aee8-2e18-99de-f775-dced1310809f@gmail.com> (raw)
In-Reply-To: <20180717224935.96397-3-sbeller@google.com>
On 7/17/2018 6:49 PM, Stefan Beller wrote:
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> builtin/replace.c | 3 ++-
> refs.c | 9 ++++-----
> refs.h | 2 +-
> replace-object.c | 3 ++-
> 4 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/builtin/replace.c b/builtin/replace.c
> index ef22d724bbc..5f34659071f 100644
> --- a/builtin/replace.c
> +++ b/builtin/replace.c
> @@ -39,7 +39,8 @@ struct show_data {
> enum replace_format format;
> };
>
> -static int show_reference(const char *refname, const struct object_id *oid,
> +static int show_reference(struct repository *r, const char *refname,
> + const struct object_id *oid,
> int flag, void *cb_data)
> {
> struct show_data *data = cb_data;
> diff --git a/refs.c b/refs.c
> index 2513f77acb3..5700cd4683f 100644
> --- a/refs.c
> +++ b/refs.c
> @@ -1478,12 +1478,11 @@ int refs_for_each_fullref_in(struct ref_store *refs, const char *prefix,
> return do_for_each_ref(refs, prefix, fn, 0, flag, cb_data);
> }
>
> -int for_each_replace_ref(struct repository *r, each_ref_fn fn, void *cb_data)
> +int for_each_replace_ref(struct repository *r, each_repo_ref_fn fn, void *cb_data)
> {
> - return do_for_each_ref(get_main_ref_store(r),
> - git_replace_ref_base, fn,
> - strlen(git_replace_ref_base),
> - DO_FOR_EACH_INCLUDE_BROKEN, cb_data);
> + return do_for_each_repo_ref(r, git_replace_ref_base, fn,
> + strlen(git_replace_ref_base),
> + DO_FOR_EACH_INCLUDE_BROKEN, cb_data);
> }
>
> int for_each_namespaced_ref(each_ref_fn fn, void *cb_data)
> diff --git a/refs.h b/refs.h
> index 80eec8bbc68..a0a18223a14 100644
> --- a/refs.h
> +++ b/refs.h
> @@ -317,7 +317,7 @@ int for_each_fullref_in(const char *prefix, each_ref_fn fn, void *cb_data,
> int for_each_tag_ref(each_ref_fn fn, void *cb_data);
> int for_each_branch_ref(each_ref_fn fn, void *cb_data);
> int for_each_remote_ref(each_ref_fn fn, void *cb_data);
> -int for_each_replace_ref(struct repository *r, each_ref_fn fn, void *cb_data);
> +int for_each_replace_ref(struct repository *r, each_repo_ref_fn fn, void *cb_data);
> int for_each_glob_ref(each_ref_fn fn, const char *pattern, void *cb_data);
> int for_each_glob_ref_in(each_ref_fn fn, const char *pattern,
> const char *prefix, void *cb_data);
> diff --git a/replace-object.c b/replace-object.c
> index 801b5c16789..01a5a59a35a 100644
> --- a/replace-object.c
> +++ b/replace-object.c
> @@ -6,7 +6,8 @@
> #include "repository.h"
> #include "commit.h"
>
> -static int register_replace_ref(const char *refname,
> +static int register_replace_ref(struct repository *r,
> + const char *refname,
> const struct object_id *oid,
> int flag, void *cb_data)
> {
Overall, I think this is the right approach. The only problem is that
you're missing a few 'the_repository' to 'r' replacements in the bodies
of show_reference and register_replace_ref.
Thanks,
-Stolee
next prev parent reply other threads:[~2018-07-18 10:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-17 22:49 [PATCH 0/2] RFC ref store to repository migration Stefan Beller
2018-07-17 22:49 ` [PATCH 1/2] refs.c: migrate internal ref iteration to pass thru repository argument Stefan Beller
2018-07-17 22:49 ` [PATCH 2/2] refs.c: upgrade for_each_replace_ref to be a each_repo_ref_fn callback Stefan Beller
2018-07-18 10:58 ` Derrick Stolee [this message]
2018-07-18 17:07 ` Stefan Beller
2018-07-18 13:40 ` [PATCH] TO-SQUASH: replace the_repository with arbitrary r Derrick Stolee
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=6c74aee8-2e18-99de-f775-dced1310809f@gmail.com \
--to=stolee@gmail.com \
--cc=dstolee@microsoft.com \
--cc=git@vger.kernel.org \
--cc=mhagger@alum.mit.edu \
--cc=sbeller@google.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).