From a1aae60a946d6158b4c8eccd43ace95e36e4e42e Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Wed, 9 Mar 2022 17:30:48 -0800 Subject: [PATCH] update GitRepoStep to change to correct revision prior to updating submodules --- GitRepoStep.zig | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/GitRepoStep.zig b/GitRepoStep.zig index 1a83e2e..a704c4e 100644 --- a/GitRepoStep.zig +++ b/GitRepoStep.zig @@ -96,7 +96,9 @@ fn make(step: *std.build.Step) !void { defer args.deinit(); try args.append("git"); try args.append("clone"); - try args.append("--recurse-submodules"); + // This is a bad idea, because we really want to get to the correct + // revision before we go updating submodules + // try args.append("--recurse-submodules"); try args.append(self.url); // TODO: clone it to a temporary location in case of failure // also, remove that temporary location before running @@ -116,6 +118,17 @@ fn make(step: *std.build.Step) !void { "-b", "fordep", }); + + // Now that we're on the correct revision, we can update submodules + try run(self.builder, &[_][]const u8{ + "git", + "-C", + self.path, + "submodule", + "update", + "--init", + "--recursive", + }); }; try self.checkSha(); @@ -171,7 +184,7 @@ fn run(builder: *std.build.Builder, argv: []const []const u8) !void { try writer.print("{s}\"{s}\"", .{ prefix, arg }); prefix = " "; } - std.log.info("[RUN] {s}", .{msg.items}); + std.log.debug("[RUN] {s}", .{msg.items}); } const child = try std.ChildProcess.init(argv, builder.allocator);