diff --git a/test/import/test_git.rb b/test/import/test_git.rb index f8917c26..343bab1d 100644 --- a/test/import/test_git.rb +++ b/test/import/test_git.rb @@ -4,6 +4,25 @@ attr_reader :pkg, :importer, :gitrepo before do + xdg_config_home = make_tmpdir + git_config = File.join(xdg_config_home, "git", "config") + FileUtils.mkdir_p File.dirname(git_config) + @current_xdg_config_home = ENV["XDG_CONFIG_HOME"] + ENV["XDG_CONFIG_HOME"] = xdg_config_home + + File.write(git_config, <<~GIT_CONFIG) + [user] + email = someone.testing@autobuild.org + name = Someone + + [protocol "file"] + allow = always + GIT_CONFIG + + unless system("git", "config", "--global", "protocol.file.allow", "always") + raise "could not set up temporary global git configuration" + end + tempdir = untar('gitrepo.tar') @gitrepo = File.join(tempdir, 'gitrepo.git') @pkg = Autobuild::Package.new 'test' @@ -12,6 +31,10 @@ pkg.importer = importer end + after do + ENV["XDG_CONFIG_HOME"] = @current_xdg_config_home + end + describe "#initialize" do it "allows passing the branch as second argument for backward-compatibility way" do Autobuild.silent = true