読者です 読者をやめる 読者になる 読者になる

git config color.ui always はダメ、ゼッタイ

git

はまったのでメモ

color.ui

皆さんご存知のとおり git の diff や status を ANSI カラー出力するようにする設定です。

一般的に、以下のようにすることが多いかと思います。

git config --global color.ui auto

これを、「git status などを less に渡したときにも色づけしたい!」ということで、自分は以下のようにしていました。

git config --gobal color.ui always

ダメ、ゼッタイ

コマンドライン操作では問題ないのですが、 git を呼び出すライブラリがエスケープシーケンスを処理できず、謎のエラーを吐いて落ちるという現象に悩まされる可能性があります。

私は、 gollum を久しぶりに使おうとしておもいっきりはまりました。

gollum が落ちる

color.ui = always の状態で gollum を起動し、ブラウザアクセスすると以下のスタックトレースを吐いて落ちてしまいました。

f:id:comutt:20131123011926p:plain

gollum を起動したコンソールを見ると、以下のように gitlab-grit で落ちてることがわかります。

[2013-11-23 01:18:05] INFO  WEBrick::HTTPServer#start: pid=83516 port=4567
NoMethodError - undefined method `split' for nil:NilClass:
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/gitlab-grit-2.6.0/lib/grit/commit.rb:152:in `list_from_string'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/gitlab-grit-2.6.0/lib/grit/repo.rb:559:in `log'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/gollum-lib-1.0.9/lib/gollum-lib/page.rb:280:in `versions'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/gollum-2.5.2/lib/gollum/views/page.rb:25:in `author'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/mustache-0.99.5/lib/mustache/context.rb:135:in `[]'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/mustache-0.99.5/lib/mustache/context.rb:135:in `find'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/mustache-0.99.5/lib/mustache/context.rb:99:in `block in fetch'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/mustache-0.99.5/lib/mustache/context.rb:95:in `each'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/mustache-0.99.5/lib/mustache/context.rb:95:in `fetch'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/mustache-0.99.5/lib/mustache/context.rb:77:in `[]'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/mustache-0.99.5/lib/mustache/template.rb:359:in `render'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/mustache-0.99.5/lib/mustache/template.rb:43:in `render'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/mustache-0.99.5/lib/mustache.rb:119:in `render'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/mustache-0.99.5/lib/mustache/sinatra.rb:113:in `mustache'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/gollum-2.5.2/lib/gollum/app.rb:457:in `show_page_or_file'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/gollum-2.5.2/lib/gollum/app.rb:435:in `block in <class:App>'

なぜ落ちてるのか、わからず、 ruby2.0 のせいか?と疑ってみたり(gollum の GitHub の README では 1.9.3 が推奨されている)し、 ruby1.9.3 でもやってみて同じスタックトレースに悩まされました。

gitlab-grit を clone して、 テストを動かしてようやくわかりました。

$ /usr/local/opt/ruby/bin/bundle exec rake20 test
/usr/local/Cellar/ruby/2.0.0-p247/bin/ruby20 -I"lib:lib:test:." -I"/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-0.9.2.2/lib" "/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/**/test_*.rb"
Using repo from /Users/skomatsu/dev/github/gitlabhq/grit/repos/grit
test/unit warning: method TestRepo#test_diff is redefined
Run options:

# Running tests:

[ 31/215] TestCommit#test_patch_id = 0.01 s
  1) Failure:
test_patch_id(TestCommit) [/Users/skomatsu/dev/github/gitlabhq/grit/test/test_commit.rb:201]:
<"9450b04e4f83ad0067199c9e9e338197d1835cbb"> expected but was
<nil>.

[ 73/215] TestGitPatching#test_applies_patch = 0.32 s
  2) Error:
test_applies_patch(TestGitPatching):
RuntimeError: invalid string: false
    /Users/skomatsu/dev/github/gitlabhq/grit/lib/grit/git-ruby.rb:76:in `rev_parse'
    /Users/skomatsu/dev/github/gitlabhq/grit/lib/grit/git-ruby.rb:39:in `ls_tree'
    /Users/skomatsu/dev/github/gitlabhq/grit/lib/grit/tree.rb:18:in `construct'
    /Users/skomatsu/dev/github/gitlabhq/grit/lib/grit/repo.rb:502:in `tree'
    /Users/skomatsu/dev/github/gitlabhq/grit/test/test_git_patching.rb:37:in `test_applies_patch'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1301:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit/testcase.rb:17:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:919:in `block in _run_suite'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `map'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `_run_suite'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:657:in `block in _run_suites'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `each'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `_run_suites'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:867:in `_run_anything'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1060:in `run_tests'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1047:in `block in _run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `each'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `_run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1035:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:21:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:774:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:366:in `block (2 levels) in autorun'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:27:in `run_once'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:365:in `block in autorun'

[ 74/215] TestGitPatching#test_checks_patch_applies = 0.02 s
  3) Failure:
test_checks_patch_applies(TestGitPatching) [/Users/skomatsu/dev/github/gitlabhq/grit/test/test_git_patching.rb:22]:
<0> expected but was
<128>.

[ 79/215] TestGritSpaces#test_log_with_path_leading_space = 0.01 s
  4) Error:
test_log_with_path_leading_space(TestGritSpaces):
NoMethodError: undefined method `split' for nil:NilClass
    /Users/skomatsu/dev/github/gitlabhq/grit/lib/grit/commit.rb:152:in `list_from_string'
    /Users/skomatsu/dev/github/gitlabhq/grit/lib/grit/repo.rb:558:in `log'
    /Users/skomatsu/dev/github/gitlabhq/grit/test/test_rgit_spaces.rb:17:in `test_log_with_path_leading_space'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1301:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit/testcase.rb:17:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:919:in `block in _run_suite'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `map'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `_run_suite'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:657:in `block in _run_suites'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `each'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `_run_suites'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:867:in `_run_anything'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1060:in `run_tests'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1047:in `block in _run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `each'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `_run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1035:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:21:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:774:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:366:in `block (2 levels) in autorun'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:27:in `run_once'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:365:in `block in autorun'

[ 80/215] TestGritSpaces#test_log_with_path_leading_space_in_a_branch = 0.01 s
  5) Error:
test_log_with_path_leading_space_in_a_branch(TestGritSpaces):
NoMethodError: undefined method `split' for nil:NilClass
    /Users/skomatsu/dev/github/gitlabhq/grit/lib/grit/commit.rb:152:in `list_from_string'
    /Users/skomatsu/dev/github/gitlabhq/grit/lib/grit/repo.rb:558:in `log'
    /Users/skomatsu/dev/github/gitlabhq/grit/test/test_rgit_spaces.rb:36:in `test_log_with_path_leading_space_in_a_branch'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1301:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit/testcase.rb:17:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:919:in `block in _run_suite'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `map'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `_run_suite'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:657:in `block in _run_suites'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `each'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `_run_suites'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:867:in `_run_anything'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1060:in `run_tests'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1047:in `block in _run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `each'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `_run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1035:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:21:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:774:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:366:in `block (2 levels) in autorun'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:27:in `run_once'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:365:in `block in autorun'

[ 81/215] TestGritSpaces#test_log_with_path_no_leading_space = 0.01 s
  6) Error:
test_log_with_path_no_leading_space(TestGritSpaces):
NoMethodError: undefined method `split' for nil:NilClass
    /Users/skomatsu/dev/github/gitlabhq/grit/lib/grit/commit.rb:152:in `list_from_string'
    /Users/skomatsu/dev/github/gitlabhq/grit/lib/grit/repo.rb:558:in `log'
    /Users/skomatsu/dev/github/gitlabhq/grit/test/test_rgit_spaces.rb:11:in `test_log_with_path_no_leading_space'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1301:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit/testcase.rb:17:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:919:in `block in _run_suite'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `map'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `_run_suite'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:657:in `block in _run_suites'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `each'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `_run_suites'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:867:in `_run_anything'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1060:in `run_tests'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1047:in `block in _run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `each'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `_run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1035:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:21:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:774:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:366:in `block (2 levels) in autorun'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:27:in `run_once'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:365:in `block in autorun'

[ 82/215] TestGritSpaces#test_log_with_path_no_leading_space_in_a_branch = 0.01 s
  7) Error:
test_log_with_path_no_leading_space_in_a_branch(TestGritSpaces):
NoMethodError: undefined method `split' for nil:NilClass
    /Users/skomatsu/dev/github/gitlabhq/grit/lib/grit/commit.rb:152:in `list_from_string'
    /Users/skomatsu/dev/github/gitlabhq/grit/lib/grit/repo.rb:558:in `log'
    /Users/skomatsu/dev/github/gitlabhq/grit/test/test_rgit_spaces.rb:30:in `test_log_with_path_no_leading_space_in_a_branch'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1301:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit/testcase.rb:17:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:919:in `block in _run_suite'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `map'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `_run_suite'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:657:in `block in _run_suites'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `each'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `_run_suites'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:867:in `_run_anything'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1060:in `run_tests'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1047:in `block in _run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `each'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `_run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1035:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:21:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:774:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:366:in `block (2 levels) in autorun'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:27:in `run_once'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:365:in `block in autorun'

[ 83/215] TestGritSpaces#test_log_with_path_trailing_space = 0.01 s
  8) Error:
test_log_with_path_trailing_space(TestGritSpaces):
NoMethodError: undefined method `split' for nil:NilClass
    /Users/skomatsu/dev/github/gitlabhq/grit/lib/grit/commit.rb:152:in `list_from_string'
    /Users/skomatsu/dev/github/gitlabhq/grit/lib/grit/repo.rb:558:in `log'
    /Users/skomatsu/dev/github/gitlabhq/grit/test/test_rgit_spaces.rb:23:in `test_log_with_path_trailing_space'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1301:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit/testcase.rb:17:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:919:in `block in _run_suite'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `map'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:912:in `_run_suite'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:657:in `block in _run_suites'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `each'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:655:in `_run_suites'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:867:in `_run_anything'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1060:in `run_tests'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1047:in `block in _run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `each'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1046:in `_run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/minitest/unit.rb:1035:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:21:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:774:in `run'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:366:in `block (2 levels) in autorun'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:27:in `run_once'
    /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/2.0.0/test/unit.rb:365:in `block in autorun'

[127/215] TestRepo#test_grep = 0.04 s
  9) Failure:
test_grep(TestRepo) [/Users/skomatsu/dev/github/gitlabhq/grit/test/test_repo.rb:425]:
<"  def test_select_existing_objects"> expected but was
<"  \e[1;31mdef test_select_existing_objects\e[m">.

Finished tests in 6.581181s, 32.6689 tests/s, 79.7729 assertions/s.
215 tests, 525 assertions, 3 failures, 6 errors, 0 skips

ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin11.4.2]
rake aborted!
Command failed with status (9): [/usr/local/Cellar/ruby/2.0.0-p247/bin/ruby...]

Tasks: TOP => test
(See full trace by running task with --trace)

あ!なんかエスケープシーケンスでこけてるっぽい!!

[127/215] TestRepo#test_grep = 0.04 s
  9) Failure:
test_grep(TestRepo) [/Users/skomatsu/dev/github/gitlabhq/grit/test/test_repo.rb:425]:
<"  def test_select_existing_objects"> expected but was
<"  \e[1;31mdef test_select_existing_objects\e[m">.

そういえば color.ui = always にしてたなあ。。。

$ git config --global color.ui
always

color.ui = auto にしてみる。

$ git config --global color.ui auto

もっかい gitlab-grit のテストを実行する。

$ /usr/local/opt/ruby/bin/bundle exec rake20 test
/usr/local/Cellar/ruby/2.0.0-p247/bin/ruby20 -I"lib:lib:test:." -I"/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-0.9.2.2/lib" "/usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-0.9.2.2/lib/rake/rake_test_loader.rb" "test/**/test_*.rb"
Using repo from /Users/skomatsu/dev/github/gitlabhq/grit/repos/grit
test/unit warning: method TestRepo#test_diff is redefined
Run options:

# Running tests:

Finished tests in 5.654637s, 38.0219 tests/s, 94.9663 assertions/s.
215 tests, 537 assertions, 0 failures, 0 errors, 0 skips

ruby -v: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin11.4.2]

無事とおり、 gollum も正常に動作するようになりました。