fish_indent: Truncate file to the size of the text

This can happen in case the formatted script is shorter, e.g. because
we ditched superfluous quotes.

Fixes #10724
This commit is contained in:
Fabian Boehm
2024-09-16 21:07:53 +02:00
parent 9fafae7a8a
commit e27f4a3744
2 changed files with 10 additions and 1 deletions

View File

@@ -525,3 +525,9 @@ end
# CHECK: {{^}}"
# CHECK: {{^}} end
# CHECK: {{^}})
set -l tmpdir (mktemp -d)
echo 'echo "foo" "bar"' > $tmpdir/indent_test.fish
$fish_indent --write $tmpdir/indent_test.fish
cat $tmpdir/indent_test.fish
# CHECK: echo foo bar