sublime_merge icon indicating copy to clipboard operation
sublime_merge copied to clipboard

There are ANSI escape sequences in the command output

Open jfcherng opened this issue 5 years ago • 5 comments

Version info

  • OS: Win7 x64
  • Build: 2024

Description

There are ANSI escape sequences in the command output.

image

Steps to reproduce

Steps to reproduce the behavior:

  1. Set the following in gitconfig
    [pull]
    	rebase = true
    
  2. I just click the pull button image
  3. See the command output history

Let me know if more information needed.

Expected behavior

Remove them.

jfcherng avatar Jul 20 '20 02:07 jfcherng

Hi @jfcherng,

Thank you for reporting this issue.

I'm curious if you have any color configuration for. Do you have any of the color config values set? (See: https://git-scm.com/docs/git-config#Documentation/git-config.txt-coloradvice)

This information should be visible under the Sublime Merge debug information (Help > Debug Information) under the git config section.

Thanks, - Dylan

dpjohnst avatar Jul 21 '20 00:07 dpjohnst

Yes, for settings start with color. from the debug info:

color.branch=auto
color.diff=auto
color.diff-highlight.newhighlight=green bold 22
color.diff-highlight.newnormal=green bold
color.diff-highlight.oldhighlight=red bold 52
color.diff-highlight.oldnormal=red bold
color.diff.commit=227 bold
color.diff.frag=magenta bold
color.diff.meta=227
color.diff.new=green bold
color.diff.old=red bold
color.diff.whitespace=red reverse
color.interactive=true
color.status=auto
color.ui=true

jfcherng avatar Jul 21 '20 03:07 jfcherng

Hi @jfcherng,

Thanks for the response. I've noticed you have a few color values set to true rather than auto. I'd suggest changing these to auto, as Git will automatically strip the ANSI escape sequences from the output when outputting to Sublime Merge.

Let me know whether this resolves the issue for you.

Kind regards, - Dylan

dpjohnst avatar Jul 21 '20 08:07 dpjohnst

I have found the culprit. It's weird, but it does it.

To reproduce, simply have a global .gitconfig ONLY having the following content.

[pull]
	rebase = true

jfcherng avatar Jul 21 '20 09:07 jfcherng

I encounter this issue almost daily since we use several different linters via the git hooks. Our team needs coloring when running git commands through the console, so disabling colors globally is not an option.

I already considered using NO_COLOR , but some CLI tools do not support it.

I can make a donation if somebody fixes this in the upcoming Sublime Merge release. The fix seems to be trivial.

CleanShot 2024-03-03 at 21 20 45@2x

dreikanter avatar Mar 03 '24 14:03 dreikanter