-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
fetchers/git: make relative path absolute for local repo #12107
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gave it a quick try and it does work for me:
ivan@tobati:~/nixops/aij$ /nix/store/bn0djaymav6qa4zg5vaskzcaija5nq2p-nix-2.26.0pre20241227_9111645/bin/nix flake update
warning: updating lock file '/home/ivan/nixops/aij/flake.lock':
• Updated input 'unstable':
'git+file:unstable?rev=3f0036916daca9836ba2c3f236b0ae051949a0a8' (2024-12-21)
→ 'git+file:unstable?ref=refs/heads/ipmiutil&rev=174ae1b581ddd6d5a6c55684da392e0baf500b1e' (2024-12-27)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partial fix
For the example in #9709, namely
doesn't this result in a lock file that has the absolute path of the original Git repo in it? I.e. if I run |
@edolstra Actually, no! It still gets locked to the relative path and shows up in |
cat > "$rootRepo"/flake.nix <<EOF | ||
{ | ||
inputs.subRepo.url = "git+file:./submodule"; | ||
outputs = { ... }: { }; | ||
} | ||
EOF | ||
git -C "$rootRepo" add flake.nix | ||
git -C "$rootRepo" commit -m "Add flake.nix" | ||
( | ||
cd "$rootRepo" | ||
# The submodule must be locked to the relative path, | ||
# _not_ the absolute path: | ||
[[ $(nix flake metadata --json | jq -r .locks.nodes.subRepo.locked.url) = "file:./submodule" ]] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
submodule
does get locked to the relative path file:./submodule
. I don't understand why but hey, it works!
Draft-ing and un-draft-ing to try to unlock the new CI... |
Rebased for GHA config update |
Relative, local git repo used to work (for submodules), but it fails after 3e0129c. This commit adds a test to prevent such failure in the future.
Rebased again, conflicts resolved, CI happy. |
Thanks! @mergify queue |
Motivation
Closes #9708 (again).
This patch:
git+file:./${submodule}
to continue working.Context
Flake URIs such as
git+file:./${submodule}
used to work before 2.18, but broke in 2.19, was fixed later, and broke again recently since 3e0129c, resulting in a core-dumped assertion error in #9708 (comment).This PR suppresses the error and allows
git+file:./${submodule}
to continue working. However, this fix is not ideal and should potentially be superseded by a better submodule implementation in the future. See:git+file:./${submodule}
no longer works #9708A better fix is outlined by @roberth in https://discourse.nixos.org/t/57783, namely:
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.
Friendly pings: