8
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

RedmineでGitの履歴が表示されなくなった件

Posted at

なんか、ブランチが表示されなくなったので・・・・調べて解決したのでまとめ

結論このページの通りにやったら修正できた。
http://www.redmine.org/attachments/11617/git_adapter.rb.patch

Redmine version 3.4.6.stable.17417
Ruby version 2.4.1-p111 (2017-03-22) [x86_64-linux]
Rails version 4.2.8
Git 1.8.3.1

エラーはこんな感じ


Completed 500 Internal Server Error in 200ms (ActiveRecord: 21.5ms)

ActionView::Template::Error (incompatible character encodings: UTF-8 and ASCII-8BIT):
    30:   <% end -%>
    31: 
    32:   <% if !@repository.tags.nil? && @repository.tags.length > 0 -%>
    33:     | <%= l(:label_tag) %>:
    34:     <%= select_tag :tag,
    35:                    options_for_select([''] + @repository.tags, @rev),

なんか gitの方で tagに日本語を使ったのがあかんかったっぽい

cd /var/lib/redmine/lib/redmine/scm/adapters/
で移動して
vim git_adapter.rb
で編集

branch_rev = line.match('\s*(*?)\s*(.?)\s([0-9a-f]{40}).*$')
branch_rev = line.force_encoding('UTF-8').match('\s*(*?)\s*(.?)\s([0-9a-f]{40}).*$')
に変更
@tags = io.readlines.sort!.map{|t| t.strip}
@tags = io.readlines.sort!.map{|t| t.strip.force_encoding('UTF-8')}
に変更

上記二箇所変更で修正された。

8
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?