[Nix-dev] Why does fetchgit not look at the URL to determine the cache location?

Bjørn Forsman bjorn.forsman at gmail.com
Thu Jan 1 14:22:37 CET 2015

On 31 December 2014 at 17:50, Rico Huijbers <rix0rrr at gmail.com> wrote:
> Hi,
> When I copy/paste a fetchgit block from another file, and change the URL and rev without changing the hash, I expect the download to fail (and tell me the hash).
> However, what actually happens is that fetchgit just looks at the hash, sees that *something* with that hash has already been downloaded, and happily proceeds with the rest of the script using the wrong source files. Now I have to go and do nix-prefetch-git every time.
> Shouldn’t fetchgit build the hash from URL and rev, as opposed to the provided hash? Or am I doing it wrong?

AFAIK, it's the nixos hashed mirror that creates this behaviour.
fetchgit itself will re-download if the _basename_ of the URL changes,
but when the hashed mirror has a file with the given hash, it is
downloaded instead.

So it's the hashed mirror that needs to take the basename of URL into account.

Best regards,
Bjørn Forsman

More information about the nix-dev mailing list