Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Tracked by #14265
andrewrk opened this issue Jan 13, 2023 · 0 comments
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase. zig build system std.Build, the build runner, `zig build` subcommand, package management
Milestone

Comments

@andrewrk
Copy link
Member

andrewrk commented Jan 13, 2023

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 = [email protected]:ziglang/zig.git
	fetch = +refs/heads/*:refs/remotes/origin/*

build.zig.lulz

.{
    // ...
    .url = "git+ssh://[email protected]: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.

@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. zig build system std.Build, the build runner, `zig build` subcommand, package management labels Jan 13, 2023
@andrewrk andrewrk added this to the 0.12.0 milestone Jan 13, 2023
@andrewrk andrewrk mentioned this issue Jan 13, 2023
32 tasks
@mlugg mlugg moved this to Fetching in Package Manager Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Solving this issue will likely involve adding new logic or components to the codebase. zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
Status: Fetching
Development

No branches or pull requests

1 participant