Skip to content

Conversation

@ruben-arts
Copy link
Contributor

Description

This changes that we always write the requirement to the lockfile, and proactively fix that.

⚠️ This will unsatisfy some lockfiles where e.g. branch = "main" is specified in the requirement.

Fixes #5185

How Has This Been Tested?

I've tested this locally, using the example in the issue.

  • rev = "master"
  • branch = "master"
  • tag = "v0.14.0
  • Tested with and without multiple git dependencies.
  • Tested with "broken" lockfile first.

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools: Claude

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added sufficient tests to cover my changes.
  • I have verified that changes that would impact the JSON schema have been made in schema/model.py.

I struggle to find a nice way to test this except for the changes I already made to the tests.

Copy link
Contributor Author

@ruben-arts ruben-arts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self review, @nichmor please take a look at this.

let git_url = GitUrl::from_fields(
display_safe,
into_uv_git_reference(pinned_git_spec.source.reference.into()),
Some(git_oid),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No sure about this, it seems that the .with_precise didn't do what it should.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem was with this part into_uv_git_reference ( git reference wasn't saved ) when parsing from display_safe

{
// Use the reference from the original requirement instead of what UV resolved
pinned_git_spec.source.reference =
into_pixi_reference(original_git.reference().clone());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pushes in the actual requirement, is this right? It feels strange that that information is not in the resolved spec.

@ruben-arts ruben-arts requested a review from nichmor December 22, 2025 12:58
Copy link
Contributor

@nichmor nichmor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good but for some reason I can't solve anymore this pixi.toml

[workspace]
authors = ["author"]
channels = ["conda-forge"]
name = "pixi-git"
platforms = ["osx-arm64", "linux-64"]
version = "0.1.0"

[tasks]

[dependencies]
python = ">=3.14.2,<3.15"

[pypi-dependencies]
ec-tools = {git = "https://github.com/echemdb/ec-tools.git", branch = "main" }

let git_url = GitUrl::from_fields(
display_safe,
into_uv_git_reference(pinned_git_spec.source.reference.into()),
Some(git_oid),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem was with this part into_uv_git_reference ( git reference wasn't saved ) when parsing from display_safe

} = &original_req.source
{
// Use the reference from the original requirement instead of what UV resolved
pinned_git_spec.source.reference =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you always want to override the reference? It may be that the reference is already set, maybe we can skip in this case, searching through the original requirements?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how to fix this. The reference is default branch but there must be multiple code paths as it sometimes is written without and sometimes with the reference in the url.

@lucascolley lucascolley added git lock file bug Something isn't working labels Dec 27, 2025
@nichmor nichmor mentioned this pull request Dec 29, 2025
8 tasks
@ruben-arts
Copy link
Contributor Author

Closing as @nichmor is working on a different fix: #5215

@ruben-arts ruben-arts closed this Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working git lock file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pixi.lock always outdated with multiple git pypi dependency specifying branches

3 participants