From: Matthieu Moy Date: Sun, 13 Sep 2015 12:26:40 GMT Subject: Re: [PATCH v4 6/8] branch.c: use 'ref-filter' data structures Message-ID: In-Reply-To: <1442129035-31386-7-git-send-email-Karthik.188@gmail.com> Karthik Nayak writes: > /* Print detached HEAD before sorting and printing the rest */ > - if (detached) { > - print_ref_item(&ref_list.list[index - 1], maxwidth, verbose, abbrev, > - detached, remote_prefix); > - index -= 1; > + if (filter->kind & FILTER_REFS_DETACHED_HEAD) { > + print_ref_item(array.items[array.nr - 1], maxwidth, filter, remote_prefix); > + free_array_item(array.items[array.nr - 1]); > + array.nr--; Ah, this answers my previous remark: indeed, you are removing the element from the array completely after this patch. You may want to modify the previous patch to start doing it earlier, but I think it's not worth the trouble: I agree with the final state, only the intermediate state is suboptimal (but still acceptable to me at least). -- Matthieu Moy http://www-verimag.imag.fr/~moy/