mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
incr-check: deal with Windows stupidity
The real problem here is that Git for Windows has horrendous defaults which convert LF to CRLF. However, rather than changing this configuration on the CI runners, it's worth supporting inexplicable CRLF in these files so that anyone else cloning Zig on Windows doesn't get unexpected test failures.
This commit is contained in:
parent
f47b8de2ad
commit
7ef345f342
@ -660,21 +660,28 @@ const Case = struct {
|
||||
if (root_source_file == null)
|
||||
root_source_file = val;
|
||||
|
||||
const start_index = it.index.?;
|
||||
const src = while (true) : (line_n += 1) {
|
||||
// Because Windows is so excellent, we need to convert CRLF to LF, so
|
||||
// can't just slice into the input here. How delightful!
|
||||
var src: std.ArrayListUnmanaged(u8) = .empty;
|
||||
|
||||
while (true) {
|
||||
const old = it;
|
||||
const next_line = it.next() orelse fatal("line {d}: unexpected EOF", .{line_n});
|
||||
const next_line_raw = it.next() orelse fatal("line {d}: unexpected EOF", .{line_n});
|
||||
const next_line = std.mem.trimRight(u8, next_line_raw, "\r");
|
||||
if (std.mem.startsWith(u8, next_line, "#")) {
|
||||
const end_index = old.index.?;
|
||||
const src = bytes[start_index..end_index];
|
||||
it = old;
|
||||
break src;
|
||||
break;
|
||||
}
|
||||
};
|
||||
line_n += 1;
|
||||
|
||||
try src.ensureUnusedCapacity(arena, next_line.len + 1);
|
||||
src.appendSliceAssumeCapacity(next_line);
|
||||
src.appendAssumeCapacity('\n');
|
||||
}
|
||||
|
||||
try changes.append(arena, .{
|
||||
.name = val,
|
||||
.bytes = src,
|
||||
.bytes = src.items,
|
||||
});
|
||||
} else if (std.mem.eql(u8, key, "rm_file")) {
|
||||
if (updates.items.len == 0) fatal("line {d}: rm_file directive before update", .{line_n});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user