git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [CGit] [PATCH v2 0/6] Communicate the repo name to the filter scripts
@ 2011-03-04  0:31 Ferry Huberts
  2011-03-04  0:31 ` [CGit] [PATCH v2 1/6] source_filter: fix a memory leak Ferry Huberts
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Ferry Huberts @ 2011-03-04  0:31 UTC (permalink / raw
  To: git; +Cc: hjemli

From: Ferry Huberts <ferry.huberts@pelagic.nl>

Changes compared to v1:
- Rewritten to communicate the repo configuration via environment variables


This patch series fixes two bugs, does a cleanup and communicates the repo
configuration to the filter scripts.

I have a server setup in which each repo has a trac instance and
for the commit filter I really need to know with which repo I'm
dealing in order to be able to resolve the #123 ticket numbers
into hyperlinks into the correct trac instance.

Patch 0001 fixes a memory leak and can be applied regardless of the other
           patches.
Patch 0002 makes sure that all arguments for the filter are correctly
           initialised so that the argv[] list is always terminated with a NULL
           pointer, which is currently not the case for the source filter.
Patch 0003 does a cleanup by introducing an enum for the filter type so that
           the number of extra arguments can be determined in a single place.

The other patches implement my desired functionality.


Ferry Huberts (6):
  source_filter: fix a memory leak
  new_filter: correctly initialise all arguments for a new filter
  new_filter: determine extra_args from filter type
  cgit_open_filter: also take the repo as a parameter
  cgit_open_filter: hand down repo configuration to script
  filters: document environment variables in filter scripts

 cgit.c                         |   34 +++++++++---
 cgit.h                         |    6 ++-
 filters/commit-links.sh        |   11 ++++
 filters/syntax-highlighting.sh |   11 ++++
 shared.c                       |  110 +++++++++++++++++++++++++++++++++++++++-
 ui-commit.c                    |    6 +-
 ui-repolist.c                  |    2 +-
 ui-snapshot.c                  |    2 +-
 ui-summary.c                   |    2 +-
 ui-tree.c                      |    4 +-
 10 files changed, 169 insertions(+), 19 deletions(-)

-- 
1.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [CGit] [PATCH v2 1/6] source_filter: fix a memory leak
  2011-03-04  0:31 [CGit] [PATCH v2 0/6] Communicate the repo name to the filter scripts Ferry Huberts
@ 2011-03-04  0:31 ` Ferry Huberts
  2011-03-04  0:31 ` [CGit] [PATCH v2 2/6] new_filter: correctly initialise all arguments for a new filter Ferry Huberts
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ferry Huberts @ 2011-03-04  0:31 UTC (permalink / raw
  To: git; +Cc: hjemli

From: Ferry Huberts <ferry.huberts@pelagic.nl>

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
---
 ui-tree.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/ui-tree.c b/ui-tree.c
index 0b1b531..442b6be 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -48,6 +48,8 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)
 		cgit_open_filter(ctx.repo->source_filter);
 		html_raw(buf, size);
 		cgit_close_filter(ctx.repo->source_filter);
+		free(ctx.repo->source_filter->argv[1]);
+		ctx.repo->source_filter->argv[1] = NULL;
 		html("</code></pre></td></tr></table>\n");
 		return;
 	}
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [CGit] [PATCH v2 2/6] new_filter: correctly initialise all arguments for a new filter
  2011-03-04  0:31 [CGit] [PATCH v2 0/6] Communicate the repo name to the filter scripts Ferry Huberts
  2011-03-04  0:31 ` [CGit] [PATCH v2 1/6] source_filter: fix a memory leak Ferry Huberts
@ 2011-03-04  0:31 ` Ferry Huberts
  2011-03-04  0:31 ` [CGit] [PATCH v2 3/6] new_filter: determine extra_args from filter type Ferry Huberts
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ferry Huberts @ 2011-03-04  0:31 UTC (permalink / raw
  To: git; +Cc: hjemli

From: Ferry Huberts <ferry.huberts@pelagic.nl>

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
---
 cgit.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/cgit.c b/cgit.c
index 412fbf0..4440feb 100644
--- a/cgit.c
+++ b/cgit.c
@@ -28,6 +28,7 @@ void add_mimetype(const char *name, const char *value)
 
 struct cgit_filter *new_filter(const char *cmd, int extra_args)
 {
+	int i = 0;
 	struct cgit_filter *f;
 
 	if (!cmd || !cmd[0])
@@ -36,8 +37,10 @@ struct cgit_filter *new_filter(const char *cmd, int extra_args)
 	f = xmalloc(sizeof(struct cgit_filter));
 	f->cmd = xstrdup(cmd);
 	f->argv = xmalloc((2 + extra_args) * sizeof(char *));
-	f->argv[0] = f->cmd;
-	f->argv[1] = NULL;
+	f->argv[i++] = f->cmd;
+	while (i < (2 + extra_args)) {
+	  f->argv[i++] = NULL;
+	}
 	return f;
 }
 
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [CGit] [PATCH v2 3/6] new_filter: determine extra_args from filter type
  2011-03-04  0:31 [CGit] [PATCH v2 0/6] Communicate the repo name to the filter scripts Ferry Huberts
  2011-03-04  0:31 ` [CGit] [PATCH v2 1/6] source_filter: fix a memory leak Ferry Huberts
  2011-03-04  0:31 ` [CGit] [PATCH v2 2/6] new_filter: correctly initialise all arguments for a new filter Ferry Huberts
@ 2011-03-04  0:31 ` Ferry Huberts
  2011-03-04  0:31 ` [CGit] [PATCH v2 4/6] cgit_open_filter: also take the repo as a parameter Ferry Huberts
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Ferry Huberts @ 2011-03-04  0:31 UTC (permalink / raw
  To: git; +Cc: hjemli

From: Ferry Huberts <ferry.huberts@pelagic.nl>

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
---
 cgit.c |   27 ++++++++++++++++++++-------
 cgit.h |    4 ++++
 2 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/cgit.c b/cgit.c
index 4440feb..5874034 100644
--- a/cgit.c
+++ b/cgit.c
@@ -26,14 +26,27 @@ void add_mimetype(const char *name, const char *value)
 	item->util = xstrdup(value);
 }
 
-struct cgit_filter *new_filter(const char *cmd, int extra_args)
+struct cgit_filter *new_filter(const char *cmd, filter_type filtertype)
 {
 	int i = 0;
 	struct cgit_filter *f;
+	int extra_args;
 
 	if (!cmd || !cmd[0])
 		return NULL;
 
+	switch (filtertype) {
+		case SOURCE:
+			extra_args = 1;
+			break;
+
+		case ABOUT:
+		case COMMIT:
+		default:
+			extra_args = 0;
+			break;
+	}
+
 	f = xmalloc(sizeof(struct cgit_filter));
 	f->cmd = xstrdup(cmd);
 	f->argv = xmalloc((2 + extra_args) * sizeof(char *));
@@ -78,11 +91,11 @@ void repo_config(struct cgit_repo *repo, const char *name, const char *value)
 		repo->readme = xstrdup(value);
 	} else if (ctx.cfg.enable_filter_overrides) {
 		if (!strcmp(name, "about-filter"))
-			repo->about_filter = new_filter(value, 0);
+			repo->about_filter = new_filter(value, ABOUT);
 		else if (!strcmp(name, "commit-filter"))
-			repo->commit_filter = new_filter(value, 0);
+			repo->commit_filter = new_filter(value, COMMIT);
 		else if (!strcmp(name, "source-filter"))
-			repo->source_filter = new_filter(value, 1);
+			repo->source_filter = new_filter(value, SOURCE);
 	}
 }
 
@@ -171,9 +184,9 @@ void config_cb(const char *name, const char *value)
 	else if (!strcmp(name, "cache-dynamic-ttl"))
 		ctx.cfg.cache_dynamic_ttl = atoi(value);
 	else if (!strcmp(name, "about-filter"))
-		ctx.cfg.about_filter = new_filter(value, 0);
+		ctx.cfg.about_filter = new_filter(value, ABOUT);
 	else if (!strcmp(name, "commit-filter"))
-		ctx.cfg.commit_filter = new_filter(value, 0);
+		ctx.cfg.commit_filter = new_filter(value, COMMIT);
 	else if (!strcmp(name, "embedded"))
 		ctx.cfg.embedded = atoi(value);
 	else if (!strcmp(name, "max-atom-items"))
@@ -201,7 +214,7 @@ void config_cb(const char *name, const char *value)
 	else if (!strcmp(name, "section-from-path"))
 		ctx.cfg.section_from_path = atoi(value);
 	else if (!strcmp(name, "source-filter"))
-		ctx.cfg.source_filter = new_filter(value, 1);
+		ctx.cfg.source_filter = new_filter(value, SOURCE);
 	else if (!strcmp(name, "summary-log"))
 		ctx.cfg.summary_log = atoi(value);
 	else if (!strcmp(name, "summary-branches"))
diff --git a/cgit.h b/cgit.h
index f5f68ac..be29d6e 100644
--- a/cgit.h
+++ b/cgit.h
@@ -50,6 +50,10 @@ typedef void (*configfn)(const char *name, const char *value);
 typedef void (*filepair_fn)(struct diff_filepair *pair);
 typedef void (*linediff_fn)(char *line, int len);
 
+typedef enum {
+	ABOUT, COMMIT, SOURCE
+} filter_type;
+
 struct cgit_filter {
 	char *cmd;
 	char **argv;
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [CGit] [PATCH v2 4/6] cgit_open_filter: also take the repo as a parameter
  2011-03-04  0:31 [CGit] [PATCH v2 0/6] Communicate the repo name to the filter scripts Ferry Huberts
                   ` (2 preceding siblings ...)
  2011-03-04  0:31 ` [CGit] [PATCH v2 3/6] new_filter: determine extra_args from filter type Ferry Huberts
@ 2011-03-04  0:31 ` Ferry Huberts
  2011-03-04  0:31 ` [CGit] [PATCH v2 5/6] cgit_open_filter: hand down repo configuration to script Ferry Huberts
  2011-03-04  0:31 ` [CGit] [PATCH v2 6/6] filters: document environment variables in filter scripts Ferry Huberts
  5 siblings, 0 replies; 7+ messages in thread
From: Ferry Huberts @ 2011-03-04  0:31 UTC (permalink / raw
  To: git; +Cc: hjemli

From: Ferry Huberts <ferry.huberts@pelagic.nl>

To prepare for handing repo configuration to the
script that is executed.

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
---
 cgit.h        |    2 +-
 shared.c      |    2 +-
 ui-commit.c   |    6 +++---
 ui-repolist.c |    2 +-
 ui-snapshot.c |    2 +-
 ui-summary.c  |    2 +-
 ui-tree.c     |    2 +-
 7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/cgit.h b/cgit.h
index be29d6e..2551cb7 100644
--- a/cgit.h
+++ b/cgit.h
@@ -312,7 +312,7 @@ extern const char *cgit_repobasename(const char *reponame);
 
 extern int cgit_parse_snapshots_mask(const char *str);
 
-extern int cgit_open_filter(struct cgit_filter *filter);
+extern int cgit_open_filter(struct cgit_filter *filter, struct cgit_repo * repo);
 extern int cgit_close_filter(struct cgit_filter *filter);
 
 extern int readfile(const char *path, char **buf, size_t *size);
diff --git a/shared.c b/shared.c
index 765cd27..49128ad 100644
--- a/shared.c
+++ b/shared.c
@@ -375,7 +375,7 @@ int cgit_parse_snapshots_mask(const char *str)
 	return rv;
 }
 
-int cgit_open_filter(struct cgit_filter *filter)
+int cgit_open_filter(struct cgit_filter *filter, struct cgit_repo * repo)
 {
 
 	filter->old_stdout = chk_positive(dup(STDOUT_FILENO),
diff --git a/ui-commit.c b/ui-commit.c
index 2b4f677..2da9fcf 100644
--- a/ui-commit.c
+++ b/ui-commit.c
@@ -110,7 +110,7 @@ void cgit_print_commit(char *hex, const char *prefix)
 	html("</table>\n");
 	html("<div class='commit-subject'>");
 	if (ctx.repo->commit_filter)
-		cgit_open_filter(ctx.repo->commit_filter);
+		cgit_open_filter(ctx.repo->commit_filter, ctx.repo);
 	html_txt(info->subject);
 	if (ctx.repo->commit_filter)
 		cgit_close_filter(ctx.repo->commit_filter);
@@ -118,7 +118,7 @@ void cgit_print_commit(char *hex, const char *prefix)
 	html("</div>");
 	html("<div class='commit-msg'>");
 	if (ctx.repo->commit_filter)
-		cgit_open_filter(ctx.repo->commit_filter);
+		cgit_open_filter(ctx.repo->commit_filter, ctx.repo);
 	html_txt(info->msg);
 	if (ctx.repo->commit_filter)
 		cgit_close_filter(ctx.repo->commit_filter);
@@ -127,7 +127,7 @@ void cgit_print_commit(char *hex, const char *prefix)
 		html("<div class='notes-header'>Notes</div>");
 		html("<div class='notes'>");
 		if (ctx.repo->commit_filter)
-			cgit_open_filter(ctx.repo->commit_filter);
+			cgit_open_filter(ctx.repo->commit_filter, ctx.repo);
 		html_txt(notes.buf);
 		if (ctx.repo->commit_filter)
 			cgit_close_filter(ctx.repo->commit_filter);
diff --git a/ui-repolist.c b/ui-repolist.c
index 2c98668..05b4548 100644
--- a/ui-repolist.c
+++ b/ui-repolist.c
@@ -291,7 +291,7 @@ void cgit_print_site_readme()
 	if (!ctx.cfg.root_readme)
 		return;
 	if (ctx.cfg.about_filter)
-		cgit_open_filter(ctx.cfg.about_filter);
+		cgit_open_filter(ctx.cfg.about_filter, NULL);
 	html_include(ctx.cfg.root_readme);
 	if (ctx.cfg.about_filter)
 		cgit_close_filter(ctx.cfg.about_filter);
diff --git a/ui-snapshot.c b/ui-snapshot.c
index 6e3412c..067082c 100644
--- a/ui-snapshot.c
+++ b/ui-snapshot.c
@@ -19,7 +19,7 @@ static int write_compressed_tar_archive(struct archiver_args *args,const char *f
 	f.argv = malloc(2 * sizeof(char *));
 	f.argv[0] = f.cmd;
 	f.argv[1] = NULL;
-	cgit_open_filter(&f);
+	cgit_open_filter(&f, NULL);
 	rv = write_tar_archive(args);
 	cgit_close_filter(&f);
 	return rv;
diff --git a/ui-summary.c b/ui-summary.c
index b203bcc..1b1d93b 100644
--- a/ui-summary.c
+++ b/ui-summary.c
@@ -113,7 +113,7 @@ void cgit_print_repo_readme(char *path)
 	 */
 	html("<div id='summary'>");
 	if (ctx.repo->about_filter)
-		cgit_open_filter(ctx.repo->about_filter);
+		cgit_open_filter(ctx.repo->about_filter, ctx.repo);
 	if (ref)
 		cgit_print_file(tmp, ref);
 	else
diff --git a/ui-tree.c b/ui-tree.c
index 442b6be..2d8d2f3 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -45,7 +45,7 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)
 	if (ctx.repo->source_filter) {
 		html("<td class='lines'><pre><code>");
 		ctx.repo->source_filter->argv[1] = xstrdup(name);
-		cgit_open_filter(ctx.repo->source_filter);
+		cgit_open_filter(ctx.repo->source_filter, ctx.repo);
 		html_raw(buf, size);
 		cgit_close_filter(ctx.repo->source_filter);
 		free(ctx.repo->source_filter->argv[1]);
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [CGit] [PATCH v2 5/6] cgit_open_filter: hand down repo configuration to script
  2011-03-04  0:31 [CGit] [PATCH v2 0/6] Communicate the repo name to the filter scripts Ferry Huberts
                   ` (3 preceding siblings ...)
  2011-03-04  0:31 ` [CGit] [PATCH v2 4/6] cgit_open_filter: also take the repo as a parameter Ferry Huberts
@ 2011-03-04  0:31 ` Ferry Huberts
  2011-03-04  0:31 ` [CGit] [PATCH v2 6/6] filters: document environment variables in filter scripts Ferry Huberts
  5 siblings, 0 replies; 7+ messages in thread
From: Ferry Huberts @ 2011-03-04  0:31 UTC (permalink / raw
  To: git; +Cc: hjemli

From: Ferry Huberts <ferry.huberts@pelagic.nl>

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
---
 shared.c |  108 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 107 insertions(+), 1 deletions(-)

diff --git a/shared.c b/shared.c
index 49128ad..5f09a63 100644
--- a/shared.c
+++ b/shared.c
@@ -7,6 +7,8 @@
  */
 
 #include "cgit.h"
+#include <stdio.h>
+#include <linux/limits.h>
 
 struct cgit_repolist cgit_repolist;
 struct cgit_context ctx;
@@ -375,6 +377,100 @@ int cgit_parse_snapshots_mask(const char *str)
 	return rv;
 }
 
+#define ENV_VARS			7
+#define ENV_SIZE_PER_VAR	(PATH_MAX + 64)
+#define ENV_SIZE			(ENV_VARS * ENV_SIZE_PER_VAR)
+
+typedef struct {
+	char * vars[ENV_VARS + 1];
+	char buffer[ENV_SIZE];
+} env_struct;
+
+static env_struct * prepare_env(struct cgit_repo * repo) {
+	long buffer_space = sizeof(env_struct);
+	env_struct * env = malloc(buffer_space);
+	int var_index = 0;
+	char * buffer_var_index;
+	unsigned int chars_printed;
+
+	if (!env)
+		return NULL;
+
+	/**
+	 * CGIT_REPO_URL
+	 * CGIT_REPO_NAME
+	 * CGIT_REPO_PATH
+	 * CGIT_REPO_OWNER
+	 * CGIT_REPO_DEFBRANCH
+	 * CGIT_REPO_SECTION
+	 * CGIT_REPO_CLONE_URL
+	 */
+
+	buffer_var_index = &env->buffer[0];
+
+	while (var_index < ENV_VARS) {
+		chars_printed = 0;
+		switch (var_index) {
+		case 0:
+			chars_printed = snprintf(buffer_var_index, buffer_space,
+					"CGIT_REPO_URL=%s", (repo->url) ? repo->url : "");
+			break;
+
+		case 1:
+			chars_printed = snprintf(buffer_var_index, buffer_space,
+					"CGIT_REPO_NAME=%s", (repo->name) ? repo->name : "");
+			break;
+
+		case 2:
+			chars_printed = snprintf(buffer_var_index, buffer_space,
+					"CGIT_REPO_PATH=%s", (repo->path) ? repo->path : "");
+			break;
+
+		case 3:
+			chars_printed = snprintf(buffer_var_index, buffer_space,
+					"CGIT_REPO_OWNER=%s", (repo->owner) ? repo->owner : "");
+			break;
+
+		case 4:
+			chars_printed = snprintf(buffer_var_index, buffer_space,
+					"CGIT_REPO_DEFBRANCH=%s",
+					(repo->defbranch) ? repo->defbranch : "");
+			break;
+
+		case 5:
+			chars_printed = snprintf(buffer_var_index, buffer_space,
+					"CGIT_REPO_SECTION=%s", (repo->section) ? repo->section
+							: "");
+			break;
+
+		case 6:
+			chars_printed = snprintf(buffer_var_index, buffer_space,
+					"CGIT_REPO_CLONE_URL=%s",
+					(repo->clone_url) ? repo->clone_url : "");
+			break;
+
+		default:
+			break;
+		}
+
+		if (chars_printed > buffer_space) {
+			free(env);
+			return NULL;
+		}
+
+		env->vars[var_index] = buffer_var_index;
+		buffer_var_index[chars_printed] = '\0';
+		buffer_var_index += chars_printed + 1;
+		buffer_space -= chars_printed;
+
+		var_index++;
+	}
+	env->vars[var_index] = NULL;
+
+	return env;
+}
+
+
 int cgit_open_filter(struct cgit_filter *filter, struct cgit_repo * repo)
 {
 
@@ -383,10 +479,20 @@ int cgit_open_filter(struct cgit_filter *filter, struct cgit_repo * repo)
 	chk_zero(pipe(filter->pipe_fh), "Unable to create pipe to subprocess");
 	filter->pid = chk_non_negative(fork(), "Unable to create subprocess");
 	if (filter->pid == 0) {
+		env_struct * env = NULL;
+
 		close(filter->pipe_fh[1]);
 		chk_non_negative(dup2(filter->pipe_fh[0], STDIN_FILENO),
 			"Unable to use pipe as STDIN");
-		execvp(filter->cmd, filter->argv);
+
+		if (repo)
+			env = prepare_env(repo);
+
+		execve(filter->cmd, filter->argv, (env) ? &env->vars[0] : NULL);
+
+		if (env)
+			free(env);
+
 		die("Unable to exec subprocess %s: %s (%d)", filter->cmd,
 			strerror(errno), errno);
 	}
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [CGit] [PATCH v2 6/6] filters: document environment variables in filter scripts
  2011-03-04  0:31 [CGit] [PATCH v2 0/6] Communicate the repo name to the filter scripts Ferry Huberts
                   ` (4 preceding siblings ...)
  2011-03-04  0:31 ` [CGit] [PATCH v2 5/6] cgit_open_filter: hand down repo configuration to script Ferry Huberts
@ 2011-03-04  0:31 ` Ferry Huberts
  5 siblings, 0 replies; 7+ messages in thread
From: Ferry Huberts @ 2011-03-04  0:31 UTC (permalink / raw
  To: git; +Cc: hjemli

From: Ferry Huberts <ferry.huberts@pelagic.nl>

Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
---
 filters/commit-links.sh        |   11 +++++++++++
 filters/syntax-highlighting.sh |   11 +++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/filters/commit-links.sh b/filters/commit-links.sh
index 110c609..d2cd2b3 100755
--- a/filters/commit-links.sh
+++ b/filters/commit-links.sh
@@ -3,6 +3,17 @@
 #
 # To use this script, refer to this file with either the commit-filter or the
 # repo.commit-filter options in cgitrc.
+#
+# The following environment variables can be used to retrieve the configuration
+# of the repository for which this script is called:
+# CGIT_REPO_URL        ( = repo.url       setting )
+# CGIT_REPO_NAME       ( = repo.name      setting )
+# CGIT_REPO_PATH       ( = repo.path      setting )
+# CGIT_REPO_OWNER      ( = repo.owner     setting )
+# CGIT_REPO_DEFBRANCH  ( = repo.defbranch setting )
+# CGIT_REPO_SECTION    ( = section        setting )
+# CGIT_REPO_CLONE_URL  ( = repo.clone-url setting )
+#
 
 # This expression generates links to commits referenced by their SHA1.
 regex=$regex'
diff --git a/filters/syntax-highlighting.sh b/filters/syntax-highlighting.sh
index 6b1c576..6283ce9 100755
--- a/filters/syntax-highlighting.sh
+++ b/filters/syntax-highlighting.sh
@@ -23,6 +23,17 @@
 # table.blob .kwb  { color:#830000; }
 # table.blob .kwc  { color:#000000; font-weight:bold; }
 # table.blob .kwd  { color:#010181; }
+#
+# The following environment variables can be used to retrieve the configuration
+# of the repository for which this script is called:
+# CGIT_REPO_URL        ( = repo.url       setting )
+# CGIT_REPO_NAME       ( = repo.name      setting )
+# CGIT_REPO_PATH       ( = repo.path      setting )
+# CGIT_REPO_OWNER      ( = repo.owner     setting )
+# CGIT_REPO_DEFBRANCH  ( = repo.defbranch setting )
+# CGIT_REPO_SECTION    ( = section        setting )
+# CGIT_REPO_CLONE_URL  ( = repo.clone-url setting )
+#
 
 # store filename and extension in local vars
 BASENAME="$1"
-- 
1.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-03-04  0:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-04  0:31 [CGit] [PATCH v2 0/6] Communicate the repo name to the filter scripts Ferry Huberts
2011-03-04  0:31 ` [CGit] [PATCH v2 1/6] source_filter: fix a memory leak Ferry Huberts
2011-03-04  0:31 ` [CGit] [PATCH v2 2/6] new_filter: correctly initialise all arguments for a new filter Ferry Huberts
2011-03-04  0:31 ` [CGit] [PATCH v2 3/6] new_filter: determine extra_args from filter type Ferry Huberts
2011-03-04  0:31 ` [CGit] [PATCH v2 4/6] cgit_open_filter: also take the repo as a parameter Ferry Huberts
2011-03-04  0:31 ` [CGit] [PATCH v2 5/6] cgit_open_filter: hand down repo configuration to script Ferry Huberts
2011-03-04  0:31 ` [CGit] [PATCH v2 6/6] filters: document environment variables in filter scripts Ferry Huberts

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).