File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -387,6 +387,29 @@ pub fn build(b: *std.Build) !void {
387387 examples_step .dependOn (& example_run .step );
388388 }
389389
390+ // @Todo: is there a better way to do this? this feels hacky
391+ //
392+ // Fix the test fixture file permissions. This is necessary because Zig does
393+ // not respect the execute permission on files it extracts from dependencies.
394+ // Since we need those files to have the execute permission set for tests to
395+ // run successfully, we need to patch them before we bake them into the
396+ // test executable.
397+ {
398+ const file_paths = &[_ ]std.Build.LazyPath {
399+ libgit_root .path (b , "tests/resources/filemodes/exec_on" ),
400+ libgit_root .path (b , "tests/resources/filemodes/exec_off2on_staged" ),
401+ libgit_root .path (b , "tests/resources/filemodes/exec_off2on_workdir" ),
402+ libgit_root .path (b , "tests/resources/filemodes/exec_on_untracked" ),
403+ };
404+ for (file_paths ) | lazy | {
405+ const path = lazy .getPath2 (b , null );
406+ const file = try std .fs .cwd ().openFile (path , .{
407+ .mode = .read_write ,
408+ });
409+ try file .setPermissions (.{ .inner = .{ .mode = 0o755 } });
410+ }
411+ }
412+
390413 const test_step = b .step ("test" , "Run core unit tests (requires python)" );
391414 {
392415 const gen_cmd = b .addSystemCommand (&.{"python" });
You can’t perform that action at this time.
0 commit comments