mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 19:57:45 +03: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
Notes:
sideshowbarker
2024-07-17 18:57:00 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/9839a1699f Pull-request: https://github.com/SerenityOS/serenity/pull/12467 Reviewed-by: https://github.com/kleinesfilmroellchen ✅
@ -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…
Reference in New Issue
Block a user