Skip to content

ability to fetch git commits from the git clone that contains build.zig without network access #14293

Open
@andrewrk

Description

@andrewrk

Extracted from #14265.

zig build could notice from .git/config, if it exists, that a particular remote's URL matches the URL used from the build.zig.lulz file.

For example,

.git/config

[remote "origin"]
	url = git@github.com:ziglang/zig.git
	fetch = +refs/heads/*:refs/remotes/origin/*

build.zig.lulz

.{
    // ...
    .url = "git+ssh://git@github.com:ziglang/zig.git#3ab43988c1cc5e22c84faccd1816df6e8094d9a3",
    // ...
}

Zig should be able to conclude that the requested url is the same url as the git clone that contains the build.zig.lulz file itself, and thereby search for the ref 3ab43988c1cc5e22c84faccd1816df6e8094d9a3 in the local clone rather than the network.

Related:

If the ref could not be found in the local clone, an error should be emitted, rather than trying to do any fetching on the user's behalf. The error message could suggest a command to run however, for example, git fetch origin --tags.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSolving this issue will likely involve adding new logic or components to the codebase.zig build systemstd.Build, the build runner, `zig build` subcommand, package management

    Type

    No type

    Projects

    Status

    Fetching

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions