On Tue, Apr 26, 2016 at 3:17 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Karthik Nayak <karthik.188@xxxxxxxxx> writes: > >> This is part of unification of the commands 'git tag -l, git branch -l >> and git for-each-ref'. This ports over branch.c to use ref-filter's >> printing options. >> >> Initially posted here: $(gmane/279226). It was decided that this series >> would follow up after refactoring ref-filter parsing mechanism, which >> is now merged into master (9606218b32344c5c756f7c29349d3845ef60b80c). >> >> v1 can be found here: $(gmane/288342) >> v2 can be found here: $(gmane/288863) >> v3 can be found here: $(gmane/290299) >> v4 can be found here: $(gmane/291106) >> >> Changes in this version (v5b): >> 1. Added the first patch of the series which was missing in v5. > > 2. Rebased on top of 'master', which includes > jk/branch-shortening-funny-symrefs. > >> Interdiff: >> >> diff --git a/builtin/branch.c b/builtin/branch.c >> index c9a2e5b..6847ac3 100644 >> --- a/builtin/branch.c >> +++ b/builtin/branch.c >> @@ -288,9 +288,11 @@ static int calc_maxwidth(struct ref_array *refs, int remote_bonus) >> >> skip_prefix(it->refname, "refs/heads/", &desc); >> skip_prefix(it->refname, "refs/remotes/", &desc); >> - if (it->kind == FILTER_REFS_DETACHED_HEAD) >> - w = strlen(get_head_description()); >> - else >> + if (it->kind == FILTER_REFS_DETACHED_HEAD) { >> + char *head_desc = get_head_description(); >> + w = strlen(head_desc); >> + free(head_desc); >> + } else >> w = utf8_strwidth(desc); > > Presumably w is computed here to be used later for some kind of > alignment? It is curious why we can assume that head_desc does not > need utf8_strwidth() here. Seems to be a bug, `get_head_description()` is susceptible to be changed due to translation and hence `utf8_strwidth()` would be a better candidate here rather than `strlen()`. Thanks. -- Regards, Karthik Nayak -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html