From 8cf8c4798dabe8ce5434bb2b154edd3afdfd0b5c Mon Sep 17 00:00:00 2001 From: Henry Bissonnette Date: Mon, 2 Feb 2015 17:12:53 -0600 Subject: [PATCH 1/3] Prevent git from using color in git branch --- lib/git/lib.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git/lib.rb b/lib/git/lib.rb index a0c25de6..b1e3a65c 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -299,7 +299,7 @@ def change_head_branch(branch_name) def branches_all arr = [] - command_lines('branch', '-a').each do |b| + command_lines('branch', ['-a', '--no-color']).each do |b| current = (b[0, 2] == '* ') arr << [b.gsub('* ', '').strip, current] end From ba0072d0673c5e728eac77a8680acdbad3ec040f Mon Sep 17 00:00:00 2001 From: Robb Broome Date: Mon, 19 Dec 2016 10:25:58 -0600 Subject: [PATCH 2/3] Compatibility with steno logger. Don't log if there is nothing to log. Steno logger raises if this is the case. In the case where you are attempting a push and everything is up to date, there will be no 'output', causing steno_logger to raise. --- lib/git/lib.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git/lib.rb b/lib/git/lib.rb index b1e3a65c..fb8da65e 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -910,7 +910,7 @@ def command(cmd, opts = [], chdir = true, redirect = '', &block) if @logger @logger.info(git_cmd) - @logger.debug(output) + @logger.debug(output) if output end if exitstatus > 1 || (exitstatus == 1 && output != '') From 8f974df30446177ff24a597680e476cc1331ee52 Mon Sep 17 00:00:00 2001 From: Robb Broome Date: Mon, 19 Dec 2016 14:02:42 -0600 Subject: [PATCH 3/3] Handle the empty string case For steno logger compatibility, don't log if the first param ('event') is null or empty string. --- lib/git/lib.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git/lib.rb b/lib/git/lib.rb index fb8da65e..d03230bf 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -910,7 +910,7 @@ def command(cmd, opts = [], chdir = true, redirect = '', &block) if @logger @logger.info(git_cmd) - @logger.debug(output) if output + @logger.debug(output) unless output.to_s == '' end if exitstatus > 1 || (exitstatus == 1 && output != '')