Skip to content
Permalink
Browse files
Really fix so tests ignore .gitconfig
Reviewed-by: ehelin
  • Loading branch information
magicus committed Mar 17, 2021
1 parent 0cf4834 commit a66ee40e96549f38f3b9ecb25cd5c5a8539fbf61
Show file tree
Hide file tree
Showing 22 changed files with 282 additions and 232 deletions.
@@ -22,11 +22,8 @@
*/
package org.openjdk.skara.bots.checkout;

import org.openjdk.skara.forge.HostedRepository;
import org.openjdk.skara.storage.StorageBuilder;
import org.openjdk.skara.test.*;
import org.openjdk.skara.host.HostUser;
import org.openjdk.skara.vcs.Tag;
import org.openjdk.skara.vcs.*;

import org.junit.jupiter.api.*;
@@ -61,7 +58,7 @@ void simpleConversion(TestInfo testInfo) throws IOException {
var host = TestHost.createNew(List.of(HostUser.create(0, "duke", "J. Duke")));
var marksLocalDir = tmp.path().resolve("marks.git");
Files.createDirectories(marksLocalDir);
var marksLocalRepo = Repository.init(marksLocalDir, VCS.GIT);
var marksLocalRepo = TestableRepository.init(marksLocalDir, VCS.GIT);
marksLocalRepo.config("receive", "denyCurrentBranch", "ignore");
var marksHostedRepo = new TestHostedRepository(host, "marks", marksLocalRepo);

@@ -74,7 +71,7 @@ void simpleConversion(TestInfo testInfo) throws IOException {

var gitLocalDir = tmp.path().resolve("from.git");
Files.createDirectories(gitLocalDir);
var gitLocalRepo = Repository.init(gitLocalDir, VCS.GIT);
var gitLocalRepo = TestableRepository.init(gitLocalDir, VCS.GIT);
populate(gitLocalRepo);
var gitHostedRepo = new TestHostedRepository(host, "from", gitLocalRepo);

@@ -93,7 +90,7 @@ void update(TestInfo testInfo) throws IOException {
var host = TestHost.createNew(List.of(HostUser.create(0, "duke", "J. Duke")));
var marksLocalDir = tmp.path().resolve("marks.git");
Files.createDirectories(marksLocalDir);
var marksLocalRepo = Repository.init(marksLocalDir, VCS.GIT);
var marksLocalRepo = TestableRepository.init(marksLocalDir, VCS.GIT);
marksLocalRepo.config("receive", "denyCurrentBranch", "ignore");
var marksHostedRepo = new TestHostedRepository(host, "marks", marksLocalRepo);

@@ -107,7 +104,7 @@ void update(TestInfo testInfo) throws IOException {

var gitLocalDir = tmp.path().resolve("from.git");
Files.createDirectories(gitLocalDir);
var gitLocalRepo = Repository.init(gitLocalDir, VCS.GIT);
var gitLocalRepo = TestableRepository.init(gitLocalDir, VCS.GIT);
populate(gitLocalRepo);
var gitHostedRepo = new TestHostedRepository(host, "from", gitLocalRepo);

@@ -44,11 +44,11 @@ void mirrorMasterBranches(TestInfo testInfo) throws IOException {
var host = TestHost.createNew(List.of(HostUser.create(0, "duke", "J. Duke")));

var fromDir = temp.path().resolve("from.git");
var fromLocalRepo = Repository.init(fromDir, VCS.GIT);
var fromLocalRepo = TestableRepository.init(fromDir, VCS.GIT);
var fromHostedRepo = new TestHostedRepository(host, "test", fromLocalRepo);

var toDir = temp.path().resolve("to.git");
var toLocalRepo = Repository.init(toDir, VCS.GIT);
var toLocalRepo = TestableRepository.init(toDir, VCS.GIT);
var gitConfig = toDir.resolve(".git").resolve("config");
Files.write(gitConfig, List.of("[receive]", "denyCurrentBranch = ignore"),
StandardOpenOption.APPEND);
@@ -81,11 +81,11 @@ void mirrorDifferentBranches(TestInfo testInfo) throws IOException {
var host = TestHost.createNew(List.of(HostUser.create(0, "duke", "J. Duke")));

var fromDir = temp.path().resolve("from.git");
var fromLocalRepo = Repository.init(fromDir, VCS.GIT);
var fromLocalRepo = TestableRepository.init(fromDir, VCS.GIT);
var fromHostedRepo = new TestHostedRepository(host, "test", fromLocalRepo);

var toDir = temp.path().resolve("to.git");
var toLocalRepo = Repository.init(toDir, VCS.GIT);
var toLocalRepo = TestableRepository.init(toDir, VCS.GIT);
var gitConfig = toDir.resolve(".git").resolve("config");
Files.write(gitConfig, List.of("[receive]", "denyCurrentBranch = ignore"),
StandardOpenOption.APPEND);
@@ -69,7 +69,7 @@ static class TestExporterConfig extends ExporterConfig {
this.destinations(List.of(destination));

var host = TestHost.createNew(List.of(HostUser.create(0, "duke", "J. Duke")));
var marksLocalRepo = Repository.init(marksRepoPath.resolve("marks.git"), VCS.GIT);
var marksLocalRepo = TestableRepository.init(marksRepoPath.resolve("marks.git"), VCS.GIT);

var initialFile = marksLocalRepo.root().resolve("init.txt");
if (!Files.exists(initialFile)) {

1 comment on commit a66ee40

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on a66ee40 Mar 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.