[PATCH] guess default branch from HEAD
larsh at hjemli.net
larsh at hjemli.net
Tue Jul 19 11:56:07 CEST 2011
On Tue, Jul 19, 2011 at 09:35:42AM +0000, chris wrote:
> > <larsh at ...> writes:
> > On Sat, Jul 09, 2011 at 08:09:57AM +0000, chris wrote:
> > > the index page 'idle' times no longer show up (the idle column is blank).
> >
> > 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
>
> This patch corrected the problem of the idle times being empty on the index
> page.
Thanks for testing.
>
> It is a little strange to have the idle time not use the default branch.
Well, "master" is the defacto default branch...
> Should guess_defbranch() be called here instead of hard-coding "master"?
I don't think so, due to performance concerns (as explained earlier in this
thread). It's a compromise, favoring performance over correctness.
--
larsh
More information about the CGit
mailing list