Skip to content
Permalink
Browse files
255: Improve git repository health check
Reviewed-by: ehelin
  • Loading branch information
rwestberg committed Feb 6, 2020
1 parent c08e9a6 commit ca0bc833da47b599181fbd69b326c360d4023d6f
Showing with 2 additions and 13 deletions.
  1. +2 −13 vcs/src/main/java/org/openjdk/skara/vcs/git/GitRepository.java
@@ -262,24 +262,13 @@ public boolean isEmpty() throws IOException {
}

@Override
public boolean isHealthy() throws IOException {
var refs = refs();
if (refs.size() == 0) {
return true;
}

var name = "health-check";
try (var p = capture("git", "branch", name, refs.get(0).hex())) {
if (p.await().status() != 0) {
return false;
}
}
try (var p = capture("git", "branch", "-D", name)) {
public boolean isHealthy() throws IOException {
try (var p = capture("git", "fsck", "--connectivity-only")) {
if (p.await().status() != 0) {
return false;
}
}

return true;
}

0 comments on commit ca0bc83

Please sign in to comment.