Drop diffs with only mode changes

This commit is contained in:
Sven van Heugten 2026-03-05 20:55:47 +01:00
parent 810ccab884
commit 26447c8205
No known key found for this signature in database
GPG key ID: D612F88666F4F660
2 changed files with 4 additions and 4 deletions

View file

@ -118,7 +118,7 @@ def main() -> None:
for section in sections: for section in sections:
if not section["hunks"]: if not section["hunks"]:
output_lines.extend(section["header"]) left_out = True
continue continue
kept_hunks = [] kept_hunks = []

View file

@ -30,7 +30,7 @@ setup() {
assert_output "" assert_output ""
} }
@test "keeps diff with only mode change" { @test "drops diff with only mode change" {
printf "%s\n" "foo" >"$BATS_TEST_TMPDIR/old" printf "%s\n" "foo" >"$BATS_TEST_TMPDIR/old"
printf "%s\n" "foo" >"$BATS_TEST_TMPDIR/new" printf "%s\n" "foo" >"$BATS_TEST_TMPDIR/new"
chmod 0644 "$BATS_TEST_TMPDIR/old" chmod 0644 "$BATS_TEST_TMPDIR/old"
@ -40,8 +40,8 @@ setup() {
"$BATS_TEST_TMPDIR/new" || true)" "$BATS_TEST_TMPDIR/new" || true)"
run mechanicaldiff.py foo bar <<<"$diff_output" run mechanicaldiff.py foo bar <<<"$diff_output"
assert_success assert_failure
assert_output "$diff_output" assert_output ""
} }
@test "drops one hunk and keeps another" { @test "drops one hunk and keeps another" {