git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[CGit] [PATCH 4/6] source_filter: also communicate the repo name to the filter

From
Ferry Huberts <mailings@hupie.com>
Date
Feb 17, 2011, 21:11 UTC
Message-ID
<1297977069-21884-5-git-send-email-mailings@hupie.com>
In-Reply-To
<1297977069-21884-1-git-send-email-mailings@hupie.com>
From: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
---
 cgit.c                         |    2 +-
 filters/syntax-highlighting.sh |    1 +
 ui-tree.c                      |    2 ++
 3 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/cgit.c b/cgit.c
index 6fa8f60..65c892c 100644
--- a/cgit.c
+++ b/cgit.c
@@ -46,7 +46,7 @@ struct cgit_filter *new_filter(const char *cmd, filter_type filtertype)
 			break;
 
 		case source:
-			extra_args = 1;
+			extra_args = 2;
 			break;
 
 		default:
diff --git a/filters/syntax-highlighting.sh b/filters/syntax-highlighting.sh
index 6b1c576..80d670f 100755
--- a/filters/syntax-highlighting.sh
+++ b/filters/syntax-highlighting.sh
@@ -26,6 +26,7 @@
 
 # store filename and extension in local vars
 BASENAME="$1"
+REPONAME="$2"
 EXTENSION="${BASENAME##*.}"
 
 # map Makefile and Makefile.* to .mk
diff --git a/ui-tree.c b/ui-tree.c
index 442b6be..2c7298c 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -45,6 +45,8 @@ 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);
+		if (!ctx.repo->source_filter->argv[2])
+			ctx.repo->source_filter->argv[2] = xstrdup(ctx.repo->name);
 		cgit_open_filter(ctx.repo->source_filter);
 		html_raw(buf, size);
 		cgit_close_filter(ctx.repo->source_filter);
-- 
1.7.4
Previous: Ferry HubertsNext: Ferry Huberts
Message 5 of 11 in “Communicate the repo name to the filter scripts”
  1. Ferry HubertsFeb 17, 2011
  2. [CGit] [PATCH 1/6] source_filter: fix a memory leakFerry Huberts, Feb 17, 2011
  3. [CGit] [PATCH 2/6] new_filter: correctly initialise all arguments for a new filterFerry Huberts, Feb 17, 2011
  4. [CGit] [PATCH 3/6] new_filter: determine extra_args from filter typeFerry Huberts, Feb 17, 2011
  5. [CGit] [PATCH 4/6] source_filter: also communicate the repo name to the filterFerry Huberts, Feb 17, 2011
  6. [CGit] [PATCH 5/6] commit_filter: also communicate the repo name to the filterFerry Huberts, Feb 17, 2011
  7. [CGit] [PATCH 6/6] about_filter: also communicate the repo name to the filterFerry Huberts, Feb 17, 2011
  8. Ferry HubertsFeb 17, 2011
  9. Lars HjemliFeb 19, 2011
  10. Ferry HubertsFeb 19, 2011
  11. Ferry HubertsFeb 24, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.