]> git.cameronkatri.com Git - cgit.git/commitdiff
ui-repolist.c: fallback to "master" if no default branch is specified
authorLars Hjemli <hjemli@gmail.com>
Tue, 19 Jul 2011 09:34:18 +0000 (09:34 +0000)
committerLars Hjemli <hjemli@gmail.com>
Tue, 19 Jul 2011 09:34:18 +0000 (09:34 +0000)
When looking for the modtime of a repo we used to rely on repo.defbranch
having a value. This is no longer true so this patch provides a default
value when needed.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
ui-repolist.c

index 25c36ce39b052bddd62199bf398c5c80ede05cc9..f21d28d5bc5b5f41207530bd5111553377735cc0 100644 (file)
@@ -45,7 +45,8 @@ static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime)
                return 1;
        }
 
-       path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch);
+       path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch ?
+                  repo->defbranch : "master");
        if (stat(path, &s) == 0) {
                *mtime = s.st_mtime;
                r->mtime = *mtime;