List for cgit developers and users
 help / color / mirror / Atom feed
From: pst200 at googlemail.com (Philip Taylor)
Subject: Description in repo not used if not using scan-path
Date: Mon, 20 Jan 2014 20:47:53 +0000	[thread overview]
Message-ID: <52DD8B79.6050109@googlemail.com> (raw)
In-Reply-To: <52CDD530.6020005@googlemail.com>

I have created a function to post-process the loaded cgitrc file to load 
the description of any repo that is the default cgit description.

This is called after the 
"parse_configfile(expand_macros(ctx.env.cgit_config), config_cb);" line. 
The code is pasted below for information.

static void find_missing_descriptions()
{
     int idx;
     /* copied from scan-tree.c, add_repo */
     struct cgit_repo *repo;
     size_t size;
     struct stat st;

     for ( idx=0; idx < cgit_repolist.count; idx++ )
     {
         struct strbuf path = STRBUF_INIT;

         /* copied from ui-repolist.c, cgit_print_repolist() */
         repo = &cgit_repolist.repos[idx];
         strbuf_add(&path, repo->path, strlen(repo->path));
         strbuf_addch(&path, '/'); /* When the path is stored in the 
repo, the final slash is removed, so add it back in */

         /* copied from scan-tree.c, add_repo */
         if (repo->desc == cgit_default_repo_desc || !repo->desc)
         {
             strbuf_addstr(&path, "description");
             if (!stat(path.buf, &st))
                 readfile(path.buf, &repo->desc, &size);
         }
     }
}


  reply	other threads:[~2014-01-20 20:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08 22:46 pst200
2014-01-20 20:47 ` pst200 [this message]
2014-01-20 20:52   ` Jason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52DD8B79.6050109@googlemail.com \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).