From: Matthieu Moy Date: Mon, 08 Jun 2015 17:31:14 GMT Subject: Re: [RFC/PATCH 2/9] ref-filter: implement '--points-at' option Message-ID: In-Reply-To: <1433621052-5588-2-git-send-email-karthik.188@gmail.com> Karthik Nayak 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". -- Matthieu Moy http://www-verimag.imag.fr/~moy/