about summary refs log tree commit diff
path: root/src/libexpr/primops/fetchgit.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-10-30T10·49+0100
committerEelco Dolstra <edolstra@gmail.com>2017-10-30T10·49+0100
commite38382895deef4c136b7425f480884d122f3c5ae (patch)
tree5b92f8dddb73187022697b9655244e70b3d791db /src/libexpr/primops/fetchgit.hh
parentf9686885be54a9b0f8947713a414de4ad3182037 (diff)
builtins.fetchGit: Return an attrset with revision info
This adds rev, shortRev and revCount attributes, equal to what Hydra
provides. E.g.

  $ nix eval '(fetchGit https://github.com/NixOS/patchelf.git)'
  { outPath = "/nix/store/ghigrkw02l440g8vfxa9wj4c3zpfmw99-source"; rev = "29c085fd9d3fc972f75b3961905d6b4ecce7eb2b"; revCount = 303; shortRev = "29c085f"; }
Diffstat (limited to 'src/libexpr/primops/fetchgit.hh')
-rw-r--r--src/libexpr/primops/fetchgit.hh12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/libexpr/primops/fetchgit.hh b/src/libexpr/primops/fetchgit.hh
index 4bf34b76f8dc..056b6fcbe78d 100644
--- a/src/libexpr/primops/fetchgit.hh
+++ b/src/libexpr/primops/fetchgit.hh
@@ -2,13 +2,21 @@
 
 #include <string>
 
-#include "ref.hh"
+#include "util.hh"
 
 namespace nix {
 
 class Store;
 
-Path exportGit(ref<Store> store, const std::string & uri,
+struct GitInfo
+{
+    Path storePath;
+    std::string rev;
+    std::string shortRev;
+    uint64_t revCount = 0;
+};
+
+GitInfo exportGit(ref<Store> store, const std::string & uri,
     const std::string & ref, const std::string & rev = "",
     const std::string & name = "");