Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branch names get mangled by color escapes #415

Closed
rivy opened this Issue Jun 14, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@rivy
Copy link
Contributor

rivy commented Jun 14, 2018

  • GitLens Version: 8.3
  • VSCode Version: 1.24.0
  • OS Version: Microsoft Windows [Version 10.0.16299.431]

Description

branch names are displayed in mangled form with missing associated commits when git config contains "color.branch=always".

Steps to Reproduce

  1. enable branch colors on shell command line:

    git config --global color.branch always
    
  2. branch names displayed within the "Branches" section of the Gitlens explorer will contain color escape codes, eg, "[32mmaster[m", and will not show any contained commits.

Fix

Using the git global option "-c color.branch=never" will definitively disable color for the git branch command, fixing both issues.

Addressing possible concerns of generality... by researching the git online documentation and Wikipedia, the "-c ..." option appears to have been introduced somewhere between the 1.7.0 - 1.7.12.4 versions (being released in the Feb-2010 to Oct-2012 time frame).

ref: https://en.wikipedia.org/wiki/Git#Releases
ref: https://git-scm.com/docs/git/1.7.0
ref: https://git-scm.com/docs/git/1.7.12.4

PR #416 contains a fix.

Note: the fix has only been tested on my machine.

rivy added a commit to rivy/vscode-gitlens that referenced this issue Jun 14, 2018

rivy added a commit to rivy/vscode-gitlens that referenced this issue Jun 14, 2018

Fixes eamodio#415 - branch names mangled by color escapes
- add "-c color.branch=never" option to git branch commands, definitively disabling color branch output

.# Discussion

Branch names are mis-parsed if `git branch` output is colored (eg, when git is configured
with "config.branch=always"). Using the base "-c color.branch=never" option overrides any
user configuration, displaying git branch output as uncolored in all cases and fixing the
issue.

Notably, option ordering is important in this instance. The "-c ..." option is a git
base option, not a git branch subcommand option. So, as done here, it must be inserted
before the "branch" subcommand.

ref: Issue eamodio#415

@eamodio eamodio changed the title branch names mangled by color escapes Branch names get mangled by color escapes Jun 17, 2018

@eamodio eamodio added the type: bug label Jun 19, 2018

@eamodio eamodio added this to the Soon™ milestone Jun 19, 2018

@eamodio eamodio closed this in 3991f4a Jun 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.