Skip to content

Commit

Permalink
Fix UpdateChecker error when diverged from branch
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Oct 17, 2024
1 parent 9d44f94 commit 05d5ef6
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ private void checkSnapshot(final Manifest manifest) {
}
case Distance.Failure failure -> this.logger.warn("Error obtaining version information", failure.reason());
case Distance.Ahead $ -> this.logger.info("Commit '{}' is ahead of branch '{}', local build?", gitHash, branch);
case Distance.Diverged $ -> this.logger.info("Commit '{}' is diverged from branch '{}', local build?", gitHash, branch);
case Distance.UnknownCommit $ -> this.logger.info(Messages.UPDATE_CHECKER_UNKNOWN_COMMIT.replace("<commit>", gitHash));
}
}
Expand Down Expand Up @@ -117,6 +118,7 @@ private Distance fetchDistance(final String branch, final String hash) {
case "identical" -> new Distance.UpToDate();
case "behind" -> new Distance.Behind(response.get("behind_by").getAsInt());
case "ahead" -> new Distance.Ahead();
case "diverged" -> new Distance.Diverged();
default -> new Distance.Failure(new IllegalArgumentException("Unknown status: '" + status + "'"));
};
}
Expand All @@ -140,6 +142,9 @@ final class UpToDate implements Distance {

final class Ahead implements Distance {
}

final class Diverged implements Distance {
}
}

private record Releases(List<String> releaseList, Map<String, String> releaseUrls) {
Expand Down

0 comments on commit 05d5ef6

Please sign in to comment.