Skip to content

builtins.fetchGit re-fetches if packed-refs are used #13457

@fzakaria

Description

@fzakaria

Describe the bug

fetchGit will utilize the git cache and avoid refetching when possible.
It relies on the presence of either the commit when rev is provided or checks if the ref refs/heads/<ref_name> if ref is provided.

Unfortunately, git can occasionally "pack references" which moves the references from individual files to a single unifies file.

When this occurs, nix can no longer check for the presence of the ref to check for the mtime and will refetch unecessarily.

Steps To Reproduce

Please see #13456 which adds a test case.

Expected behavior

fetchGit should still cache even if it's a packed-ref


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions