Skip to content
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 (backport #12107) #12266

Merged
merged 4 commits into from
Jan 15, 2025

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jan 15, 2025

Motivation

Closes #9708 (again).

This patch:

  • (naively) Resolves relative paths to local git repos, returning absolute paths, thus allowing flake URIs such as git+file:./${submodule} to continue working.
  • Adds tests to prevent future breakages.

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:

A better fix is outlined by @roberth in https://discourse.nixos.org/t/57783, namely:

This bug seems to have allowed relative git flake inputs to be resolved against the current working directory (as in POSIX), and this tends to work out ok in the context of flakes, but is the wrong behavior, as it should resolve against the flake.nix base directory instead.
Supporting relative paths in fetchTree would add significant value.
This behavior was used as a workaround for lacking relative flake input or “subflake” support.


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

Friendly pings:


This is an automatic backport of pull request #12107 done by [Mergify](https://mergify.com).

bryango and others added 4 commits January 15, 2025 19:56
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.

(cherry picked from commit 9d088fa)
@mergify mergify bot requested a review from edolstra as a code owner January 15, 2025 19:56
@mergify mergify bot added the merge-queue label Jan 15, 2025
@github-actions github-actions bot added with-tests Issues related to testing. PRs with tests have some priority fetching Networking with the outside (non-Nix) world, input locking labels Jan 15, 2025
@mergify mergify bot merged commit 98506a5 into 2.25-maintenance Jan 15, 2025
23 checks passed
@mergify mergify bot deleted the mergify/bp/2.25-maintenance/pr-12107 branch January 15, 2025 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fetching Networking with the outside (non-Nix) world, input locking merge-queue with-tests Issues related to testing. PRs with tests have some priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants