Skip to content

Commit 4067f64

Browse files
committed
deps: V8: stop torque updating unchanged empty files
Make torque only write out files if the file doesn't exist or the contents have changed.
1 parent 76a073b commit 4067f64

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

deps/v8/src/torque/utils.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,15 @@ void ReplaceFileContentsIfDifferent(const std::string& file_path,
317317
const std::string& contents) {
318318
std::ifstream old_contents_stream(file_path.c_str());
319319
std::string old_contents;
320+
bool old_file = false;
320321
if (old_contents_stream.good()) {
321322
std::istreambuf_iterator<char> eos;
323+
old_file = true;
322324
old_contents =
323325
std::string(std::istreambuf_iterator<char>(old_contents_stream), eos);
324326
old_contents_stream.close();
325327
}
326-
if (old_contents.length() == 0 || old_contents != contents) {
328+
if (!old_file || old_contents != contents) {
327329
std::ofstream new_contents_stream;
328330
new_contents_stream.open(file_path.c_str());
329331
new_contents_stream << contents;

0 commit comments

Comments
 (0)