Skip to content

Commit

Permalink
[ci skip] Ignore global git config when running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nineinchnick committed Feb 5, 2024
1 parent 97bfb95 commit 66f69fc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/test/java/pl/net/was/trino/git/TestGitClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@

import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.errors.ConfigInvalidException;
import org.eclipse.jgit.lib.PersonIdent;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.util.SystemReader;
import org.junit.jupiter.api.Test;

import java.io.File;
Expand Down Expand Up @@ -45,6 +47,14 @@ public void testMetadata()
public static void setupRepo(URI uri)
throws IOException, GitAPIException
{
// make sure the global Git config is not being used
try {
SystemReader.getInstance().getUserConfig().clear();
}
catch (ConfigInvalidException e) {
// ignore
}

// ensure the repo dir exists, remove and recreate if necessary
File localPath;
try {
Expand Down

0 comments on commit 66f69fc

Please sign in to comment.