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

Shea Levy shea at shealevy.com
Thu Jan 1 14:36:20 CET 2015

This PR should make this problem better (though it won’t handle the ‘rev changed but url didn’t’ case) https://github.com/NixOS/nixpkgs/pull/5521 <https://github.com/NixOS/nixpkgs/pull/5521>

> On Jan 1, 2015, at 1:27 PM, Shea Levy <shea at shealevy.com> wrote:
>> On Jan 1, 2015, at 1:22 PM, Bjørn Forsman <bjorn.forsman at gmail.com> wrote:
>> 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.
> No, the hashed mirror causes this for fetchurl, but for fetchgit the drv name is always “git-export” so even without the hashed mirror this is true (same output hash + same drv name = same output path).
>> Best regards,
>> Bjørn Forsman
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150101/bf8644b7/attachment-0001.html 

More information about the nix-dev mailing list