Re: [PATCH v5 2/3] upload-pack: prepare to extend allow-tip-sha1-in-want
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 21, 2015, 22:07 UTC
- Message-ID
- <xmqqpp5th9dy.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1432239819-21794-2-git-send-email-fredrik.medley@gmail.com>
Fredrik Medley <fredrik.medley@gmail.com> writes:
Show 23 quoted lines
> To allow future extensions, e.g. allowing non-tip sha1, replace the
> boolean allow_tip_sha1_in_want variable with the flag-style
> allow_request_with_bare_object_name variable.
>
> Signed-off-by: Fredrik Medley <fredrik.medley@gmail.com>
> ---
> fetch-pack.c | 9 ++++++---
> upload-pack.c | 20 +++++++++++++-------
> 2 files changed, 19 insertions(+), 10 deletions(-)
>
> diff --git a/fetch-pack.c b/fetch-pack.c
> index 48526aa..699f586 100644
> --- a/fetch-pack.c
> +++ b/fetch-pack.c
> @@ -43,7 +43,10 @@ static int marked;
> #define MAX_IN_VAIN 256
>
> static struct prio_queue rev_list = { compare_commits_by_commit_date };
> -static int non_common_revs, multi_ack, use_sideband, allow_tip_sha1_in_want;
> +static int non_common_revs, multi_ack, use_sideband;
> +/* Allow specifying sha1 if it is a ref tip. */
> +#define ALLOW_TIP_SHA1 01
> +static int allow_unadvertised_object_request;It is better to use "unsigned int" for these bit masks, as we are not interested in the top-most bit getting special-cased by using a signed type. I'll amend this (and the one in upload-pack.c) while applying, so no need to resend only to correct these two, unless you have other reasons to reroll.
Thanks.
Show 12 quoted lines
> diff --git a/upload-pack.c b/upload-pack.c > index 745fda8..726486b 100644 > --- a/upload-pack.c > +++ b/upload-pack.c > @@ -35,7 +35,9 @@ static int multi_ack; > static int no_done; > static int use_thin_pack, use_ofs_delta, use_include_tag; > static int no_progress, daemon_mode; > -static int allow_tip_sha1_in_want; > +/* Allow specifying sha1 if it is a ref tip. */ > +#define ALLOW_TIP_SHA1 01 > +static int allow_unadvertised_object_request;