| ... | @@ -98,12 +98,14 @@ test { | ... | @@ -98,12 +98,14 @@ test { |
| 98 | var git_dir = try std.fs.cwd().openDir(".git", .{}); | 98 | var git_dir = try std.fs.cwd().openDir(".git", .{}); |
| 99 | defer git_dir.close(); | 99 | defer git_dir.close(); |
| 100 | try expect(try git.getObject(alloc, git_dir, "5403fecad0fde9120535321f222a061abc2849d9")).toEqualString( | 100 | try expect(try git.getObject(alloc, git_dir, "5403fecad0fde9120535321f222a061abc2849d9")).toEqualString( |
| 101 | \\100644 blob 8e8d2ceba4b327ce9db93f988492d0e21a461012	.gitattributes | 101 | // zig fmt: off |
| 102 | \\100644 blob bb2a57bd81d13975f2a74ae5dd0e652de07bb8a7	.gitignore | 102 | "100644 blob 8e8d2ceba4b327ce9db93f988492d0e21a461012\t.gitattributes\n" ++ |
| 103 | \\100644 blob 37be0c1cfa4f097edbb1fb5c0585cd18cb08df13	LICENSE | 103 | "100644 blob bb2a57bd81d13975f2a74ae5dd0e652de07bb8a7\t.gitignore\n" ++ |
| 104 | \\100644 blob b229eadbd5d6655c2dfbaca5a5f68f2f8f3c5454	git.zig | 104 | "100644 blob 37be0c1cfa4f097edbb1fb5c0585cd18cb08df13\tLICENSE\n" ++ |
| 105 | \\100644 blob bb3f1c135632cfca760bd84fb18acdab8dae8ec3	zig.mod | 105 | "100644 blob b229eadbd5d6655c2dfbaca5a5f68f2f8f3c5454\tgit.zig\n" ++ |
| 106 | \\ | 106 | "100644 blob bb3f1c135632cfca760bd84fb18acdab8dae8ec3\tzig.mod\n" ++ |
| | 107 | "" |
| | 108 | // zig fmt: on |
| 107 | ); | 109 | ); |
| 108 | } | 110 | } |
| 109 | | 111 | |
| ... | @@ -138,28 +140,31 @@ test { | ... | @@ -138,28 +140,31 @@ test { |
| 138 | var git_dir = try std.fs.cwd().openDir(".git", .{}); | 140 | var git_dir = try std.fs.cwd().openDir(".git", .{}); |
| 139 | defer git_dir.close(); | 141 | defer git_dir.close(); |
| 140 | try expect(try git.getTreeDiff(alloc, git_dir, .{ .id = "a542da41f1f0c59fdd0e1527cf5ff9de3f6a0c8e" }, .{ .id = "c39f57f6bb01664a7146ddbfc3debe76ec135f44" })).toEqualString( | 142 | try expect(try git.getTreeDiff(alloc, git_dir, .{ .id = "a542da41f1f0c59fdd0e1527cf5ff9de3f6a0c8e" }, .{ .id = "c39f57f6bb01664a7146ddbfc3debe76ec135f44" })).toEqualString( |
| 141 | \\:100644 100644 73c7032166db0eb23c4be11a4ff8ff26ec47c582 b229eadbd5d6655c2dfbaca5a5f68f2f8f3c5454 M	git.zig | 143 | // zig fmt: off |
| 142 | \\ | 144 | ":100644 100644 73c7032166db0eb23c4be11a4ff8ff26ec47c582 b229eadbd5d6655c2dfbaca5a5f68f2f8f3c5454 M\tgit.zig\n" ++ |
| 143 | \\diff --git a/git.zig b/git.zig | 145 | "\n" ++ |
| 144 | \\index 73c7032..b229ead 100644 | 146 | "diff --git a/git.zig b/git.zig\n" ++ |
| 145 | \\--- a/git.zig | 147 | "index 73c7032..b229ead 100644\n" ++ |
| 146 | \\+++ b/git.zig | 148 | "--- a/git.zig\n" ++ |
| 147 | \\@@ -251,10 +251,10 @@ pub fn parseTree(alloc: std.mem.Allocator, treefile: string) !Tree { | 149 | "+++ b/git.zig\n" ++ |
| 148 | \\ fn parseTreeMode(input: string) !Tree.Object.Mode { | 150 | "@@ -251,10 +251,10 @@ pub fn parseTree(alloc: std.mem.Allocator, treefile: string) !Tree {\n" ++ |
| 149 | \\ std.debug.assert(input.len == 6); | 151 | " fn parseTreeMode(input: string) !Tree.Object.Mode {\n" ++ |
| 150 | \\ return .{ | 152 | " std.debug.assert(input.len == 6);\n" ++ |
| 151 | \\- .type = @intToEnum(Tree.Object.Type, try std.fmt.parseInt(u16, input[0..3], 10)), | 153 | " return .{\n" ++ |
| 152 | \\- .perm_user = @bitCast(Tree.Object.Perm, try std.fmt.parseInt(u3, input[3..][0..1], 8)), | 154 | "- .type = @intToEnum(Tree.Object.Type, try std.fmt.parseInt(u16, input[0..3], 10)),\n" ++ |
| 153 | \\- .perm_group = @bitCast(Tree.Object.Perm, try std.fmt.parseInt(u3, input[4..][0..1], 8)), | 155 | "- .perm_user = @bitCast(Tree.Object.Perm, try std.fmt.parseInt(u3, input[3..][0..1], 8)),\n" ++ |
| 154 | \\- .perm_other = @bitCast(Tree.Object.Perm, try std.fmt.parseInt(u3, input[5..][0..1], 8)), | 156 | "- .perm_group = @bitCast(Tree.Object.Perm, try std.fmt.parseInt(u3, input[4..][0..1], 8)),\n" ++ |
| 155 | \\+ .type = @enumFromInt(try std.fmt.parseInt(u16, input[0..3], 10)), | 157 | "- .perm_other = @bitCast(Tree.Object.Perm, try std.fmt.parseInt(u3, input[5..][0..1], 8)),\n" ++ |
| 156 | \\+ .perm_user = @bitCast(try std.fmt.parseInt(u3, input[3..][0..1], 8)), | 158 | "+ .type = @enumFromInt(try std.fmt.parseInt(u16, input[0..3], 10)),\n" ++ |
| 157 | \\+ .perm_group = @bitCast(try std.fmt.parseInt(u3, input[4..][0..1], 8)), | 159 | "+ .perm_user = @bitCast(try std.fmt.parseInt(u3, input[3..][0..1], 8)),\n" ++ |
| 158 | \\+ .perm_other = @bitCast(try std.fmt.parseInt(u3, input[5..][0..1], 8)), | 160 | "+ .perm_group = @bitCast(try std.fmt.parseInt(u3, input[4..][0..1], 8)),\n" ++ |
| 159 | \\ }; | 161 | "+ .perm_other = @bitCast(try std.fmt.parseInt(u3, input[5..][0..1], 8)),\n" ++ |
| 160 | \\ } | 162 | " };\n" ++ |
| 161 | \\ | 163 | " }\n" ++ |
| 162 | ++ " "); | 164 | " " ++ |
| | 165 | "" |
| | 166 | // zig fmt: on |
| | 167 | ); |
| 163 | } | 168 | } |
| 164 | | 169 | |
| 165 | test { | 170 | test { |