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 35
35
import org .eclipse .jgit .api .errors .CheckoutConflictException ;
36
36
import org .eclipse .jgit .api .errors .GitAPIException ;
37
37
import org .eclipse .jgit .api .errors .RefNotFoundException ;
38
+ import org .eclipse .jgit .errors .RepositoryNotFoundException ;
38
39
import org .eclipse .jgit .lib .ObjectId ;
39
40
import org .eclipse .jgit .lib .PersonIdent ;
40
41
import org .eclipse .jgit .revwalk .RevCommit ;
@@ -81,8 +82,12 @@ public Git getRepository(GitDetails gitDetails, boolean reuseDir)
81
82
// Check if folder already exists
82
83
Path repoDir = gitStorage .resolve (baseName );
83
84
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
+ }
86
91
} else {
87
92
// Create a folder and clone repository into it
88
93
Files .createDirectory (repoDir );
You can’t perform that action at this time.
0 commit comments