Commits

Anonymous committed 5925e6f

Explicitly state from where the git Repository should find the git dir

Since JUMMP migrated to git the command findGitDir returned the wrong
git directory if grails is executed from the working tree. The reason
is that findGitDir starts to look for the git directory starting from
the directory where the JVM is executed. This of course finds the git
directory of the local clone of JUMMP.

The result is that neither the unit tests nor run-app can work with
the git repository resulting in models not being able to import and all
tests failing.

This change fixes this issue by always specifying from where findGitDir
should start looking for the git directory.

  • Participants
  • Parent commits b3a8814

Comments (0)

Files changed (6)

jummp-plugins/jummp-plugin-git/src/groovy/net/biomodels/jummp/plugins/git/GitManager.groovy

             FileRepositoryBuilder builder = new FileRepositoryBuilder()
             repository = builder.setWorkTree(clone)
             .readEnvironment() // scan environment GIT_* variables
-            .findGitDir() // scan up the file system tree
+            .findGitDir(clone) // scan up the file system tree
             .build()
             git = new Git(repository)
 

jummp-plugins/jummp-plugin-git/test/unit/net/biomodels/jummp/plugins/git/GitManagerTests.groovy

         FileRepositoryBuilder builder = new FileRepositoryBuilder()
         repository = builder.setWorkTree(clone)
         .readEnvironment() // scan environment GIT_* variables
-        .findGitDir() // scan up the file system tree
+        .findGitDir(clone) // scan up the file system tree
         .build()
         git = new Git(repository)
         git.init().setDirectory(clone).call()
         FileRepositoryBuilder builder = new FileRepositoryBuilder()
         Repository repository = builder.setWorkTree(clone)
         .readEnvironment() // scan environment GIT_* variables
-        .findGitDir() // scan up the file system tree
+        .findGitDir(clone) // scan up the file system tree
         .build()
         commit = repository.resolve(Constants.HEAD)
         revWalk = new RevWalk(repository)
         FileRepositoryBuilder builder = new FileRepositoryBuilder()
         Repository repository = builder.setWorkTree(clone)
         .readEnvironment() // scan environment GIT_* variables
-        .findGitDir() // scan up the file system tree
+        .findGitDir(clone) // scan up the file system tree
         .build()
         commit = repository.resolve(Constants.HEAD)
         revWalk = new RevWalk(repository)
         revision = gitManager.updateFile(importFile, "test", "Test commit message")
         repository = builder.setWorkTree(clone)
         .readEnvironment() // scan environment GIT_* variables
-        .findGitDir() // scan up the file system tree
+        .findGitDir(clone) // scan up the file system tree
         .build()
         commit = repository.resolve(Constants.HEAD)
         revWalk = new RevWalk(repository)
         FileRepositoryBuilder builder = new FileRepositoryBuilder()
         Repository repository = builder.setWorkTree(clone)
         .readEnvironment() // scan environment GIT_* variables
-        .findGitDir() // scan up the file system tree
+        .findGitDir(clone) // scan up the file system tree
         .build()
         ObjectId commit = repository.resolve(Constants.HEAD)
         RevWalk revWalk = new RevWalk(repository)

test/integration/net/biomodels/jummp/core/JmsAdapterServiceTests.groovy

         FileRepositoryBuilder builder = new FileRepositoryBuilder()
         Repository repository = builder.setWorkTree(clone)
         .readEnvironment() // scan environment GIT_* variables
-        .findGitDir() // scan up the file system tree
+        .findGitDir(clone) // scan up the file system tree
         .build()
         Git git = new Git(repository)
         git.init().setDirectory(clone).call()

test/integration/net/biomodels/jummp/core/ModelServiceTests.groovy

         FileRepositoryBuilder builder = new FileRepositoryBuilder()
         Repository repository = builder.setWorkTree(clone)
         .readEnvironment() // scan environment GIT_* variables
-        .findGitDir() // scan up the file system tree
+        .findGitDir(clone) // scan up the file system tree
         .build()
         Git git = new Git(repository)
         git.init().setDirectory(clone).call()

test/integration/net/biomodels/jummp/core/VcsServiceTests.groovy

         FileRepositoryBuilder builder = new FileRepositoryBuilder()
         Repository repository = builder.setWorkTree(clone)
         .readEnvironment() // scan environment GIT_* variables
-        .findGitDir() // scan up the file system tree
+        .findGitDir(clone) // scan up the file system tree
         .build()
         Git git = new Git(repository)
         git.init().setDirectory(clone).call()
         FileRepositoryBuilder builder = new FileRepositoryBuilder()
         Repository repository = builder.setWorkTree(clone)
         .readEnvironment() // scan environment GIT_* variables
-        .findGitDir() // scan up the file system tree
+        .findGitDir(clone) // scan up the file system tree
         .build()
         Git git = new Git(repository)
         git.init().setDirectory(clone).call()
         assertEquals("Second Test", lines[1])
         repository = builder.setWorkTree(clone)
         .readEnvironment() // scan environment GIT_* variables
-        .findGitDir() // scan up the file system tree
+        .findGitDir(clone) // scan up the file system tree
         .build()
         commit = repository.resolve(Constants.HEAD)
         revWalk = new RevWalk(repository)
         assertEquals("Third Test", lines[2])
         repository = builder.setWorkTree(clone)
         .readEnvironment() // scan environment GIT_* variables
-        .findGitDir() // scan up the file system tree
+        .findGitDir(clone) // scan up the file system tree
         .build()
         commit = repository.resolve(Constants.HEAD)
         revWalk = new RevWalk(repository)
         assertEquals("Admin Test", lines[3])
         repository = builder.setWorkTree(clone)
         .readEnvironment() // scan environment GIT_* variables
-        .findGitDir() // scan up the file system tree
+        .findGitDir(clone) // scan up the file system tree
         .build()
         commit = repository.resolve(Constants.HEAD)
         revWalk = new RevWalk(repository)

test/integration/net/biomodels/jummp/plugins/SbmlServiceTests.groovy

         FileRepositoryBuilder builder = new FileRepositoryBuilder()
         Repository repository = builder.setWorkTree(clone)
         .readEnvironment() // scan environment GIT_* variables
-        .findGitDir() // scan up the file system tree
+        .findGitDir(clone) // scan up the file system tree
         .build()
         Git git = new Git(repository)
         git.init().setDirectory(clone).call()