From: zn@... Date: 2015-02-23T12:26:17+00:00 Subject: [ruby-dev:48880] [Ruby trunk - Bug #10890] [Assigned] revision.h が空になる Issue #10890 has been reported by Kazuhiro NISHIYAMA. ---------------------------------------- Bug #10890: revision.h が空になる https://bugs.ruby-lang.org/issues/10890 * Author: Kazuhiro NISHIYAMA * Status: Assigned * Priority: Normal * Assignee: Nobuyoshi Nakada * ruby -v: ruby 2.3.0dev (2015-02-23) [x86_64-linux] * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- Ubuntu 12.04 LTS のように git が古い環境だと revision.h が空になってしまいます。 原因を調べてみたところ -C オプションに対応していないからのようです。 ~~~ % git --version git version 1.7.9.5 % ruby -vd --disable=gems tool/file2lastrev.rb --revision.h . ruby 2.3.0dev (2015-02-23) [x86_64-linux] [["git", "-C", ".", "log", "-n1", "--date=iso", "--grep=^ *git-svn-id: .*@[0-9][0-9]*"]] Unknown option: -C usage: git [--version] [--exec-path[=]] [--html-path] [--man-path] [--info-path] [-p|--paginate|--no-pager] [--no-replace-objects] [--bare] [--git-dir=] [--work-tree=] [--namespace=] [-c name=value] [--help] [] (略) Exception `VCS::NotFoundError' at /home/kazu/z/wc/CI/ruby/tool/vcs.rb:96 - last revision not found file2lastrev.rb: last revision not found ~~~ そのままだと ruby -d でも何も出なかったので以下の変更をして試しました。 ~~~ % git diff diff --git a/tool/vcs.rb b/tool/vcs.rb index 9d11b3b..29bcc95 100644 --- a/tool/vcs.rb +++ b/tool/vcs.rb @@ -81,7 +81,7 @@ class VCS end last, changed, modified, *rest = ( begin - if NullDevice + if !$DEBUG && NullDevice save_stderr = STDERR.dup STDERR.reopen NullDevice, 'w' end ~~~ -- https://bugs.ruby-lang.org/