Defect #44476 » 0001-Fix-Git-branch-names-containing-a-40-character-hex-s.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}).*$')
|
|
| 82 |
branch_rev = line.match('\s*(\*?)\s*(.*?)\s+([0-9a-f]{40}).*$')
|
|
| 83 | 83 |
next unless branch_rev |
| 84 | 84 | |
| 85 | 85 |
bran = GitBranch.new(scm_iconv('UTF-8', @path_encoding, branch_rev[2]))
|
| test/unit/lib/redmine/scm/adapters/git_adapter_test.rb | ||
|---|---|---|
| 114 | 114 |
assert_equal false, br_test.is_default |
| 115 | 115 |
end |
| 116 | 116 | |
| 117 |
def test_branches_with_branch_name_containing_hash |
|
| 118 |
branch_name = 'feature-0123456789abcdef0123456789abcdef01234567' |
|
| 119 |
output = <<~OUTPUT |
|
| 120 |
* #{branch_name} 2a682156a3b6e77a8bf9cd4590e8db757f3c6c78 Add foo.txt
|
|
| 121 |
OUTPUT |
|
| 122 |
@adapter.stubs(:git_cmd).yields(StringIO.new(output)) |
|
| 123 | ||
| 124 |
brs = @adapter.branches |
|
| 125 |
assert_equal 1, brs.length |
|
| 126 |
assert_equal branch_name, brs[0].to_s |
|
| 127 |
assert_equal '2a682156a3b6e77a8bf9cd4590e8db757f3c6c78', brs[0].revision |
|
| 128 |
assert_equal true, brs[0].is_default |
|
| 129 |
end |
|
| 130 | ||
| 117 | 131 |
def test_default_branch |
| 118 | 132 |
assert_equal 'master-20120212', @adapter.default_branch |
| 119 | 133 | |