Skip to content

Commit

Permalink
schemadiff textual annotation fix + tests (#17630)
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomi Noach <[email protected]>
  • Loading branch information
shlomi-noach authored Feb 6, 2025
1 parent 3669569 commit e08d85c
Show file tree
Hide file tree
Showing 4 changed files with 356 additions and 36 deletions.
15 changes: 7 additions & 8 deletions go/vt/schemadiff/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,16 @@ func (a *TextualAnnotations) Removed() (r []*AnnotatedText) {
func (a *TextualAnnotations) Export() string {
textLines := make([]string, 0, len(a.texts))
for _, annotatedText := range a.texts {
switch annotatedText.typ {
case AddedTextualAnnotationType:
switch {
case annotatedText.typ == AddedTextualAnnotationType:
annotatedText.text = "+" + annotatedText.text
case RemovedTextualAnnotationType:
case annotatedText.typ == RemovedTextualAnnotationType:
annotatedText.text = "-" + annotatedText.text
case a.hasAnyChanges:
// This text is unchanged, but indented to align with changes
annotatedText.text = " " + annotatedText.text
default:
// text unchanged
if a.hasAnyChanges {
// If there is absolutely no change, we don't add a space anywhere
annotatedText.text = " " + annotatedText.text
}
// If there is absolutely no change, we don't add a space anywhere
}
textLines = append(textLines, annotatedText.text)
}
Expand Down
Loading

0 comments on commit e08d85c

Please sign in to comment.