Skip to content
Permalink
Browse files
153: Check if origin remote exists before trying to get the pullPath
Reviewed-by: ehelin
  • Loading branch information
JornVernee committed Nov 11, 2019
1 parent f3881b6 commit 94ccf84115a30b51324418ded990117ea795084b
Showing with 11 additions and 9 deletions.
  1. +11 −9 cli/src/main/java/org/openjdk/skara/cli/GitWebrev.java
@@ -156,15 +156,17 @@ private static void generate(String[] args) throws IOException {
if (upstream == null) {
try {
var remote = isMercurial ? "default" : "origin";
var pullPath = repo.pullPath(remote);
var uri = new URI(pullPath);
var host = uri.getHost();
var path = uri.getPath();
if (host != null && path != null) {
if (host.equals("github.com") && path.startsWith("/openjdk/")) {
upstream = "https://github.com" + path;
} else if (host.equals("openjdk.java.net")) {
upstream = "https://openjdk.java.net" + path;
if (repo.remotes().contains(remote)) {
var pullPath = repo.pullPath(remote);
var uri = new URI(pullPath);
var host = uri.getHost();
var path = uri.getPath();
if (host != null && path != null) {
if (host.equals("github.com") && path.startsWith("/openjdk/")) {
upstream = "https://github.com" + path;
} else if (host.equals("openjdk.java.net")) {
upstream = "https://openjdk.java.net" + path;
}
}
}
} catch (URISyntaxException e) {

0 comments on commit 94ccf84

Please sign in to comment.