| ... | @@ -1416,6 +1416,21 @@ pub const Tree = struct { | ... | @@ -1416,6 +1416,21 @@ pub const Tree = struct { |
| 1416 | if (self.perm_other != other.perm_other) return false; | 1416 | if (self.perm_other != other.perm_other) return false; |
| 1417 | return true; | 1417 | return true; |
| 1418 | } | 1418 | } |
| | 1419 | |
| | 1420 | pub fn intbytes(self: Mode) [6]u8 { |
| | 1421 | var b: [6]u8 = @splat('-'); |
| | 1422 | @memcpy(b[0..3], switch (self.type) { |
| | 1423 | .file => "100", |
| | 1424 | .directory => "040", |
| | 1425 | .submodule => "160", |
| | 1426 | .symlink => "120", |
| | 1427 | .none => "000", |
| | 1428 | }); |
| | 1429 | b[3] = @as(u8, @as(u3, @bitCast(self.perm_user))) + '0'; |
| | 1430 | b[4] = @as(u8, @as(u3, @bitCast(self.perm_group))) + '0'; |
| | 1431 | b[5] = @as(u8, @as(u3, @bitCast(self.perm_other))) + '0'; |
| | 1432 | return b; |
| | 1433 | } |
| 1419 | }; | 1434 | }; |
| 1420 | | 1435 | |
| 1421 | pub const Type = enum(u8) { | 1436 | pub const Type = enum(u8) { |