diff --git a/reckon-core/src/main/java/org/ajoberstar/reckon/core/GitInventorySupplier.java b/reckon-core/src/main/java/org/ajoberstar/reckon/core/GitInventorySupplier.java index 5ecf9f5..c2c6acb 100644 --- a/reckon-core/src/main/java/org/ajoberstar/reckon/core/GitInventorySupplier.java +++ b/reckon-core/src/main/java/org/ajoberstar/reckon/core/GitInventorySupplier.java @@ -2,13 +2,7 @@ import java.io.IOException; import java.io.UncheckedIOException; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.Set; +import java.util.*; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -19,9 +13,6 @@ import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.lib.Constants; -import org.eclipse.jgit.lib.ObjectId; -import org.eclipse.jgit.lib.ObjectReader; -import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.Repository; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; @@ -32,7 +23,7 @@ /** * Supplies an inventory of a Git repository. - * + *

* This is intentionally package private. */ final class GitInventorySupplier implements VcsInventorySupplier { @@ -105,7 +96,17 @@ public VcsInventory getInventory() { private boolean isClean() { try { - return new Git(repo).status().call().isClean(); + var status = new Git(repo).status().call(); + if (!status.isClean()) { + logger.info("Git repository is not clean: added={}, changed={}, removed={}, untracked={}, modified={}, missing={}", + status.getAdded(), + status.getChanged(), + status.getRemoved(), + status.getUntracked(), + status.getModified(), + status.getMissing()); + } + return status.isClean(); } catch (GitAPIException e) { logger.error("Failed to determine status of repository. Assuming not clean.", e); // TODO should this throw up? diff --git a/reckon-core/src/main/java/org/ajoberstar/reckon/core/Reckoner.java b/reckon-core/src/main/java/org/ajoberstar/reckon/core/Reckoner.java index a6ffcc3..47ce0a4 100644 --- a/reckon-core/src/main/java/org/ajoberstar/reckon/core/Reckoner.java +++ b/reckon-core/src/main/java/org/ajoberstar/reckon/core/Reckoner.java @@ -4,12 +4,9 @@ import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.util.Arrays; -import java.util.Collections; import java.util.Objects; import java.util.Optional; import java.util.Set; -import java.util.function.BiFunction; -import java.util.function.Function; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -60,7 +57,7 @@ public Version reckon() { var reckoned = reckonTargetVersion(inventory, targetNormal); if (reckoned.isSignificant() && !inventory.isClean()) { - throw new IllegalStateException("Cannot release a final or significant stage without a clean repo."); + throw new IllegalStateException("Cannot release a final or significant stage without a clean repo. Review INFO logs for more details."); } if (inventory.getClaimedVersions().contains(reckoned) && !inventory.getCurrentVersion().map(reckoned::equals).orElse(false)) {