Skip to documentation
SLOP

tiny.smg.git

Reference tiny.smg git

Defined in tiny.smg.

API (3)

Actions

Public operations.

Types and contracts

Public types and contracts.

No direct callersNo direct callstiny.smggit
Static calls · unresolved targets: unknown · external targets: unknown.

Source

Called byCallsdiffloadGraphFromGitgitrungitrefExists
Static calls · unresolved targets: 0 · external targets: 0.
Called byCallsNo direct callsblameentitychurncomputeprivate; no linktools.smg.src.churnexpectGittest; no linktools.smg.src.command.scan.changedtest: changed files include both side...test; no linktools.smg.src.command.scan.changedtest: changed files preserve a delete...+5 moregitrun
Static calls · unresolved targets: 0 · external targets: 2.

Source: tools/smg/src/git.zig

zig
const std = @import("std");pub const Output = struct {    ok: bool,    stdout: []const u8,    stderr: []const u8,};pub fn run(allocator: std.mem.Allocator, root: []const u8, argv: []const []const u8, limit: usize) !Output {    var io_state = std.Io.Threaded.init(allocator, .{});    defer io_state.deinit();    const result = std.process.run(allocator, io_state.io(), .{        .argv = argv,        .cwd = .{ .path = root },        .expand_arg0 = .expand,        .stdout_limit = .limited(limit),        .stderr_limit = .limited(limit),    }) catch return .{ .ok = false, .stdout = "", .stderr = "" };    return .{        .ok = switch (result.term) {            .exited => |code| code == 0,            else => false,        },        .stdout = result.stdout,        .stderr = result.stderr,    };}pub fn refExists(allocator: std.mem.Allocator, root: []const u8, ref: []const u8) !bool {    const commit_ref = try std.fmt.allocPrint(allocator, "{s}^{{commit}}", .{ref});    const output = try run(allocator, root, &.{ "git", "rev-parse", "--verify", "--quiet", commit_ref }, 1024 * 1024);    return output.ok;}test "run captures successful command output" {    var arena = std.heap.ArenaAllocator.init(std.testing.allocator);    defer arena.deinit();    const output = try run(arena.allocator(), ".", &.{ "git", "--version" }, 1024);    try std.testing.expect(output.ok);    try std.testing.expect(std.mem.startsWith(u8, output.stdout, "git version"));}test "run reports process launch failure as not ok" {    var arena = std.heap.ArenaAllocator.init(std.testing.allocator);    defer arena.deinit();    const output = try run(arena.allocator(), ".", &.{"smg-definitely-missing-command"}, 1024);    try std.testing.expect(!output.ok);    try std.testing.expectEqualStrings("", output.stdout);    try std.testing.expectEqualStrings("", output.stderr);}

Source: tools/smg/src/root.zig:22

zig
pub const git = @import("git.zig");

Complete caller list for git.run

10 direct callers.

Audit

Definitions4
Public names4
Members3
Version26.7.0
Revisiondaab053ee433