| ... | ... | @@ -74,7 +74,7 @@ pub fn version(alloc: std.mem.Allocator) !string { |
| 74 | 74 | defer alloc.free(result.stdout); |
| 75 | 75 | defer alloc.free(result.stderr); |
| 76 | 76 | std.debug.assert(result.term == .exited and result.term.exited == 0); |
| 77 | | return try alloc.dupe(u8, extras.trimPrefixEnsure(std.mem.trimRight(u8, result.stdout, "\n"), "git version ").?); |
| 77 | return try alloc.dupe(u8, extras.trimPrefixEnsure(std.mem.trimEnd(u8, result.stdout, "\n"), "git version ").?); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /// Returns the result of running `git rev-parse HEAD` |
| ... | ... | @@ -84,7 +84,7 @@ pub fn getHEAD(alloc: std.mem.Allocator, dir: nfs.Dir) !?CommitId { |
| 84 | 84 | const t = tracer.trace(@src(), "", .{}); |
| 85 | 85 | defer t.end(); |
| 86 | 86 | |
| 87 | | const h = std.mem.trimRight(u8, try dir.readFileAlloc(alloc, "HEAD", 1024), "\n"); |
| 87 | const h = std.mem.trimEnd(u8, try dir.readFileAlloc(alloc, "HEAD", 1024), "\n"); |
| 88 | 88 | |
| 89 | 89 | if (std.mem.startsWith(u8, h, "ref:")) { |
| 90 | 90 | blk: { |
| ... | ... | @@ -95,7 +95,7 @@ pub fn getHEAD(alloc: std.mem.Allocator, dir: nfs.Dir) !?CommitId { |
| 95 | 95 | error.ENOENT => break :blk, |
| 96 | 96 | else => |e| return e, |
| 97 | 97 | }; |
| 98 | | return ensureObjId(CommitId, std.mem.trimRight(u8, reffile, "\n")); |
| 98 | return ensureObjId(CommitId, std.mem.trimEnd(u8, reffile, "\n")); |
| 99 | 99 | } |
| 100 | 100 | blk: { |
| 101 | 101 | const pckedrfs = dir.readFileAlloc(alloc, "packed-refs", 1024 * 1024 * 1024) catch |err| switch (err) { |
| ... | ... | @@ -143,7 +143,7 @@ pub fn revList(alloc: std.mem.Allocator, dir: nfs.Dir, comptime count: u31, from |
| 143 | 143 | sub_path, |
| 144 | 144 | }); |
| 145 | 145 | std.debug.assert(result.term == .exited and result.term.exited == 0); |
| 146 | | return std.mem.trimRight(u8, result.stdout, "\n"); |
| 146 | return std.mem.trimEnd(u8, result.stdout, "\n"); |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | // TODO make this inspect .git/objects manually |
| ... | ... | @@ -156,7 +156,7 @@ pub fn revListAll(alloc: std.mem.Allocator, dir: nfs.Dir, from: CommitId, sub_pa |
| 156 | 156 | |
| 157 | 157 | const result = try root.child_process.run(alloc, dir, .ignore, .pipe, .pipe, 1024 * 50, &.{ "git", "rev-list", from.id, "--", sub_path }); |
| 158 | 158 | std.debug.assert(result.term == .exited and result.term.exited == 0); |
| 159 | | return std.mem.trimRight(u8, result.stdout, "\n"); |
| 159 | return std.mem.trimEnd(u8, result.stdout, "\n"); |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | pub fn parseCommit(alloc: std.mem.Allocator, commitfile: string) !Commit { |
| ... | ... | @@ -1583,26 +1583,16 @@ fn MultiArrayList(T: type) type { |
| 1583 | 1583 | const info = @typeInfo(T).@"struct"; |
| 1584 | 1584 | |
| 1585 | 1585 | pub const Items = blk: { |
| 1586 | | var fields: [info.fields.len]std.builtin.Type.StructField = undefined; |
| 1586 | var names: [info.fields.len][]const u8 = undefined; |
| 1587 | var types: [info.fields.len]type = undefined; |
| 1588 | var attrs: [info.fields.len]std.builtin.Type.StructField.Attributes = undefined; |
| 1587 | 1589 | for (info.fields, 0..) |f, i| { |
| 1588 | 1590 | const empty_slice: []f.type = &[_]f.type{}; |
| 1589 | | fields[i] = .{ |
| 1590 | | .name = f.name, |
| 1591 | | .type = []f.type, |
| 1592 | | .default_value_ptr = @ptrCast(&empty_slice), |
| 1593 | | .is_comptime = false, |
| 1594 | | .alignment = @alignOf(f.type), |
| 1595 | | }; |
| 1591 | names[i] = f.name; |
| 1592 | types[i] = f.type; |
| 1593 | attrs[i] = .{ .default_value_ptr = @ptrCast(&empty_slice) }; |
| 1596 | 1594 | } |
| 1597 | | const _fields = fields; |
| 1598 | | break :blk @Type(.{ |
| 1599 | | .@"struct" = .{ |
| 1600 | | .layout = .auto, |
| 1601 | | .fields = &_fields, |
| 1602 | | .decls = &.{}, |
| 1603 | | .is_tuple = false, |
| 1604 | | }, |
| 1605 | | }); |
| 1595 | break :blk @Struct(.auto, null, &names, &types, &attrs); |
| 1606 | 1596 | }; |
| 1607 | 1597 | |
| 1608 | 1598 | pub fn deinit(self: *const Self, gpa: std.mem.Allocator) void { |