Skip to content

fix(builtins): change diff default output to normal format#1022

Merged
chaliy merged 1 commit intomainfrom
fix/issue-966-diff-normal-format
Apr 2, 2026
Merged

fix(builtins): change diff default output to normal format#1022
chaliy merged 1 commit intomainfrom
fix/issue-966-diff-normal-format

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 2, 2026

Summary

  • Changed diff builtin default output from unified to normal (ed-style) format, matching /usr/bin/diff
  • Added format_normal() implementation for ed-style output (change/add/delete commands)
  • -u flag still produces unified format

Why

Scripts that parse diff output expecting the default format got wrong results because bashkit defaulted to unified format while real bash/diff defaults to normal format.

Tests

  • Updated all existing unit tests to expect normal format by default
  • Added test_diff_normal_format_default — verifies ed-style output and absence of unified markers
  • Added test_diff_unified_with_flag — verifies -u still produces unified format
  • Added spec tests: diff_default_normal_format and diff_unified_with_flag
  • 100% bash comparison match (1692/1692)

Closes #966

The diff builtin was defaulting to unified format, but real /usr/bin/diff
defaults to normal (ed-style) format. Scripts parsing diff output expecting
the default format got wrong results.

Closes #966
@chaliy chaliy merged commit 0455d7d into main Apr 2, 2026
27 checks passed
@chaliy chaliy deleted the fix/issue-966-diff-normal-format branch April 2, 2026 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

diff builtin defaults to unified format instead of normal format

1 participant