Defect #44476 » 0002-Improve-readability-of-GitAdapter-branches.patch
| lib/redmine/scm/adapters/git_adapter.rb | ||
|---|---|---|
| 79 | 79 |
cmd_args = %w|branch --no-color --verbose --no-abbrev| |
| 80 | 80 |
git_cmd(cmd_args) do |io| |
| 81 | 81 |
io.each_line do |line| |
| 82 |
branch_rev = line.match('\s*(\*?)\s*(.*?)\s+([0-9a-f]{40}).*$')
|
|
| 83 |
next unless branch_rev |
|
| 84 | ||
| 85 |
bran = GitBranch.new(scm_iconv('UTF-8', @path_encoding, branch_rev[2]))
|
|
| 86 |
bran.revision = branch_rev[3] |
|
| 87 |
bran.scmid = branch_rev[3] |
|
| 88 |
bran.is_default = (branch_rev[1] == '*') |
|
| 89 |
@branches << bran |
|
| 82 |
# e.g. "* main 2a682156a3b6e77a8bf9cd4590e8db757f3c6c78 Add foo.txt" |
|
| 83 |
# ("*" marks the current branch; the columns are padded with spaces)
|
|
| 84 |
m = line.match(/\s*(?<current>\*?)\s*(?<name>.*?)\s+(?<rev>[0-9a-f]{40}).*$/)
|
|
| 85 |
next unless m |
|
| 86 | ||
| 87 |
branch = GitBranch.new(scm_iconv('UTF-8', @path_encoding, m[:name]))
|
|
| 88 |
branch.revision = m[:rev] |
|
| 89 |
branch.scmid = m[:rev] |
|
| 90 |
branch.is_default = (m[:current] == '*') |
|
| 91 |
@branches << branch |
|
| 90 | 92 |
end |
| 91 | 93 |
end |
| 92 | 94 |
@branches.sort! |
- « Previous
- 1
- 2
- Next »