git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Guillaume Wenzek <guillaume.wenzek@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Karthik Nayak <karthik.188@gmail.com>, git@vger.kernel.org
Subject: Re: BUG Report: git branch ignore --no-abbrev flag
Date: Thu, 9 Mar 2017 10:44:42 +0100	[thread overview]
Message-ID: <CAAvNd=gAvONS-XP2vOLExdWiwDXTPbB5beiXikwdig7xC5OKow@mail.gmail.com> (raw)
In-Reply-To: <xmqqzigv1lc3.fsf@gitster.mtv.corp.google.com>

Thanks for looking into it,

The full version number is "2.12.0.246.ga2ecc84866" but I don't think
that's an official number, I'm using my company (Google) apt
repository.

The git package date is 2017/03/03 while previous version was from
2017/02/16, the commit you identified is actually between the two, so
that may be it.

On 8 March 2017 at 22:59, Junio C Hamano <gitster@pobox.com> wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Guillaume Wenzek <guillaume.wenzek@gmail.com> writes:
>>
>>> After updating to git 2.12.0 on Monday I noticed that the "git branch"
>>> wasn't behaving as usual.
>>
>> Are you sure you are trying 2.12?  v2.12.0 and before should behave
>> the same way and honor --no-abbrev as far as I know.
>>
>> On the other hand, 'master' has 93e8cd8b ("Merge branch
>> 'kn/ref-filter-branch-list'", 2017-02-27), which seems to introduce
>> the regression.
>>
>> Karthik?
>
> I haven't fully checked if filter.abbrev is set correctly, but I
> noticed the output format is formulated without taking the value of
> filter.abbrev into account at all, so this is an attempt to fix
> that omission.
>
> I also notice that filter.abbrev is _ONLY_ used by builtin/branch.c and
> the actual ref-filter code does not have to know anything about it.
>
> We probably should eliminate filter.abbrev field from the structure
> and use a regular variable in builtin/branch.c and use it to pass
> the result of command line parsing from cmd_branch() down to
> build_format() as an argument.
>
> But that is outside the scope of regression fix.
>
>
>  builtin/branch.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/builtin/branch.c b/builtin/branch.c
> index cbaa6d03c0..537c47811a 100644
> --- a/builtin/branch.c
> +++ b/builtin/branch.c
> @@ -335,9 +335,18 @@ static char *build_format(struct ref_filter *filter, int maxwidth, const char *r
>                     branch_get_color(BRANCH_COLOR_CURRENT));
>
>         if (filter->verbose) {
> +               struct strbuf obname = STRBUF_INIT;
> +
> +               if (filter->abbrev < 0)
> +                       strbuf_addf(&obname, "%%(objectname:short)");
> +               else if (!filter->abbrev)
> +                       strbuf_addf(&obname, "%%(objectname)");
> +               else
> +                       strbuf_addf(&obname, " %%(objectname:short=%d) ", filter->abbrev);
> +
>                 strbuf_addf(&local, "%%(align:%d,left)%%(refname:lstrip=2)%%(end)", maxwidth);
>                 strbuf_addf(&local, "%s", branch_get_color(BRANCH_COLOR_RESET));
> -               strbuf_addf(&local, " %%(objectname:short=7) ");
> +               strbuf_addf(&local, " %s ", obname.buf);
>
>                 if (filter->verbose > 1)
>                         strbuf_addf(&local, "%%(if)%%(upstream)%%(then)[%s%%(upstream:short)%s%%(if)%%(upstream:track)"
> @@ -346,10 +355,12 @@ static char *build_format(struct ref_filter *filter, int maxwidth, const char *r
>                 else
>                         strbuf_addf(&local, "%%(if)%%(upstream:track)%%(then)%%(upstream:track) %%(end)%%(contents:subject)");
>
> -               strbuf_addf(&remote, "%s%%(align:%d,left)%s%%(refname:lstrip=2)%%(end)%s%%(if)%%(symref)%%(then) -> %%(symref:short)"
> -                           "%%(else) %%(objectname:short=7) %%(contents:subject)%%(end)",
> +               strbuf_addf(&remote, "%s%%(align:%d,left)%s%%(refname:lstrip=2)%%(end)%s"
> +                           "%%(if)%%(symref)%%(then) -> %%(symref:short)"
> +                           "%%(else) %s %%(contents:subject)%%(end)",
>                             branch_get_color(BRANCH_COLOR_REMOTE), maxwidth, quote_literal_for_format(remote_prefix),
> -                           branch_get_color(BRANCH_COLOR_RESET));
> +                           branch_get_color(BRANCH_COLOR_RESET), obname.buf);
> +               strbuf_release(&obname);
>         } else {
>                 strbuf_addf(&local, "%%(refname:lstrip=2)%s%%(if)%%(symref)%%(then) -> %%(symref:short)%%(end)",
>                             branch_get_color(BRANCH_COLOR_RESET));

  parent reply	other threads:[~2017-03-09 10:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-08 18:14 BUG Report: git branch ignore --no-abbrev flag Guillaume Wenzek
2017-03-08 18:33 ` Junio C Hamano
2017-03-08 21:59   ` Junio C Hamano
2017-03-08 22:16     ` [PATCH] branch: honor --abbrev/--no-abbrev in --list mode Junio C Hamano
2017-03-09 13:25       ` Jakub Narębski
2017-03-10 16:45         ` Junio C Hamano
2017-03-09  9:44     ` Guillaume Wenzek [this message]
2017-03-09 10:38       ` BUG Report: git branch ignore --no-abbrev flag Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAvNd=gAvONS-XP2vOLExdWiwDXTPbB5beiXikwdig7xC5OKow@mail.gmail.com' \
    --to=guillaume.wenzek@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=karthik.188@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).