mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:34:59 +00:00
gml-format: Skip writing formatted GML to file if no changes were made
This stops all GML files from appeared under the "Changes not staged for commit" section of the commit message comment due to the changed last-modified timestamp of the file.
This commit is contained in:
parent
0a93bf5e7b
commit
9839a1699f
1 changed files with 2 additions and 0 deletions
|
@ -30,6 +30,8 @@ ErrorOr<bool> format_file(StringView path, bool inplace)
|
|||
}
|
||||
auto formatted_gml = formatted_gml_or_error.release_value();
|
||||
if (inplace && !read_from_stdin) {
|
||||
if (formatted_gml == contents)
|
||||
return true;
|
||||
if (!file->seek(0) || !file->truncate(0)) {
|
||||
warnln("Could not truncate {}: {}", path, file->error_string());
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue