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

Flake inputs cannot be local shallow git repositories (regression from 2.19.3, bisected) #9820

Closed
Qyriad opened this issue Jan 20, 2024 · 4 comments
Labels

Comments

@Qyriad
Copy link
Member

Qyriad commented Jan 20, 2024

Describe the bug

Adding a git+file: input to a flake which refers to a repository which was cloned shallowly results in an error of the form:

error:
       … while updating the lock file of flake 'git+file:///path/to/flake'

       … while updating the flake input 'nixpkgs'

       … while fetching the input 'git+file:///tmp/nixpkgs?shallow=1'

       error: getting parent of Git commit '9fe5cee74762d8687c11151e2dfb88c77ac0b5d4': object not found - no match for id (2e7eed72914de2d0d4d38e4d545ca26702dba818)

In Nix 2.19.3 and before it works correctly.

Steps To Reproduce

  1. Shallow-clone a git repository, e.g. git clone https://github.com/NixOS/nixpkgs --depth=1 /tmp/nixpkgs.
  2. Make a flake that uses that repository as an input, with or without ?shallow=1, e.g.:
{
  inputs.nixpkgs.url = "git+file:///tmp/nixpkgs";
  outputs = { self, nixpkgs }: { };
}
  1. Run nix flake update in that flake directory

Expected behavior — Behavior on Nix 2.9.2:

The flake updates and locks successfully, outputting Added input 'nixpkgs': git+file:///tmp/nixpkgs?ref… (etc)

nix-env --version output
nix-env (Nix) 2.19.0pre20231031_ee36a44

Additional context

Bisect points to ee36a44 from #9240.

Priorities

Add 👍 to issues you find important.

@Qyriad Qyriad added the bug label Jan 20, 2024
@Qyriad Qyriad changed the title Flake inputs cannot be local shallow git repositories (regression from 2.19.3) Flake inputs cannot be local shallow git repositories (regression from 2.19.3, bisected) Jan 21, 2024
@thufschmitt
Copy link
Member

I think this should be fixed by #9811 (merged last week). Can you try again with it?

@thufschmitt
Copy link
Member

(cc @roberth )

@Qyriad
Copy link
Member Author

Qyriad commented Jan 22, 2024

Ah! This does appear to be fixed now, thanks!

@Qyriad Qyriad closed this as completed Jan 22, 2024
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/nix-flake-commands-fail-for-shallow-git-repositories/38555/3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants