aboutsummaryrefslogtreecommitdiffstats
path: root/ui-repolist.c
diff options
context:
space:
mode:
authorGravatar Lars Hjemli <hjemli@gmail.com>2011-07-19 18:34:18 (JST)
committerGravatar Lars Hjemli <hjemli@gmail.com>2011-07-19 18:34:18 (JST)
commit5293c8b7992bf3211b6bde7acbbd4e74ffd926d4 (patch)
tree824bbee98e7696bbd909557e6948d1931149844f /ui-repolist.c
parent8d7c2ec295423fe31d9113038f6717d7b64dbe57 (diff)
downloadcgit-5293c8b7992bf3211b6bde7acbbd4e74ffd926d4.zip
cgit-5293c8b7992bf3211b6bde7acbbd4e74ffd926d4.tar.gz
ui-repolist.c: fallback to "master" if no default branch is specified
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>
Diffstat (limited to 'ui-repolist.c')
-rw-r--r--ui-repolist.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ui-repolist.c b/ui-repolist.c
index 25c36ce..f21d28d 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -45,7 +45,8 @@ static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime)
45 return 1; 45 return 1;
46 } 46 }
47 47
48 path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch); 48 path = fmt("%s/refs/heads/%s", repo->path, repo->defbranch ?
49 repo->defbranch : "master");
49 if (stat(path, &s) == 0) { 50 if (stat(path, &s) == 0) {
50 *mtime = s.st_mtime; 51 *mtime = s.st_mtime;
51 r->mtime = *mtime; 52 r->mtime = *mtime;