* [PATCH] make cgit honour gitweb.description
@ 2012-09-17 14:51 william.bell
2012-09-17 21:14 ` cgit
2012-09-18 4:16 ` william.bell
0 siblings, 2 replies; 3+ messages in thread
From: william.bell @ 2012-09-17 14:51 UTC (permalink / 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] make cgit honour gitweb.description
2012-09-17 14:51 [PATCH] make cgit honour gitweb.description william.bell
@ 2012-09-17 21:14 ` cgit
2012-09-18 4:16 ` william.bell
1 sibling, 0 replies; 3+ messages in thread
From: cgit @ 2012-09-17 21:14 UTC (permalink / raw)
On Mon, Sep 17, 2012 at 04:51:44PM +0200, William Bell wrote:
> --- a/scan-tree.c
> +++ b/scan-tree.c
> @@ -1,5 +1,5 @@
> /* scan-tree.c
> - *
> + *
noise
> * 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?
> static void repo_config(const char *name, const char *value)
> {
> @@ -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;
> -
> +
noise.
> projects = fopen(projectsfile, "r");
> if (!projects) {
> fprintf(stderr, "Error opening projectsfile %s: %s (%d)\n",
Sebastian
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] make cgit honour gitweb.description
2012-09-17 14:51 [PATCH] make cgit honour gitweb.description william.bell
2012-09-17 21:14 ` cgit
@ 2012-09-18 4:16 ` william.bell
1 sibling, 0 replies; 3+ messages in thread
From: william.bell @ 2012-09-18 4:16 UTC (permalink / raw)
BTW. The patch will only work if the enable_gitweb_owner is set (which
it is in my case), we would want to read the description regardless of
this setting. The name of the function git_owner_config should probably
also get renamed.
Regards
On 17/09/2012 16:51, William Bell wrote:
> 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",
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-09-18 4:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-17 14:51 [PATCH] make cgit honour gitweb.description william.bell
2012-09-17 21:14 ` cgit
2012-09-18 4:16 ` william.bell
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).