You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(diff): add --normalized-diff option to DiffCommand
- Introduced a new command line option `--normalized-diff` in `DiffCommandSettings` to control the normalization of diff output.
- Updated `RunDiff` method in `ISyncCommandService` and its implementation to accept a new parameter for normalized diff.
- Modified the `SyncCommandService` to handle normalized diff logic in the diff generation process.
- Enhanced the `BuildUnifiedDiff` method to support normalized diff rendering.
- Updated tests to verify the behavior of the new normalized diff feature.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
22
22
- Treat equivalent extended-property blocks as compatible during comparison when the normalized `sp_addextendedproperty` statements differ only by ordering, argument spacing, or named-vs-positional argument forms within the same contiguous block.
23
23
- Treat leading SSMS-generated banner comments on programmable objects as compatible during comparison.
24
24
- Treat redundant empty or otherwise no-op `GO` batches as compatible during comparison.
25
+
- Keep `diff` output readable by rendering compatible `Table` and `UserDefinedType` changes from readable script text instead of opaque comparison-normalized text.
26
+
- Keep readable `diff` output for `Table` and table-valued `UserDefinedType` bodies at per-entry granularity instead of collapsing the entire body into one changed line.
27
+
- Align readable `Table` and table-valued `UserDefinedType` diffs by individual body entries so a single changed column or inline constraint does not mark the entire body as changed.
25
28
- Treat legacy explicit `NULL` tokens on CLR table-valued function return columns as compatible during comparison and preserve them during compatibility reconciliation when the rest of the definition matches.
26
29
- Trailing semicolon differences on `INSERT` statement lines in data scripts are now suppressed during comparison normalization; scripts emitted with and without statement terminators compare as compatible (#47).
27
30
- Legacy `TableData` scripts now compare as compatible when they differ from canonical output only by `SET IDENTITY_INSERT` semicolons or top-level `N'...'` string literal prefixes, including inside multi-line `INSERT ... VALUES (...)` statements.
@@ -42,6 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
42
45
- Next-steps suggestions are printed after `sqlct init` to guide users toward `pull`, `status`, and `diff` (#36).
43
46
- Add `--object <selector>` to `sqlct pull` for exact-match filtering using the same selector forms as `diff --object` (#35).
44
47
- Add `--filter <pattern>` to `sqlct pull` for regex-based filtering; multiple patterns may be provided and matching is case-insensitive (#35).
48
+
- Add `--normalized-diff` to `sqlct diff` to render comparison-normalized diff text for debugging while preserving readable diff output by default.
45
49
- Add `--filter <pattern>` to `sqlct diff` for regex-based filtering; without `--object` filters the output to matching objects, with `--object` additionally constrains the single-object result (#35).
46
50
- SQL Authentication support: set `database.auth` to `"sql"` and supply `database.user` (and optionally `database.password`) in `sqlct.config.json` to connect using SQL Server Authentication (#30).
47
51
- Support active object type `Assembly`, with deterministic scripting to `Assemblies/*.sql` for user-defined SQL Server assemblies.
- Added/deleted objects use empty-side vs script-side unified diff.
236
236
- Normalization includes line-ending/trailing-newline stability plus explicitly listed compatibility rules for deterministic comparison.
237
+
- Displayed diff hunks SHOULD preserve readable script text where possible and MUST NOT fall back to opaque comparison-normalized formatting when a readable compatibility-preserving representation is available.
238
+
- For `Table` and table-valued `UserDefinedType` scripts, readable diff rendering SHOULD preserve structural body boundaries so column and inline-constraint changes remain pinpointed within the body instead of collapsing the entire statement into one changed line.
237
239
- Empty lines are ignored during comparison, and whitespace-only lines are normalized to empty lines first so blank separators differing only by spaces or tabs compare as compatible.
238
240
- Redundant empty or no-op `GO` batches compare as compatible.
239
241
- Trailing semicolons on `INSERT` statement lines are stripped during normalization; scripts emitted with and without statement terminators compare as compatible.
@@ -249,6 +251,7 @@ Behavior:
249
251
- Leading SSMS-generated object banner comments on programmable objects (`StoredProcedure`, `View`, `Function`, `Trigger`) compare as compatible.
250
252
- Diff output uses a chunked format: only changed lines and their surrounding context are shown, not the entire file.
251
253
-`--context <N>` controls the number of unchanged context lines shown before and after each changed segment (default: 3). Negative values are treated as 0.
254
+
-`--normalized-diff` switches diff rendering to the exact comparison-normalized text used for compatibility evaluation. It is intended for debugging and is off by default.
252
255
- When two change segments are close enough that their context regions overlap, they are merged into a single hunk.
253
256
- Each hunk is prefixed with a `@@ -l,s +l,s @@` header indicating the source and target line ranges.
254
257
- When `data.trackedTables` is configured, `diff` also supports data-script diffs for tracked tables.
Copy file name to clipboardExpand all lines: specs/04-scripting.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -812,6 +812,8 @@ When compatibility reference files are available, `sqlct` MAY apply reconciliati
812
812
- Script generation MUST emit canonical scripting output per this document and MUST NOT include diff/status-specific normalization.
813
813
-`status` and `diff` normalization behaviors are external contracts defined in `specs/01-cli.md` and `specs/05-output-formats.md`.
814
814
- Scripting and comparison normalization responsibilities MUST remain decoupled.
815
+
- Diff rendering MAY use comparison-normalized keys to identify compatible changes, but emitted diff text SHOULD remain human-readable and SHOULD prefer readable compatibility-preserving representations over opaque comparison-normalized forms.
816
+
- For `Table` and table-valued `UserDefinedType` statements, readable diff rendering SHOULD retain structural body boundaries so body entries can diff at per-entry granularity when the compatibility-preserving representation exposes them.
815
817
- Empty lines MUST be ignored during comparison, and whitespace-only lines MUST be normalized to empty lines first so that blank separators differing only by spaces or tabs compare as compatible.
816
818
- Comparison normalization MAY ignore redundant empty or otherwise no-op `GO` batches, including batches that contain only standalone semicolon lines.
817
819
- Trailing semicolons on `INSERT` statement lines MUST be stripped by comparison normalization so that scripts emitted with and without statement terminators compare as compatible.
0 commit comments