mirror of
https://github.com/redmine/redmine.git
synced 2025-11-13 08:46:01 +01:00
Support for Git repositories with default branch "main" (#34942).
Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@20851 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -124,6 +124,25 @@ class GitAdapterTest < ActiveSupport::TestCase
|
||||
|
||||
def test_default_branch
|
||||
assert_equal 'master-20120212', @adapter.default_branch
|
||||
|
||||
# When no branch is marked as the default, GitAdapter treats
|
||||
# "main" or "master" branch as the default
|
||||
b_foo, b_bar, b_main, b_master =
|
||||
%w[foo bar main master].map do |name|
|
||||
Redmine::Scm::Adapters::GitAdapter::GitBranch.new(name)
|
||||
end
|
||||
@adapter.stubs(:branches).returns([b_foo, b_main, b_bar])
|
||||
assert_equal 'main', @adapter.default_branch
|
||||
@adapter.stubs(:branches).returns([b_foo, b_master, b_bar])
|
||||
assert_equal 'master', @adapter.default_branch
|
||||
|
||||
# The first found branch is treated as the default branch
|
||||
# when neither "main" nor "master" is found
|
||||
@adapter.stubs(:branches).returns([b_foo, b_bar])
|
||||
assert_equal 'foo', @adapter.default_branch
|
||||
|
||||
@adapter.stubs(:branches).returns([])
|
||||
assert_nil @adapter.default_branch
|
||||
end
|
||||
|
||||
def test_tags
|
||||
|
||||
Reference in New Issue
Block a user