Don't allow a new layer to be created if it matches the existing state.

This commit is contained in:
CalDescent 2021-08-18 07:51:50 +01:00
parent 9c20967d24
commit a6154cbb43

View File

@ -49,6 +49,7 @@ public class ArbitraryDataDiff {
this.hashPreviousState();
this.findAddedOrModifiedFiles();
this.findRemovedFiles();
this.validate();
this.writeMetadata();
} finally {
@ -222,6 +223,12 @@ public class ArbitraryDataDiff {
}
}
private void validate() {
if (this.addedPaths.isEmpty() && this.modifiedPaths.isEmpty() && this.removedPaths.isEmpty()) {
throw new IllegalStateException("Current state matches previous state. Nothing to do.");
}
}
private void writeMetadata() throws IOException {
ArbitraryDataMetadataPatch metadata = new ArbitraryDataMetadataPatch(this.diffPath);
metadata.setAddedPaths(this.addedPaths);