プロジェクト

全般

プロフィール

Vote #63302

完了

git's "get_rev" API should use repo's current branch instead of hardwiring "master"

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
高め
担当者:
-
カテゴリ:
SCM_3
対象バージョン:
開始日:
2008/05/28
期日:
進捗率:

0%

予定工数:
category_id:
3
version_id:
4
issue_org_id:
1319
author_id:
1156
assigned_to_id:
0
comments:
1
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

@lib/redmine/scm/adapters/git_adapter.rb@ gets the revision (@git_rev@ -- line 31 in particular (lines 30-32 shown) using the following cmd:


          cmd="git --git-dir #{target('')} show #{shell_quote rev} -- #{shell_quote path}" if rev!='latest' and (! rev.nil?)
          cmd="git --git-dir #{target('')} log -1 master -- #{shell_quote path}" if
            rev=='latest' or rev.nil?

If the repo does not use master, this won't work properly -- the "Browse" table will be stuck at "master" (assuming the branch exists) but the "Latest Revisions" table will show commits to the current branch. In effect, you will not be able to browse the tree to see the files changed in the commits you can see.
I propose the following instead:


          if rev!='latest' and (! rev.nil?)
            cmd="git --git-dir #{target('')} show #{shell_quote rev} -- #{shell_quote path}"
          else
            branch = shellout("git --git-dir #{target('')} branch") { |io| io.grep(/\*/)[0].strip.match(/\* (.*)/)[1] }
            cmd="git --git-dir #{target('')} log -1 #{branch} -- #{shell_quote path}"
          end

This adds an additional shellout to get the current branch of the current repository and passes that to the cmd string (replacing the hard-wired "master").


journals

Patch applied in r1475. Thanks.
--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリSCM_3 にセット
  • 対象バージョン0.7.2_4 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0