Re: [PATCH v4 14/18] sha1_name.c: many short names can only be committish

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> diff --git a/sha1_name.c b/sha1_name.c
> index 6f6c49c..35ad473 100644
> --- a/sha1_name.c
> +++ b/sha1_name.c
> @@ -519,6 +539,7 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
>  	unsigned char outer[20];
>  	const char *sp;
>  	unsigned int expected_type = 0;
> +	unsigned lookup_flags;

This needs to be initialized to 0, i.e.

	unsigned lookup_flags = 0;

for the following two hunks to make sense.

> @@ -554,7 +575,10 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
>  	else
>  		return -1;
>  
> -	if (get_sha1_1(name, sp - name - 2, outer, 0))
> +	if (expected_type == OBJ_COMMIT)
> +		lookup_flags = GET_SHA1_COMMITTISH;
> +
> +	if (get_sha1_1(name, sp - name - 2, outer, lookup_flags))
>  		return -1;
>  
>  	o = parse_object(outer);
> @@ -666,7 +690,7 @@ static int get_sha1_1(const char *name, int len, unsigned char *sha1, unsigned l
>  	if (!ret)
>  		return 0;
>  
> -	return get_short_sha1(name, len, sha1, 0);
> +	return get_short_sha1(name, len, sha1, lookup_flags);
>  }
>  
>  /*
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]