Re: [PATCH v5 3/8] branch: roll show_detached HEAD into regular ref_list
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Sep 20, 2015, 19:11 UTC
- Message-ID
- <vpqmvwggb2j.fsf@anie.imag.fr>
- In-Reply-To
- <1442772627-25421-4-git-send-email-Karthik.188@gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
Show 14 quoted lines
> @@ -681,14 +684,12 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
>
> qsort(ref_list.list, ref_list.index, sizeof(struct ref_item), ref_cmp);
>
> - detached = (detached && (kinds & REF_LOCAL_BRANCH));
> - if (detached && match_patterns(pattern, "HEAD"))
> - show_detached(&ref_list, maxwidth);
> -
> for (i = 0; i < ref_list.index; i++) {
> - int current = !detached &&
> - (ref_list.list[i].kind == REF_LOCAL_BRANCH) &&
> + int current = !detached && (ref_list.list[i].kind == REF_LOCAL_BRANCH) &&
> !strcmp(ref_list.list[i].name, head);
> + /* If detached the first ref_item is the current ref */This relies on the fact that sorting (qsort above) did not move HEAD from its first position. This is OK, as we don't have a --sort option yet. Good.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/