From: william.bell at frog.za.net (William Bell)
Subject: [PATCH] make cgit honour gitweb.description
Date: Mon, 17 Sep 2012 16:51:44 +0200 [thread overview]
Message-ID: <50573900.9030202@frog.za.net> (raw)
From 0c76f92d0ce965276551f88898d4c1ec6f6ec3ed Mon Sep 17 00:00:00 2001
From: William Bell <william.bell at frog.za.net>
Date: Mon, 17 Sep 2012 16:40:56 +0200
Subject: [PATCH] make cgit honour gitweb.description
---
scan-tree.c | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/scan-tree.c b/scan-tree.c
index 378d795..ab85610 100644
--- a/scan-tree.c
+++ b/scan-tree.c
@@ -1,5 +1,5 @@
/* scan-tree.c
- *
+ *
* Copyright (C) 2008-2009 Lars Hjemli
* Copyright (C) 2010 Jason A. Donenfeld <Jason at zx2c4.com>
*
@@ -48,6 +48,7 @@ static int is_git_dir(const char *path)
struct cgit_repo *repo;
repo_config_fn config_fn;
char *owner;
+char *description;
static void repo_config(const char *name, const char *value)
{
@@ -58,6 +59,8 @@ static int git_owner_config(const char *key, const
char *value, void *cb)
{
if (!strcmp(key, "gitweb.owner"))
owner = xstrdup(value);
+ else if (!strcmp(key, "gitweb.description"))
+ description = xstrdup(value);
return 0;
}
@@ -89,6 +92,7 @@ static void add_repo(const char *base, const char
*path, repo_config_fn fn)
return;
owner = NULL;
+ description = NULL;
if (ctx.cfg.enable_gitweb_owner)
git_config_from_file(git_owner_config, fmt("%s/config", path),
NULL);
if (base == path)
@@ -118,9 +122,14 @@ static void add_repo(const char *base, const char
*path, repo_config_fn fn)
}
repo->owner = owner;
- p = fmt("%s/description", path);
- if (!stat(p, &st))
- readfile(p, &repo->desc, &size);
+ if (!description) {
+ p = fmt("%s/description", path);
+ if (!stat(p, &st))
+ readfile(p, &repo->desc, &size);
+ }
+ else {
+ repo->desc = description;
+ }
if (!repo->readme) {
p = fmt("%s/README.html", path);
@@ -216,7 +225,7 @@ void scan_projects(const char *path, const char
*projectsfile, repo_config_fn fn
char line[MAX_PATH * 2], *z;
FILE *projects;
int err;
-
+
projects = fopen(projectsfile, "r");
if (!projects) {
fprintf(stderr, "Error opening projectsfile %s: %s (%d)\n",
--
1.7.9.5
next reply other threads:[~2012-09-17 14:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-17 14:51 william.bell [this message]
2012-09-17 21:14 ` cgit
2012-09-18 4:16 ` william.bell
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=50573900.9030202@frog.za.net \
--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).