cgit

commit 5293c8b7992bf3211b6bde7acbbd4e74ffd926d4

Author: Lars Hjemli <hjemli@gmail.com>

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>

 ui-repolist.c | 3 ++-


diff --git a/ui-repolist.c b/ui-repolist.c
index 25c36ce39b052bddd62199bf398c5c80ede05cc9..f21d28d5bc5b5f41207530bd5111553377735cc0 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -45,7 +45,8 @@ 		r->mtime = *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;