builtins.fetchgit: Support specifying commit hashes

This adds an argument "rev" specififying the Git commit hash. The
existing argument "rev" is renamed to "ref". The default value for
"ref" is "master". When specifying a hash, it's necessary to specify a
ref since we're not cloning the entire repository but only fetching a
specific ref.

Example usage:

  builtins.fetchgit {
    url = https://github.com/NixOS/nixpkgs.git;
    ref = "release-16.03";
    rev = "c1c0484041ab6f9c6858c8ade80a8477c9ae4442";
  };
This commit is contained in:
Eelco Dolstra 2017-07-27 18:08:23 +02:00
parent 9f64cb89cb
commit 7480f4f9a4
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
2 changed files with 29 additions and 9 deletions

View file

@ -8,7 +8,7 @@ namespace nix {
class Store;
Path exportGit(ref<Store> store,
const std::string & uri, const std::string & rev);
Path exportGit(ref<Store> store, const std::string & uri,
const std::string & ref, const std::string & rev = "");
}