Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fixes #415 - branch names mangled by color escapes #416
Branch names are mis-parsed if
Notably, option ordering is important in this instance. The "-c ..." option is a git
ref: Issue #415
Thanks for your contribution!
I'm surprised setting
Here is the relevant code
Yes, I was surprised that "color.ui=false" doesn't turn off all color output, as well. It may well be that it actually does turn off all color, but then is reversed by more specific overrides (such as "color.branch=always") at other configuration levels.
I, personally, have "color.branch=always", "color.diff=always", and "color.status=always" set at the global level, so that I can, by default, get colored output even for redirections (eg, to
Although this is the only issue that I'm encountering here, I do think that, ultimately, for robustness, all the verb specific color settings (branch, diff, interactive, status) should be set to "false" or "never" when parsing the
Notably, the config setting disabling color (eg, "-c color.branch=never") can be reversed by a later setting within the same command line turning it back on (eg, "-c color.branch=always"). So, being a bit more DRY and disabling them all centrally would be fine even if you want to receive colored output for some specific commands.
I don't know if there would be any performance penalty, but I doubt it given that most
I can refactor this PR to be more general and centrally place all of those config settings if you'd prefer.
While I'm slightly on the fence about centralizing them vs not. I think it might be better to keep them separate (i.e. associated with the specific command they apply to), just to keep the length of the command line down. So if you wouldn't mind adding the other settings to the relevant places I would be very grateful
I found three uses of 'diff' and two uses of 'status', and I modified the config options of all of them. All are using "false". But, FYI, I only looked for uses within "src/git/git.ts". It appeared that that was where everything was localized. Let me know if there are other areas to change.
The final result is working correctly for me.