summaryrefslogtreecommitdiffabout
path: root/cmd.c
Unidiff
Diffstat (limited to 'cmd.c') (more/less context) (ignore whitespace changes)
-rw-r--r--cmd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmd.c b/cmd.c
index e0eacbe..6cc91e6 100644
--- a/cmd.c
+++ b/cmd.c
@@ -15,16 +15,24 @@
15#include "ui-patch.h" 15#include "ui-patch.h"
16#include "ui-refs.h" 16#include "ui-refs.h"
17#include "ui-repolist.h" 17#include "ui-repolist.h"
18#include "ui-snapshot.h" 18#include "ui-snapshot.h"
19#include "ui-summary.h" 19#include "ui-summary.h"
20#include "ui-tag.h" 20#include "ui-tag.h"
21#include "ui-tree.h" 21#include "ui-tree.h"
22 22
23static void about_fn(struct cgit_context *ctx)
24{
25 if (ctx->repo)
26 cgit_print_repo_readme();
27 else
28 cgit_print_site_readme();
29}
30
23static void blob_fn(struct cgit_context *ctx) 31static void blob_fn(struct cgit_context *ctx)
24{ 32{
25 cgit_print_blob(ctx->qry.sha1, ctx->qry.path); 33 cgit_print_blob(ctx->qry.sha1, ctx->qry.path);
26} 34}
27 35
28static void commit_fn(struct cgit_context *ctx) 36static void commit_fn(struct cgit_context *ctx)
29{ 37{
30 cgit_print_commit(ctx->qry.sha1); 38 cgit_print_commit(ctx->qry.sha1);
@@ -79,16 +87,17 @@ static void tree_fn(struct cgit_context *ctx)
79} 87}
80 88
81#define def_cmd(name, want_repo, want_layout) \ 89#define def_cmd(name, want_repo, want_layout) \
82 {#name, name##_fn, want_repo, want_layout} 90 {#name, name##_fn, want_repo, want_layout}
83 91
84struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx) 92struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx)
85{ 93{
86 static struct cgit_cmd cmds[] = { 94 static struct cgit_cmd cmds[] = {
95 def_cmd(about, 0, 1),
87 def_cmd(blob, 1, 0), 96 def_cmd(blob, 1, 0),
88 def_cmd(commit, 1, 1), 97 def_cmd(commit, 1, 1),
89 def_cmd(diff, 1, 1), 98 def_cmd(diff, 1, 1),
90 def_cmd(log, 1, 1), 99 def_cmd(log, 1, 1),
91 def_cmd(patch, 1, 0), 100 def_cmd(patch, 1, 0),
92 def_cmd(refs, 1, 1), 101 def_cmd(refs, 1, 1),
93 def_cmd(repolist, 0, 0), 102 def_cmd(repolist, 0, 0),
94 def_cmd(snapshot, 1, 0), 103 def_cmd(snapshot, 1, 0),