2014-08-27 44 views
2

在IBM i计算机(fka iSeries)上从bash执行git diff时出现奇怪的输出。例如,下面有^[[个字符后缀整数。如何在没有额外繁琐的情况下将它们显示为正常git diff在IBM i操作系统上git diff奇怪字符

^[[1mdiff --git a/libtest/GNUmakefile b/libtest/GNUmakefile^[[m 
^[[1mindex 9e70664..65c3097 100644^[[m 
^[[1m--- a/libtest/GNUmakefile^[[m 
^[[1m+++ b/libtest/GNUmakefile^[[m 
^[[[email protected]@ -153,6 +153,13 @@^[[m ^[[mifneq ($(findstring mingw, $(OS)),)^[[m 
    LIBEXT = dll^[[m 
    PICFLAGS=^[[m 
endif^[[m 
^[[32m+^[[m 
^[[32m+^[[m^[[32mifeq ($(OS), os400)^[[m 
^[[32m+^[[m^[[32m LIBEXT = a^[[m 
^[[32m+^[[m^[[32m SOFLAGS = -shared -static-libgcc^[[m 
^[[32m+^[[m^[[32m PICFLAGS += -pthread^[[m 
^[[32m+^[[m^[[32mendif^[[m 
^[[32m+^[[m 

回答

4

这很可能是由于git着色和IBMi的[(括号)字符的翻译。

您可以检查git的着色是否通过运行下面的开启:

$ git config --list 
[email protected] 
user.name=Aaron Bartell 
color.ui=auto 
core.repositoryformatversion=0 
core.filemode=true 
core.bare=false 
core.logallrefupdates=true 
core.ignorecase=true 

在这种情况下color.ui=auto正在转向着色上一切。运行以下命令将着色关闭只是git diff

git config --global color.diff false

现在,当你运行git diff它看起来应该如你所期望:

diff --git a/libtest/GNUmakefile b/libtest/GNUmakefile 
index 9e70664..65c3097 100644 
--- a/libtest/GNUmakefile 
+++ b/libtest/GNUmakefile 
@@ -153,6 +153,13 @@ ifneq ($(findstring mingw, $(OS)),) 
    LIBEXT = dll 
    PICFLAGS= 
endif 
+ 
+ifeq ($(OS), os400) 
+ LIBEXT = a 
+ SOFLAGS = -shared -static-libgcc 
+ PICFLAGS += -pthread 
+endif 
+ 
+0

(n)的诅咒再次挫败! – Hellion 2014-09-05 19:42:57