File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/main/java/org/commonwl/view/git Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 3535import org .eclipse .jgit .api .errors .CheckoutConflictException ;
3636import org .eclipse .jgit .api .errors .GitAPIException ;
3737import org .eclipse .jgit .api .errors .RefNotFoundException ;
38+ import org .eclipse .jgit .errors .RepositoryNotFoundException ;
3839import org .eclipse .jgit .lib .ObjectId ;
3940import org .eclipse .jgit .lib .PersonIdent ;
4041import org .eclipse .jgit .revwalk .RevCommit ;
@@ -81,8 +82,12 @@ public Git getRepository(GitDetails gitDetails, boolean reuseDir)
8182 // Check if folder already exists
8283 Path repoDir = gitStorage .resolve (baseName );
8384 if (Files .isReadable (repoDir ) && Files .isDirectory (repoDir )) {
84- repo = Git .open (repoDir .toFile ());
85- repo .fetch ().call ();
85+ try {
86+ repo = Git .open (repoDir .toFile ());
87+ repo .fetch ().call ();
88+ } catch (RepositoryNotFoundException ex ) {
89+ repo = cloneRepo (gitDetails .getRepoUrl (), repoDir .toFile ());
90+ }
8691 } else {
8792 // Create a folder and clone repository into it
8893 Files .createDirectory (repoDir );
You can’t perform that action at this time.
0 commit comments