Re: [RFC/PATCH 2/9] ref-filter: implement '--points-at' option
On 06/08/2015 11:01 PM, Matthieu Moy wrote:
Show 31 quoted lines
> Karthik Nayak <karthik.188@gmail.com> writes:
>
>> +/*
>> + * Given a ref (sha1, refname) see if it points to a one of the sha1s
>> + * in a sha1_array.
>> + */
>> +static int match_points_at(struct sha1_array *points_at, const unsigned char *sha1,
>> + const char *refname)
>> +{
>> + struct object *obj;
>> +
>> + if (!points_at || !points_at->nr)
>> + return 1;
>> +
>> + if (sha1_array_lookup(points_at, sha1) >= 0)
>> + return 1;
>> +
>> + obj = parse_object_or_die(sha1, refname);
>> + if (obj->type == OBJ_TAG &&
>> + sha1_array_lookup(points_at, ((struct tag *)obj)->tagged->sha1) >= 0)
>> + return 1;
>> +
>> + return 0;
>> +}
>
> There's a similar function in builtin/tag.c that you are not removing.
> You should justify why you are doing this code duplication in the commit
> message (or not do code duplication). It might make sense to add a
> comment next to match_points_at in tag.c saying stg like "this is
> duplicated from ..., will be removed later".
>--
Regards,
Karthik