Re: [PATCH v2 3/3] ref-filter: populate symref from iterator

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

>> @@ -2852,6 +2852,8 @@ static struct ref_array_item *apply_ref_filter(const char *refname, const struct
>>  	ref->commit = commit;
>>  	ref->flag = flag;
>>  	ref->kind = kind;
>> +	if (flag & REF_ISSYMREF)
>> +		ref->symref = xstrdup_or_null(referent);
>>  
>>  	return ref;
>>  }
>
> What is curious is that we do not lose any code from
> populate_value() with this change.
>
> Is that because of this piece of code near the beginning of it?
>
> 	CALLOC_ARRAY(ref->value, used_atom_cnt);
>
> 	if (need_symref && (ref->flag & REF_ISSYMREF) && !ref->symref) {
> 		ref->symref = refs_resolve_refdup(get_main_ref_store(the_repository),
> 						  ref->refname,
> 						  RESOLVE_REF_READING,
> 						  NULL, NULL);
> 		if (!ref->symref)
> 			ref->symref = xstrdup("");
> 	}
>
> That is, if we somehow know the value of ref->symref for a ref that
> is known to be a symbolic ref (and when we know we need symref
> information in the output), we do not bother calling refs_resolve
> here to obtain the value.

I forgot to ask the real question.  With your change in place, does
this "lazily fill ref->symref if it hasn't been discovered yet" code
still trigger?  Under what condition?  Or is this now a dead code?

Thanks.





[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]

  Powered by Linux