List for cgit developers and users
 help / color / mirror / Atom feed
* cgit patch : make scan-path guess default branch
       [not found] <4D6CE58D.3090406@parrot.com>
@ 2011-03-10 17:41 ` hjemli
  0 siblings, 0 replies; only message in thread
From: hjemli @ 2011-03-10 17:41 UTC (permalink / raw)


[Added cgit list to cc, sorry for the late reply]

On Tue, Mar 1, 2011 at 13:24, Matthieu CASTET
<matthieu.castet at parrot.com> wrote:
> this patch make scan-tree parse HEAD file to guess the default branch.
>
> It is not perfect, but it does what I wanted on my repository.

I've received a very similar patch today, and your patch has the same
problems. Please see
http://hjemli.net/pipermail/cgit/2011-March/000037.html

> diff --git a/scan-tree.c b/scan-tree.c
> index a0e09ce..125adec 100644
> --- a/scan-tree.c
> +++ b/scan-tree.c
> @@ -122,6 +122,16 @@ static void add_repo(const char *base, const char
> *path, repo_config_fn fn)
> ? ? ? ?if (!stat(p, &st))
> ? ? ? ? ? ? ? ?readfile(p, &repo->desc, &size);
>
> + ? ? ? p = fmt("%s/HEAD", path);
> + ? ? ? if (!stat(p, &st)) {
> + ? ? ? ? ? ? ? int skip = strlen("ref: refs/heads/");
> + ? ? ? ? ? ? ? readfile(p, &repo->defbranch, &size);
> + ? ? ? ? ? ? ? if (size > skip) {
> + ? ? ? ? ? ? ? ? ? ? ? repo->defbranch[size-1] = '\0';
> + ? ? ? ? ? ? ? ? ? ? ? repo->defbranch += skip;
> + ? ? ? ? ? ? ? }
> + ? ? ? }
> +
> ? ? ? ?if (!repo->readme) {
> ? ? ? ? ? ? ? ?p = fmt("%s/README.html", path);
> ? ? ? ? ? ? ? ?if (!stat(p, &st))
>
>




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-10 17:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <4D6CE58D.3090406@parrot.com>
2011-03-10 17:41 ` cgit patch : make scan-path guess default branch hjemli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).