Browse Source

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

qdn
CalDescent 3 years ago
parent
commit
a6154cbb43
  1. 7
      src/main/java/org/qortal/arbitrary/ArbitraryDataDiff.java

7
src/main/java/org/qortal/arbitrary/ArbitraryDataDiff.java

@ -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);

Loading…
Cancel
Save