diff options
Diffstat (limited to 'ui-plain.c')
-rw-r--r-- | ui-plain.c | 17 |
1 files changed, 12 insertions, 5 deletions
@@ -197,7 +197,14 @@ void cgit_print_plain(struct cgit_context *ctx) | |||
197 | const char *rev = ctx->qry.sha1; | 197 | const char *rev = ctx->qry.sha1; |
198 | unsigned char sha1[20]; | 198 | unsigned char sha1[20]; |
199 | struct commit *commit; | 199 | struct commit *commit; |
200 | const char *paths[] = {ctx->qry.path, NULL}; | 200 | struct pathspec_item path_items = { |
201 | .match = ctx->qry.path, | ||
202 | .len = ctx->qry.path ? strlen(ctx->qry.path) : 0 | ||
203 | }; | ||
204 | struct pathspec paths = { | ||
205 | .nr = 1, | ||
206 | .items = &path_items | ||
207 | }; | ||
201 | 208 | ||
202 | if (!rev) | 209 | if (!rev) |
203 | rev = ctx->qry.head; | 210 | rev = ctx->qry.head; |
@@ -211,14 +218,14 @@ void cgit_print_plain(struct cgit_context *ctx) | |||
211 | html_status(404, "Not found", 0); | 218 | html_status(404, "Not found", 0); |
212 | return; | 219 | return; |
213 | } | 220 | } |
214 | if (!paths[0]) { | 221 | if (!path_items.match) { |
215 | paths[0] = ""; | 222 | path_items.match = ""; |
216 | match_baselen = -1; | 223 | match_baselen = -1; |
217 | print_dir(commit->tree->object.sha1, "", 0, ""); | 224 | print_dir(commit->tree->object.sha1, "", 0, ""); |
218 | } | 225 | } |
219 | else | 226 | else |
220 | match_baselen = basedir_len(paths[0]); | 227 | match_baselen = basedir_len(path_items.match); |
221 | read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL); | 228 | read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, NULL); |
222 | if (!match) | 229 | if (!match) |
223 | html_status(404, "Not found", 0); | 230 | html_status(404, "Not found", 0); |
224 | else if (match == 2) | 231 | else if (match == 2) |