Subject: Re: [PATCH 3/3] upload-pack: optionally allow fetching reachable sha1

From: Junio C Hamano <[email-masked]>
Date: Tue, 19 May 2015 15:06:15 -0700

Fredrik Medley <[email-masked]> writes:

> diff --git a/fetch-pack.c b/fetch-pack.c
> index 699f586..875b688 100644
> --- a/fetch-pack.c
> +++ b/fetch-pack.c
> @@ -45,7 +45,9 @@ static int marked;
>  static struct prio_queue rev_list = { compare_commits_by_commit_date };
>  static int non_common_revs, multi_ack, use_sideband;
>  /* Allow specifying sha1 if it is a ref tip. */
> -#define ALLOW_TIP_SHA1	01
> +#define ALLOW_TIP_SHA1		01

What is this change about?  You do not have to align value columns.

> -	if ((allow_unadvertised_object_request & ALLOW_TIP_SHA1)) {
> +	if ((allow_unadvertised_object_request & (ALLOW_TIP_SHA1 | ALLOW_REACHABLE_SHA1))) {

Perhaps wrap it like this?

	if ((allow_unadvertised_object_request &
            (ALLOW_TIP_SHA1 | ALLOW_REACHABLE_SHA1))) {

> @@ -444,7 +446,8 @@ static int get_common_commits(void)
>  
>  static int is_our_ref(struct object *o)
>  {
> -	int allow_hidden_ref = (allow_unadvertised_object_request & ALLOW_TIP_SHA1);
> +	int allow_hidden_ref = (allow_unadvertised_object_request &
> +		(ALLOW_TIP_SHA1 | ALLOW_REACHABLE_SHA1));

Good, but push that to even more right?

> @@ -793,6 +802,9 @@ static int upload_pack_config(const char *var, const char *value, void *unused)
>  	if (!strcmp("uploadpack.allowtipsha1inwant", var)) {
>  		if (git_config_bool(var, value))
>  			allow_unadvertised_object_request |= ALLOW_TIP_SHA1;
> +	} else if (!strcmp("uploadpack.allowreachablesha1inwant", var)) {
> +		if (git_config_bool(var, value))
> +			allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1;
>  	} else if (!strcmp("uploadpack.keepalive", var)) {
>  		keepalive = git_config_int(var, value);
>  		if (!keepalive)

Same issue as [2/3]

		...
	} else if (!strcmp("configVariable", var)) {
        	if (git_config_bool(var, value))
			value |= ALLOW_THIS;
		else
                	value &= ~ALLOW_THIS;
	} else if ...

should be OK.

Thanks.