diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Status.java b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Status.java index 155adfbc495d19208dfdd0996f0172a0b4d12be6..790412fe54d2ab9a037d1bca27a4663e6e0eed18 100644 --- a/src/de/uni_passau/fim/seibt/gitwrapper/repo/Status.java +++ b/src/de/uni_passau/fim/seibt/gitwrapper/repo/Status.java @@ -1,5 +1,6 @@ package de.uni_passau.fim.seibt.gitwrapper.repo; +import java.io.StringWriter; import java.nio.file.Path; import java.nio.file.Paths; import java.util.Collections; @@ -21,10 +22,10 @@ public class Status { /** * The commit, this {@link Status} is based on. */ - public final String id; + public final Commit commit; /** - * A map of files which were changed since the last commit (with id {@link #id}) and their status codes. + * A map of files which were changed since the last {@link #commit} and their status codes. */ public final Map<Path, String> changed; @@ -34,18 +35,20 @@ public class Status { public final Map<Path, String> unmerged; /** - * @param id the commit id + * Constructs a new {@link Status}. + * + * @param commit the current HEAD {@link Commit} at the time this {@link Status} is constructed * @param changed a map of changed files and heir status codes * @param unmerged a map of unmerged files an their status code. */ - private Status(String id, Map<Path, String> changed, Map<Path, String> unmerged) { - this.id = id; + private Status(Commit commit, Map<Path, String> changed, Map<Path, String> unmerged) { + this.commit = commit; this.changed = Collections.unmodifiableMap(changed); this.unmerged = Collections.unmodifiableMap(unmerged); } /** - * Checks, if <code>this</code> represents a clean repository. + * Returns whether this {@link Status} represents a clean repository. * * @return <code>true</code>, if the repository state is clean and has uncommitted changes. */ @@ -54,7 +57,7 @@ public class Status { } /** - * Checks, if <code>this</code> has unmerged files. + * Returns whether this {@link Status} has unmerged files. * * @return <code>true</code>, if there are unmerged files */ @@ -66,7 +69,7 @@ public class Status { public String toString() { String out = ""; if (isClean()) { - out = "Clean working directory on commit " + id + "\n"; + out = "Clean working directory on commit " + commit + "\n"; } else { if (!unmerged.isEmpty()) { out = "Unmerged files:"; @@ -105,6 +108,6 @@ public class Status { } } - return repo.getCurrentHEAD().map(head -> new Status(head.id, changed, unmerged)); + return repo.getCurrentHEAD().map(head -> new Status(head, changed, unmerged)); } }