build: sort.py: quote diff lines (#6594)

To make it clearer when only whitespace was fixed on a given line.

Before:

    $ printf 'private-bin a,b \n' >foo.profile
    $ ./contrib/sort.py -n foo.profile
    sort.py: checking 1 profile(s)...
    foo.profile:1:-private-bin a,b
    foo.profile:1:+private-bin a,b

After:

    $ printf 'private-bin a,b \n' >foo.profile
    $ ./contrib/sort.py -n foo.profile
    sort.py: checking 1 profile(s)...
    foo.profile:1:-'private-bin a,b '
    foo.profile:1:+'private-bin a,b'

See commit 53ff8e0ad ("build: sort.py: strip trailing whitespace in all
lines", 2024-11-26) / PR #6556.
This commit is contained in:
Kelvin M. Klann 2024-12-29 12:06:14 +00:00 committed by GitHub
parent c222b7f692
commit df6620c11c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -94,8 +94,8 @@ def check_profile(filename, overwrite):
if line != original_line:
was_fixed = True
print(
f"{filename}:{lineno}:-{original_line}\n"
f"{filename}:{lineno}:+{line}"
f"{filename}:{lineno}:-'{original_line}'\n"
f"{filename}:{lineno}:+'{line}'"
)
fixed_profile.append(line)