Skip to content
This repository has been archived by the owner on Apr 5, 2019. It is now read-only.

Commit

Permalink
Add a message for "not a Git repository". Use Constants.DOT_GIT.
Browse files Browse the repository at this point in the history
  • Loading branch information
JBYoshi committed Nov 24, 2015
1 parent 2d03909 commit f85e395
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/main/java/jbyoshi/gitupdate/GitUpdate.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.*;

import org.eclipse.jgit.api.*;
import org.eclipse.jgit.errors.*;
import org.eclipse.jgit.lib.*;
import org.eclipse.jgit.submodule.*;

Expand Down Expand Up @@ -66,14 +67,26 @@ public static void update(File repoDir, Task root) {
try (Repository repo = new RepositoryBuilder().setWorkTree(repoDir).setMustExist(true).build()) {
update(repo, root);
}
} catch (RepositoryNotFoundException e) {
if (repoDir.getName().equals(Constants.DOT_GIT)) {
repoDir = repoDir.getParentFile();
}
try {
repoDir = repoDir.toPath().toRealPath().toFile();
} catch (IOException e1) {
repoDir = repoDir.toPath().normalize().toFile();
}
if (updated.add(repoDir)) {
root.report.newChild(repoDir.getName() + " - not a Git repository");
}
} catch (IOException e) {
e.printStackTrace();
}
}

public static void update(Repository repo, Task root) {
File dir = repo.getDirectory();
if (dir.getName().equals(".git")) {
if (dir.getName().equals(Constants.DOT_GIT)) {
dir = dir.getParentFile();
}
try {
Expand Down

0 comments on commit f85e395

Please sign in to comment.