From ff6dcf47ea1c14e5f12a8ff51eeb4ee10b7b2487 Mon Sep 17 00:00:00 2001 From: lijunwei <48843657+liijunwei@users.noreply.github.com> Date: Sat, 20 Aug 2022 07:50:12 +0800 Subject: [PATCH] Do not assume the default branch is 'master' in tests Fixes #587 Signed-off-by: lijunwei --- tests/units/test_init.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/units/test_init.rb b/tests/units/test_init.rb index 4ec4771d..596d42bb 100644 --- a/tests/units/test_init.rb +++ b/tests/units/test_init.rb @@ -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