Skip to content

Commit

Permalink
fix: schema diff is reversed (#2323)
Browse files Browse the repository at this point in the history
fixes #2302
  • Loading branch information
stuartwdouglas authored Aug 12, 2024
1 parent 1fa898f commit 213c9e0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/ftl/cmd_schema_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ func (d *schemaDiffCmd) Run(ctx context.Context, currentURL *url.URL, projConfig
var other *schema.Schema
var err error
sameModulesOnly := false
if d.OtherEndpoint.String() == "" {
otherEndpoint := d.OtherEndpoint.String()
if otherEndpoint == "" {
otherEndpoint = "Local Changes"
sameModulesOnly = true
other, err = localSchema(ctx, projConfig)
} else {
Expand Down Expand Up @@ -61,8 +63,8 @@ func (d *schemaDiffCmd) Run(ctx context.Context, currentURL *url.URL, projConfig
}
}

edits := myers.ComputeEdits(span.URIFromPath(""), other.String(), current.String())
diff := fmt.Sprint(gotextdiff.ToUnified(d.OtherEndpoint.String(), currentURL.String(), other.String(), edits))
edits := myers.ComputeEdits(span.URIFromPath(""), current.String(), other.String())
diff := fmt.Sprint(gotextdiff.ToUnified(currentURL.String(), otherEndpoint, current.String(), edits))

color := d.Color || isatty.IsTerminal(os.Stdout.Fd())
if color {
Expand Down

0 comments on commit 213c9e0

Please sign in to comment.