From: john at keeping.me.uk (John Keeping)
Subject: [RFC/PATCH 2/5] Add "source" page
Date: Sat, 3 Sep 2016 19:29:33 +0100 [thread overview]
Message-ID: <f438524922e4f6458127490bbc83220f13fc414f.1472925431.git.john@keeping.me.uk> (raw)
In-Reply-To: <cover.1472925431.git.john@keeping.me.uk>
We are about to introduce rendering of content for the tree view. This
source page will allow bypassing the renderer and accessing the content
of the current tree view.
Signed-off-by: John Keeping <john at keeping.me.uk>
---
cmd.c | 6 ++++++
ui-shared.c | 10 ++++++++++
ui-shared.h | 3 +++
3 files changed, 19 insertions(+)
diff --git a/cmd.c b/cmd.c
index d280e95..18cc980 100644
--- a/cmd.c
+++ b/cmd.c
@@ -129,6 +129,11 @@ static void refs_fn(void)
cgit_print_refs();
}
+static void source_fn(void)
+{
+ cgit_print_tree(ctx.qry.sha1, ctx.qry.path);
+}
+
static void snapshot_fn(void)
{
cgit_print_snapshot(ctx.qry.head, ctx.qry.sha1, ctx.qry.path,
@@ -177,6 +182,7 @@ struct cgit_cmd *cgit_get_cmd(void)
def_cmd(refs, 1, 0, 0),
def_cmd(repolist, 0, 0, 0),
def_cmd(snapshot, 1, 0, 0),
+ def_cmd(source, 1, 1, 0),
def_cmd(stats, 1, 1, 0),
def_cmd(summary, 1, 0, 0),
def_cmd(tag, 1, 0, 0),
diff --git a/ui-shared.c b/ui-shared.c
index e39d004..36b6108 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -297,6 +297,12 @@ void cgit_tree_link(const char *name, const char *title, const char *class,
reporevlink("tree", name, title, class, head, rev, path);
}
+void cgit_source_link(const char *name, const char *title, const char *class,
+ const char *head, const char *rev, const char *path)
+{
+ reporevlink("source", name, title, class, head, rev, path);
+}
+
void cgit_plain_link(const char *name, const char *title, const char *class,
const char *head, const char *rev, const char *path)
{
@@ -476,6 +482,10 @@ static void cgit_self_link(char *name, const char *title, const char *class)
cgit_tree_link(name, title, class, ctx.qry.head,
ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL,
ctx.qry.path);
+ else if (!strcmp(ctx.qry.page, "source"))
+ cgit_source_link(name, title, class, ctx.qry.head,
+ ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL,
+ ctx.qry.path);
else if (!strcmp(ctx.qry.page, "plain"))
cgit_plain_link(name, title, class, ctx.qry.head,
ctx.qry.has_sha1 ? ctx.qry.sha1 : NULL,
diff --git a/ui-shared.h b/ui-shared.h
index 87799f1..0b6b23d 100644
--- a/ui-shared.h
+++ b/ui-shared.h
@@ -23,6 +23,9 @@ extern void cgit_tag_link(const char *name, const char *title,
extern void cgit_tree_link(const char *name, const char *title,
const char *class, const char *head,
const char *rev, const char *path);
+extern void cgit_source_link(const char *name, const char *title,
+ const char *class, const char *head,
+ const char *rev, const char *path);
extern void cgit_plain_link(const char *name, const char *title,
const char *class, const char *head,
const char *rev, const char *path);
--
2.10.0.rc0.142.g1e9f63b
next prev parent reply other threads:[~2016-09-03 18:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-03 18:29 [RFC/PATCH 0/5] Add render filter john
2016-09-03 18:29 ` [RFC/PATCH 1/5] Use string list strdup_strings for mimetypes john
2016-09-03 18:29 ` john [this message]
2016-09-03 18:29 ` [RFC/PATCH 3/5] Parse render filters from the config john
2016-09-03 18:29 ` [RFC/PATCH 4/5] ui-tree: split out buffer printing john
2016-09-03 18:29 ` [RFC/PATCH 5/5] ui-tree: use render filters to display content john
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=f438524922e4f6458127490bbc83220f13fc414f.1472925431.git.john@keeping.me.uk \
--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).