Project

General

Profile

Actions

Bug #10890

closed

revision.h が空になる

Added by znz (Kazuhiro NISHIYAMA) about 9 years ago. Updated about 9 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-02-23) [x86_64-linux]
[ruby-dev:48880]

Description

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[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [-c name=value] [--help]
           <command> [<args>]
(略)
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
Actions #1

Updated by nobu (Nobuyoshi Nakada) about 9 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

Applied in changeset r49705.


vcs.rb: do not use -C for older git

  • tool/vcs.rb (IO.popen): support :chdir option.
  • tool/vcs.rb (VCS::GIT.get_revisions): use :chdir option instead
    of -C option which is not supported by older git.
    [ruby-dev:48880] [Bug #10890]
Actions

Also available in: Atom PDF

Like0
Like0