diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-04-19 14:15:51 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2019-04-19 14:15:51 +0200 |
commit | bc259192b4e1f90c575ddc83814b82cca829a4f8 (patch) | |
tree | 5e277e87502f1e69851fcefc43d8c6243f805584 /src/libexpr/primops/fetchGit.cc | |
parent | 0cbda84f5b14aba0416cb65f88f8e9d487895207 (diff) |
fetchGit: Return revCount for dirty working trees
Diffstat (limited to 'src/libexpr/primops/fetchGit.cc')
-rw-r--r-- | src/libexpr/primops/fetchGit.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libexpr/primops/fetchGit.cc b/src/libexpr/primops/fetchGit.cc index eb95208de..e79eacafe 100644 --- a/src/libexpr/primops/fetchGit.cc +++ b/src/libexpr/primops/fetchGit.cc @@ -68,6 +68,7 @@ GitInfo exportGit(ref<Store> store, std::string uri, }; gitInfo.storePath = store->addToStore("source", uri, true, htSHA256, filter); + gitInfo.revCount = std::stoull(runProgram("git", true, { "-C", uri, "rev-list", "--count", "HEAD" })); return gitInfo; } @@ -200,7 +201,7 @@ GitInfo exportGit(ref<Store> store, std::string uri, json["uri"] = uri; json["name"] = name; json["rev"] = gitInfo.rev.gitRev(); - json["revCount"] = *gitInfo.revCount; + json["revCount"] = gitInfo.revCount; writeFile(storeLink, json.dump()); @@ -254,7 +255,7 @@ static void prim_fetchGit(EvalState & state, const Pos & pos, Value * * args, Va mkString(*state.allocAttr(v, state.sOutPath), gitInfo.storePath, PathSet({gitInfo.storePath})); mkString(*state.allocAttr(v, state.symbols.create("rev")), gitInfo.rev.gitRev()); mkString(*state.allocAttr(v, state.symbols.create("shortRev")), gitInfo.rev.gitShortRev()); - mkInt(*state.allocAttr(v, state.symbols.create("revCount")), gitInfo.revCount.value_or(0)); + mkInt(*state.allocAttr(v, state.symbols.create("revCount")), gitInfo.revCount); v.attrs->sort(); if (state.allowedPaths) |