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 · 1 comment
Closed

Branch names get mangled by color escapes #415

rivy opened this issue Jun 14, 2018 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@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
- 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 gitkraken#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 bug Something isn't working label Jun 19, 2018
@eamodio eamodio added this to the Soon™ milestone Jun 19, 2018
@eamodio eamodio removed this from the Soon™ milestone Jul 19, 2019
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants