diff options
Diffstat (limited to 'cmd.c')
-rw-r--r-- | cmd.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -44,6 +44,12 @@ static void about_fn(void) | |||
44 | cgit_print_site_readme(); | 44 | cgit_print_site_readme(); |
45 | } | 45 | } |
46 | 46 | ||
47 | static void about_pre(void) | ||
48 | { | ||
49 | if (ctx.repo && !ctx.qry.path && ctx.qry.url[strlen(ctx.qry.url) - 1] != '/') | ||
50 | cgit_redirect(fmtalloc("%s/", cgit_currenturl()), true); | ||
51 | } | ||
52 | |||
47 | static void blob_fn(void) | 53 | static void blob_fn(void) |
48 | { | 54 | { |
49 | cgit_print_blob(ctx.qry.sha1, ctx.qry.path, ctx.qry.head, 0); | 55 | cgit_print_blob(ctx.qry.sha1, ctx.qry.path, ctx.qry.head, 0); |
@@ -136,15 +142,17 @@ static void tree_fn(void) | |||
136 | cgit_print_tree(ctx.qry.sha1, ctx.qry.path); | 142 | cgit_print_tree(ctx.qry.sha1, ctx.qry.path); |
137 | } | 143 | } |
138 | 144 | ||
145 | #define def_cmp(name, want_repo, want_layout, want_vpath, is_clone) \ | ||
146 | {#name, name##_fn, name##_pre, want_repo, want_layout, want_vpath, is_clone} | ||
139 | #define def_cmd(name, want_repo, want_layout, want_vpath, is_clone) \ | 147 | #define def_cmd(name, want_repo, want_layout, want_vpath, is_clone) \ |
140 | {#name, name##_fn, want_repo, want_layout, want_vpath, is_clone} | 148 | {#name, name##_fn, NULL, want_repo, want_layout, want_vpath, is_clone} |
141 | 149 | ||
142 | struct cgit_cmd *cgit_get_cmd(void) | 150 | struct cgit_cmd *cgit_get_cmd(void) |
143 | { | 151 | { |
144 | static struct cgit_cmd cmds[] = { | 152 | static struct cgit_cmd cmds[] = { |
145 | def_cmd(HEAD, 1, 0, 0, 1), | 153 | def_cmd(HEAD, 1, 0, 0, 1), |
146 | def_cmd(atom, 1, 0, 0, 0), | 154 | def_cmd(atom, 1, 0, 0, 0), |
147 | def_cmd(about, 0, 1, 0, 0), | 155 | def_cmp(about, 0, 1, 0, 0), |
148 | def_cmd(blob, 1, 0, 0, 0), | 156 | def_cmd(blob, 1, 0, 0, 0), |
149 | def_cmd(commit, 1, 1, 1, 0), | 157 | def_cmd(commit, 1, 1, 1, 0), |
150 | def_cmd(diff, 1, 1, 1, 0), | 158 | def_cmd(diff, 1, 1, 1, 0), |