threads / discuss / 48252

Windows > git.exe > the result of "git branch" does not always highlight the current branch

Subject: Windows > git.exe > the result of "git branch" does not always highlight the current branch

## tl;dr

6 messages between Apr 9, 2018 and Apr 10, 2018.

replies: 5people: 4as markdown or json

Hari Lubovac· Apr 9, 2018, 19:26 UTC · lore

It appears to be just a reporting issue. Probably not a big deal, but I thought I should report this, if it hasn't been noticed: when a branch is switched to by being named with non-original character-casing, then it's not clear which branch is current.

Example:
C:\repo>git branch
* bar
  foo

C:\repo>git checkout Bar Switched to branch 'Bar'

C:\repo>git branch
  bar
  foo
Stefan Beller· Apr 9, 2018, 19:32 UTC · re: Hari Lubovac · lore

Re: Windows > git.exe > the result of "git branch" does not always highlight the current branch

Hi Hari,
thanks for reporting a bug!
On Mon, Apr 9, 2018 at 12:26 PM, Hari Lubovac <hlubovac@gmail.com> wrote:
Show 17 quoted lines
> It appears to be just a reporting issue. Probably not a big deal, but
> I thought I should report this, if it hasn't been noticed: when a
> branch is switched to by being named with non-original
> character-casing, then it's not clear which branch is current.
>
> Example:
>
> C:\repo>git branch
> * bar
>   foo
>
> C:\repo>git checkout Bar
> Switched to branch 'Bar'
>
> C:\repo>git branch
>   bar
>   foo

Is this Git compiled under Windows or Git-for-Windows as distributed by Johannes?

AFAICT Git-for-Windows prefers to have a bug on github https://github.com/git-for-windows/git/issues/new

Thanks, Stefan

Hari Lubovac· Apr 9, 2018, 20:06 UTC · re: Stefan Beller · lore

Re: Windows > git.exe > the result of "git branch" does not always highlight the current branch

I don't know which party compiled it. I'm pretty sure I downloaded the installer from https://git-scm.com/downloads, although it might have come shipped with Microsoft Visual Studio, which I use.

I forgot this detail earlier:

git --version git version 2.16.1.windows.2

I'm a little behind; maybe I should upgrade.

I just reported the same here: https://github.com/git-for-windows/git/issues/1623

On Mon, Apr 9, 2018 at 12:32 PM, Stefan Beller <sbeller@google.com> wrote:
Show 31 quoted lines
> Hi Hari,
>
> thanks for reporting a bug!
>
> On Mon, Apr 9, 2018 at 12:26 PM, Hari Lubovac <hlubovac@gmail.com> wrote:
>> It appears to be just a reporting issue. Probably not a big deal, but
>> I thought I should report this, if it hasn't been noticed: when a
>> branch is switched to by being named with non-original
>> character-casing, then it's not clear which branch is current.
>>
>> Example:
>>
>> C:\repo>git branch
>> * bar
>>   foo
>>
>> C:\repo>git checkout Bar
>> Switched to branch 'Bar'
>>
>> C:\repo>git branch
>>   bar
>>   foo
>
> Is this Git compiled under Windows or
> Git-for-Windows as distributed by Johannes?
>
> AFAICT Git-for-Windows prefers to have a bug on github
> https://github.com/git-for-windows/git/issues/new
>
> Thanks,
> Stefan
Johannes Schindelin· Apr 10, 2018, 06:30 UTC · re: Hari Lubovac · lore

Re: Windows > git.exe > the result of "git branch" does not always highlight the current branch

Hi Hari,
On Mon, 9 Apr 2018, Hari Lubovac wrote:
> I don't know which party compiled it. I'm pretty sure I downloaded the
> installer from https://git-scm.com/downloads, although it might have
> come shipped with Microsoft Visual Studio, which I use.
In both cases, this would be Git for Windows.
Show 6 quoted lines
> I forgot this detail earlier:
> 
> git --version
> git version 2.16.1.windows.2
> 
> I'm a little behind; maybe I should upgrade.

It is not quite *necessary* to upgrade, but you will get a couple nice new features and nice bug fixes.

But the bug you reported is still there ;-)
> I just reported the same here:
> https://github.com/git-for-windows/git/issues/1623

Thank you for opening this bug report. There are other bug reports describing related issues; they might even be covered by the same fixes.

Assuming that you are eager enough to see this fixed, I started describing how to go about building Git for Windows, where the code is located that need to be fixed, and how to go about fixing it.

Thanks, Johannes

Johannes Schindelin· Apr 10, 2018, 06:15 UTC · re: Stefan Beller · lore

Re: Windows > git.exe > the result of "git branch" does not always highlight the current branch

Hi Stefan,
On Mon, 9 Apr 2018, Stefan Beller wrote:
> AFAICT Git-for-Windows prefers to have a bug on github
> https://github.com/git-for-windows/git/issues/new

I try to follow Postel's Law for contributions and bug reports. If there is enough detail in the bug report on this here mailing list, that's good enough for me.

If details are missing, I frequently suggest to follow that link because some excellent contributors spent quality time on the issue reporting template, helping bug reporters to avoid incomplete reports.

Thanks, Johannes

Johannes Sixt· Apr 10, 2018, 05:20 UTC · re: Hari Lubovac · lore

Re: Windows > git.exe > the result of "git branch" does not always highlight the current branch

Am 09.04.2018 um 21:26 schrieb Hari Lubovac:
Show 17 quoted lines
> It appears to be just a reporting issue. Probably not a big deal, but
> I thought I should report this, if it hasn't been noticed: when a
> branch is switched to by being named with non-original
> character-casing, then it's not clear which branch is current.
> 
> Example:
> 
> C:\repo>git branch
> * bar
>    foo
> 
> C:\repo>git checkout Bar
> Switched to branch 'Bar'
> 
> C:\repo>git branch
>    bar
>    foo

The bug is not that the branch is not marked, but that you are permitted to check out a branch that does not exist. This is a side-effect of the fact that branch names are sometimes stored using file names, and, as we know, file names are case-insensitive on Windows. I don't know of any efforts to fix that (I assume that it is not just a simple fix). In the meantime, I can only recommend: if it hurts, don't do it.

If you call `git gc` before the checkout command, I would expect that you would not be able to check out branch 'Bar', because branches are represented unambiguously after 'gc' (not as file names).

-- Hannes

← back to recent threads