Skip to content

Commit

Permalink
Ignore user home during tests
Browse files Browse the repository at this point in the history
As of JGit 4.9.0, they support reading the pull.ff git-config variable.
I had this configured on my system, which caused some tests to fail due
to expectations that isn't set. Setting the user.home to null avoids
this from happening in the first place.
  • Loading branch information
ajoberstar committed Oct 22, 2017
1 parent ab0425c commit 5e9a859
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ class MultiGitOpSpec extends Specification {
protected Grgit init(String name) {
File repoDir = tempDir.newFolder(name).canonicalFile
Git git = Git.init().setDirectory(repoDir).call()

// Don't want the user's git config to conflict with test expectations
git.repo.FS.userHome = null

git.repo.config.with {
setString('user', null, 'name', person.name)
setString('user', null, 'email', person.email)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ class SimpleGitOpSpec extends Specification {
def setup() {
File repoDir = tempDir.newFolder('repo')
Git git = Git.init().setDirectory(repoDir).call()

// Don't want the user's git config to conflict with test expectations
git.repo.FS.userHome = null

git.repo.config.with {
setString('user', null, 'name', person.name)
setString('user', null, 'email', person.email)
Expand Down

0 comments on commit 5e9a859

Please sign in to comment.