Skip to content

Commit

Permalink
Do not assume the default branch is 'master' in tests
Browse files Browse the repository at this point in the history
Fixes #587
Signed-off-by: lijunwei <ljw532344863@sina.com>
  • Loading branch information
liijunwei committed Aug 19, 2022
1 parent 8279298 commit ff6dcf4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/units/test_init.rb
Expand Up @@ -38,7 +38,10 @@ def test_git_init
assert(File.directory?(File.join(path, '.git')))
assert(File.exist?(File.join(path, '.git', 'config')))
assert_equal('false', repo.config('core.bare'))
assert_equal("ref: refs/heads/master\n", File.read("#{path}/.git/HEAD"))

branch = `git config --get init.defaultBranch`.strip
branch = 'master' if branch.empty?
assert_equal("ref: refs/heads/#{branch}\n", File.read("#{path}/.git/HEAD"))
end
end

Expand Down

0 comments on commit ff6dcf4

Please sign in to comment.