History

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.

Lars Hjemli committed 15 years ago

Commit 5293c8b1 parent 8d7c2ec1 file · +2 −1Browse files

Unified · Split

ui-repolist.c+2−1
@@ -45,7 +45,8 @@ static int get_repo_modtime(const struct cgit_repo *repo, time_t *mtime) · 44 unmodified lines
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;