aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanne Heß <janne@hess.ooo>2019-10-30 17:13:21 +0100
committerJanne Heß <janne@hess.ooo>2019-10-30 17:15:38 +0100
commit2d1d1e3083dc5c801b81fc0d58ba8d767b4022a8 (patch)
tree820251bc435fb9e010f5c232f647ba4c9643c165
parent9cac895406724e0304dff140379783c4d786e855 (diff)
Replace git show with git log
git show seems to print the entire tag message when being called on a tag instead of a commit. git log instead always prints the correct timestamp in my tests. The error nix prints is: `error: stoull`.
-rw-r--r--src/libexpr/primops/fetchGit.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libexpr/primops/fetchGit.cc b/src/libexpr/primops/fetchGit.cc
index e8d87ffa4..aea34b1dd 100644
--- a/src/libexpr/primops/fetchGit.cc
+++ b/src/libexpr/primops/fetchGit.cc
@@ -149,7 +149,7 @@ GitInfo exportGit(ref<Store> store, std::string uri,
gitInfo.revCount = haveCommits ? std::stoull(runProgram("git", true, { "-C", uri, "rev-list", "--count", "HEAD" })) : 0;
// FIXME: maybe we should use the timestamp of the last
// modified dirty file?
- gitInfo.lastModified = haveCommits ? std::stoull(runProgram("git", true, { "-C", uri, "show", "-s", "--format=%ct", "HEAD" })) : 0;
+ gitInfo.lastModified = haveCommits ? std::stoull(runProgram("git", true, { "-C", uri, "log", "-1", "--format=%ct", "HEAD" })) : 0;
return gitInfo;
}
@@ -267,7 +267,7 @@ GitInfo exportGit(ref<Store> store, std::string uri,
gitInfo.storePath = store->addToStore(name, tmpDir);
gitInfo.revCount = std::stoull(runProgram("git", true, { "-C", repoDir, "rev-list", "--count", gitInfo.rev.gitRev() }));
- gitInfo.lastModified = std::stoull(runProgram("git", true, { "-C", repoDir, "show", "-s", "--format=%ct", gitInfo.rev.gitRev() }));
+ gitInfo.lastModified = std::stoull(runProgram("git", true, { "-C", repoDir, "log", "-1", "--format=%ct", gitInfo.rev.gitRev() }));
cacheGitInfo(name, gitInfo);