-
Notifications
You must be signed in to change notification settings - Fork 533
add --no-color option to commands like git log #30
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
Milestone
Comments
+1 affected The error also occures when at all other commands. if you have Greetings Sven |
I've started work on a fix: |
Fixed by #48 |
mhoyer
added a commit
to mhoyer/ruby-git
that referenced
this issue
Nov 8, 2019
### `current_branch` contains color escape codes Similar to ruby-git#30 I just found an issue with `ruby-git` when trying to match the string returned from `current_branch` with e.g. `"master"`. I just recently found this issue and I guess it's related to a recent update of my `git` on my machine which came in just recently. ### Your environment * `git@2.24.0.windows.2` * `ruby-git@1.5.0` (also had `1.3.0` before - same issue) * `ruby@2.3.1p112 (2016-04-26 revision 54768) [i386-mingw32]` ### Steps to reproduce ```ruby $ irb irb(main):002:0> require 'git'; git = Git.open '.'; git.current_branch master => "\e[32mmaster\e[m" ``` Hence, `"\e[32mmaster\e[m"` is not equal to `"master"`. ### Expected behaviour `git.current_branch` should return the string of the current branch without coloring. In fact, the underlying run of `git branch` should include `--no-color` option (which is a nested call inside `branches_all`). ### Actual behaviour `git.current_branch` contains `"\e[32m"` color escape codes.
3 tasks
mhoyer
added a commit
to mhoyer/ruby-git
that referenced
this issue
Nov 11, 2019
Similar to ruby-git#30 I just found an issue with `ruby-git` when trying to match the string returned from `current_branch` with e.g. `"master"`. I just recently found this issue and I guess it's related to a recent update of my `git` on my machine which came in just recently. * `git@2.24.0.windows.2` * `ruby-git@1.5.0` (also had `1.3.0` before - same issue) * `ruby@2.3.1p112 (2016-04-26 revision 54768) [i386-mingw32]` ```ruby $ irb irb(main):002:0> require 'git'; git = Git.open '.'; git.current_branch master => "\e[32mmaster\e[m" ``` Hence, `"\e[32mmaster\e[m"` is not equal to `"master"`. `git.current_branch` should return the string of the current branch without coloring. In fact, the underlying run of `git branch` should include `--no-color` option (which is a nested call inside `branches_all`). `git.current_branch` contains `"\e[32m"` color escape codes. Signed-off-by: Marcel Hoyer <m.hoyer@cid.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I get following errors on linux with git version 1.7.4.1 and ruby-git gem version 1.2.5 when color ui is set to always.
Solution is to add --no-color option to git commands like git log or git diff, so that color tags like '\e[43m' are not included in data being processed.
The text was updated successfully, but these errors were encountered: