Commits

Martin Gräßlin 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.

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()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.