diff mbox series

[v2,1/8] fetch-negotiator: add specific noop initializor

Message ID d146d8aaaafee91de2e7c50b3a598a470319b541.1645719218.git.gitgitgadget@gmail.com (mailing list archive)
State Superseded
Headers show
Series fetch: add repair: full refetch without negotiation (was: "refiltering") | expand

Commit Message

Robert Coup Feb. 24, 2022, 4:13 p.m. UTC
From: Robert Coup <robert@coup.net.nz>

Add a specific initializor for the noop fetch negotiator. This is
introduced to support allowing partial clones to skip commit negotiation
when fetching to repair or apply a modified filter.

Signed-off-by: Robert Coup <robert@coup.net.nz>
---
 fetch-negotiator.c | 5 +++++
 fetch-negotiator.h | 8 ++++++++
 2 files changed, 13 insertions(+)

Comments

Junio C Hamano Feb. 25, 2022, 6:19 a.m. UTC | #1
"Robert Coup via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Robert Coup <robert@coup.net.nz>
>
> Add a specific initializor for the noop fetch negotiator. This is

"initializer"?

> introduced to support allowing partial clones to skip commit negotiation
> when fetching to repair or apply a modified filter.
>
> Signed-off-by: Robert Coup <robert@coup.net.nz>
> ---
>  fetch-negotiator.c | 5 +++++
>  fetch-negotiator.h | 8 ++++++++
>  2 files changed, 13 insertions(+)
>
> diff --git a/fetch-negotiator.c b/fetch-negotiator.c
> index 874797d767b..be383367f55 100644
> --- a/fetch-negotiator.c
> +++ b/fetch-negotiator.c
> @@ -23,3 +23,8 @@ void fetch_negotiator_init(struct repository *r,
>  		return;
>  	}
>  }
> +
> +void fetch_negotiator_init_noop(struct fetch_negotiator *negotiator)
> +{
> +	noop_negotiator_init(negotiator);
> +}

Puzzling.  What makes this better than allowing noop-negotiator-init
to be called directly?

> diff --git a/fetch-negotiator.h b/fetch-negotiator.h
> index ea78868504b..e348905a1f0 100644
> --- a/fetch-negotiator.h
> +++ b/fetch-negotiator.h
> @@ -53,7 +53,15 @@ struct fetch_negotiator {
>  	void *data;
>  };
>  
> +/*
> + * Initialize a negotiator based on the repository settings.
> + */
>  void fetch_negotiator_init(struct repository *r,
>  			   struct fetch_negotiator *negotiator);
>  
> +/*
> + * Initialize a noop negotiator.
> + */
> +void fetch_negotiator_init_noop(struct fetch_negotiator *negotiator);
> +
>  #endif
Robert Coup Feb. 28, 2022, 12:22 p.m. UTC | #2
Hi,

On Fri, 25 Feb 2022 at 06:19, Junio C Hamano <gitster@pobox.com> wrote:
>
> > Add a specific initializor for the noop fetch negotiator. This is
>
> "initializer"?

Thanks. A poor translation effort to American English ;-)

> > +
> > +void fetch_negotiator_init_noop(struct fetch_negotiator *negotiator)
> > +{
> > +     noop_negotiator_init(negotiator);
> > +}
>
> Puzzling.  What makes this better than allowing noop-negotiator-init
> to be called directly?

Is simply for naming/API consistency with the regular method. Happy to
call noop_negotiator_init() if you prefer?

Rob :)
diff mbox series

Patch

diff --git a/fetch-negotiator.c b/fetch-negotiator.c
index 874797d767b..be383367f55 100644
--- a/fetch-negotiator.c
+++ b/fetch-negotiator.c
@@ -23,3 +23,8 @@  void fetch_negotiator_init(struct repository *r,
 		return;
 	}
 }
+
+void fetch_negotiator_init_noop(struct fetch_negotiator *negotiator)
+{
+	noop_negotiator_init(negotiator);
+}
diff --git a/fetch-negotiator.h b/fetch-negotiator.h
index ea78868504b..e348905a1f0 100644
--- a/fetch-negotiator.h
+++ b/fetch-negotiator.h
@@ -53,7 +53,15 @@  struct fetch_negotiator {
 	void *data;
 };
 
+/*
+ * Initialize a negotiator based on the repository settings.
+ */
 void fetch_negotiator_init(struct repository *r,
 			   struct fetch_negotiator *negotiator);
 
+/*
+ * Initialize a noop negotiator.
+ */
+void fetch_negotiator_init_noop(struct fetch_negotiator *negotiator);
+
 #endif