aboutsummaryrefslogtreecommitdiffstats
path: root/ui-repolist.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui-repolist.c')
-rw-r--r--ui-repolist.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/ui-repolist.c b/ui-repolist.c
index 9aae04f..7af01bd 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -98,20 +98,16 @@ static int repo_last_activity_time(const struct cgit_repo *repo,
int include_tags,
time_t *out)
{
- repo_clear(the_repository);
-
- struct repository *r = xcalloc(1, sizeof(*r));
- if (repo_init(r, repo->path, NULL)) {
+ if (repo_init(the_repository, repo->path, NULL)) {
error("failed to init repository at %s", repo->path);
- free(r);
return 0;
}
- repo_set_hash_algo(the_repository, hash_algo_by_ptr(r->hash_algo));
-
- timestamp_t t1 = repo_latest_commit_ctime(r, include_tags);
+ timestamp_t t1 = repo_latest_commit_ctime(the_repository, include_tags);
timestamp_t best = t1;
+ repo_clear(the_repository);
+
if (best <= 0) { *out = 0; return 0; }
*out = (time_t)best;
return 1;