]> git.cameronkatri.com Git - cgit.git/blobdiff - ui-repolist.c
Merge branch 'full-log'
[cgit.git] / ui-repolist.c
index cf27cb3072a2cca564bac95f733fe5bfe489f901..2c13d5041b2a4931358b241b6316db3d96a9a6b5 100644 (file)
@@ -6,6 +6,10 @@
  *   (see COPYING for full license text)
  */
 
+/* This is needed for strcasestr to be defined by <string.h> */
+#define _GNU_SOURCE 1
+#include <string.h>
+
 #include <time.h>
 
 #include "cgit.h"
@@ -32,19 +36,27 @@ static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime)
 {
        char *path;
        struct stat s;
+       struct cgit_repo *r = (struct cgit_repo *)repo;
 
+       if (repo->mtime != -1) {
+               *mtime = repo->mtime;
+               return 1;
+       }
        path = fmt("%s/%s", repo->path, ctx.cfg.agefile);
        if (stat(path, &s) == 0) {
                *mtime = read_agefile(path);
+               r->mtime = *mtime;
                return 1;
        }
 
        path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch);
-       if (stat(path, &s) == 0) {
+       if (stat(path, &s) == 0)
                *mtime = s.st_mtime;
-               return 1;
-       }
-       return 0;
+       else
+               *mtime = 0;
+
+       r->mtime = *mtime;
+       return (r->mtime != 0);
 }
 
 static void print_modtime(struct cgit_repo *repo)
@@ -245,7 +257,7 @@ void cgit_print_repolist()
                        html("<td>");
                        cgit_summary_link("summary", NULL, "button", NULL);
                        cgit_log_link("log", NULL, "button", NULL, NULL, NULL,
-                                     0, NULL, NULL);
+                                     0, NULL, NULL, ctx.qry.showmsg);
                        cgit_tree_link("tree", NULL, "button", NULL, NULL, NULL);
                        html("</td>");
                }