summaryrefslogtreecommitdiff
path: root/file/git-file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file/git-file.c')
-rw-r--r--file/git-file.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/file/git-file.c b/file/git-file.c
index a03a7a7..1593115 100644
--- a/file/git-file.c
+++ b/file/git-file.c
@@ -547,13 +547,27 @@ static void recurse_time(const git_commit *commit, const git_oid *oid,
}
+#include "kicad/pl.h"
+
+
time_t vcs_git_time(void *ctx)
{
const struct vcs_git *vcs_git = ctx;
const git_oid *oid = git_object_id(vcs_git->obj);
time_t t = 0;
- recurse_time(vcs_git->commit, oid, &t);
+ /*
+ * @@@ Retrieving time from git is rather slow, so we only do it if
+ * there is any chance we'll actually need it.
+ *
+ * What would be better solutions:
+ * - make the search more efficient (e.g., by avoiding searching the
+ * ancestry of merges multiple times),
+ * - cache results,
+ * - lazy evaluation.
+ */
+ if (date_override)
+ recurse_time(vcs_git->commit, oid, &t);
return t;
}