Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions diff/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ func printDyffReport(r *Report, to io.Writer) {
_ = os.Remove(newFile.Name())
}()

context := -1
for _, entry := range r.Entries {
context = entry.Context
_, _ = currentFile.WriteString("---\n")
Comment on lines +93 to 96
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

context is taken from each ReportEntry inside the loop and the final value (from the last entry) is applied to the whole dyff report. This makes the dyff multiline context setting dependent on entry ordering and can produce the wrong value when entries have different Context values (e.g., OWNERSHIP entries currently use Context=0). Consider deriving the value once from the global option (or from the first non-ownership/non-(-1) entry) and/or validating that all entries share the same context before setting MultilineContextLines.

Copilot uses AI. Check for mistakes.
_, _ = newFile.WriteString("---\n")
for _, record := range entry.Diffs {
Expand All @@ -116,6 +118,11 @@ func printDyffReport(r *Report, to io.Writer) {
OmitHeader: true,
MinorChangeThreshold: 0.1,
}

if context != -1 {
reportWriter.MultilineContextLines = context
}
Comment on lines +122 to +124
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduces new behavior (wiring --context/-C into dyff via MultilineContextLines) but there’s no automated test coverage for dyff report output/behavior in the diff package. Adding a focused unit test that exercises a multiline YAML value change and asserts the presence/absence of context lines based on Context would help prevent regressions across dyff version changes.

Copilot generated this review using guidance from repository custom instructions.

_ = reportWriter.WriteReport(to)
}

Expand Down
Loading