From: Junio C Hamano Date: Thu, 13 Oct 2011 20:43:57 GMT Subject: Re: [PATCH 10/14] is_dup_ref(): extract function from sort_ref_list() Message-ID: <7v1uug4o6q.fsf@alter.siamese.dyndns.org> In-Reply-To: <1318492715-5931-11-git-send-email-mhagger@alum.mit.edu> mhagger@alum.mit.edu writes: > ... > @@ -94,15 +113,11 @@ static void sort_ref_array(struct ref_array *array) > > qsort(array->refs, array->nr, sizeof(*array->refs), ref_entry_cmp); > > - /* Remove any duplicates from the ref_array */ > + /* Remove any duplicates from the ref_list */ Eh... Also needs retitled. > for (; j < array->nr; j++) { > struct ref_entry *a = array->refs[i]; > struct ref_entry *b = array->refs[j]; > - if (!strcmp(a->name, b->name)) { > - if (hashcmp(a->sha1, b->sha1)) > - die("Duplicated ref, and SHA1s don't match: %s", > - a->name); > - warning("Duplicated ref: %s", a->name); > + if (is_dup_ref(a, b)) { > free(b); > continue; > }