|
15 | 15 | */
|
16 | 16 | package com.linecorp.centraldogma.server.command;
|
17 | 17 |
|
| 18 | +import static com.linecorp.centraldogma.internal.Util.isJson5; |
18 | 19 | import static java.util.Objects.requireNonNull;
|
19 | 20 |
|
20 | 21 | import javax.annotation.Nullable;
|
|
24 | 25 |
|
25 | 26 | import com.linecorp.centraldogma.common.Author;
|
26 | 27 | import com.linecorp.centraldogma.common.Change;
|
| 28 | +import com.linecorp.centraldogma.common.ChangeType; |
27 | 29 | import com.linecorp.centraldogma.common.Markup;
|
28 | 30 | import com.linecorp.centraldogma.common.Revision;
|
29 | 31 | import com.linecorp.centraldogma.server.storage.repository.Repository;
|
@@ -57,8 +59,13 @@ public final class NormalizingPushCommand extends AbstractPushCommand<CommitResu
|
57 | 59 | */
|
58 | 60 | public PushAsIsCommand asIs(CommitResult commitResult) {
|
59 | 61 | requireNonNull(commitResult, "commitResult");
|
| 62 | + |
| 63 | + // JSON5 changes should not be normalized to preserve its content in replication log. |
| 64 | + final boolean useOriginalChanges = changes().stream().anyMatch( |
| 65 | + change -> change.type() == ChangeType.UPSERT_JSON && isJson5(change.path())); |
| 66 | + |
60 | 67 | return new PushAsIsCommand(timestamp(), author(), projectName(), repositoryName(),
|
61 |
| - commitResult.revision().backward(1), summary(), detail(), |
62 |
| - markup(), commitResult.changes()); |
| 68 | + commitResult.revision().backward(1), summary(), detail(), markup(), |
| 69 | + useOriginalChanges ? changes() : commitResult.changes()); |
63 | 70 | }
|
64 | 71 | }
|
0 commit comments