[PATCH] guess default branch from HEAD

larsh at hjemli.net larsh at hjemli.net
Tue Jul 19 08:30:58 CEST 2011


On Sat, Jul 09, 2011 at 08:09:57AM +0000, chris wrote:
> Lars Hjemli <hjemli at ...> writes:
> > On Thu, Jun 16, 2011 at 16:59, Julius Plenz <plenz at ...> wrote:
> > >> I can add a fixup patch on top of the patch from Julius if there's
> > >> no objections to this plan.
> > >
> > > To the contrary, I'd appreciate your patch. Thanks. 
> > 
> > Your patch and my fixup is now part of the wip branch on hjemli.net/git/cgit.
> 
> I've applied the following patch:
> 
> http://hjemli.net/git/cgit/patch/?id=795118d4042d53566d8375dcabe20515e9135351
> 
> ontop of:
> 
> http://hjemli.net/git/cgit/commit/?id=2a8f553163d642e60092ced20631e1020581273b
> 
> and the index page 'idle' times no longer show up (the idle column is blank). 
> Each project's summary page 'Age' column still works just fine.
> 

Thanks for noticing. I think the following patch will fix the issue:

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)
 		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;

--
larsh




More information about the CGit mailing list