summary refs log tree commit diff
path: root/ui-plain.c
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2013-03-02 12:32:11 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2013-03-02 10:38:03 -0500
commitc1633c6befb6762e1ac9434a29980e4df5ffee21 (patch)
tree20dbdeab1f74e138a7db58a7ffb9ce304dcf3146 /ui-plain.c
parentbfc14d067da0fdf65f306fcd9a65829d9694dbeb (diff)
Update git to v1.7.6.5
struct pathspec is now used in more places.

Signed-off-by: John Keeping <john@keeping.me.uk>
Diffstat (limited to 'ui-plain.c')
-rw-r--r--ui-plain.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/ui-plain.c b/ui-plain.c
index 85877d7..c21d38f 100644
--- a/ui-plain.c
+++ b/ui-plain.c
@@ -197,7 +197,14 @@ void cgit_print_plain(struct cgit_context *ctx)
 	const char *rev = ctx->qry.sha1;
 	unsigned char sha1[20];
 	struct commit *commit;
-	const char *paths[] = {ctx->qry.path, NULL};
+	struct pathspec_item path_items = {
+		.match = ctx->qry.path,
+		.len = ctx->qry.path ? strlen(ctx->qry.path) : 0
+	};
+	struct pathspec paths = {
+		.nr = 1,
+		.items = &path_items
+	};
 
 	if (!rev)
 		rev = ctx->qry.head;
@@ -211,14 +218,14 @@ void cgit_print_plain(struct cgit_context *ctx)
 		html_status(404, "Not found", 0);
 		return;
 	}
-	if (!paths[0]) {
-		paths[0] = "";
+	if (!path_items.match) {
+		path_items.match = "";
 		match_baselen = -1;
 		print_dir(commit->tree->object.sha1, "", 0, "");
 	}
 	else
-		match_baselen = basedir_len(paths[0]);
-	read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL);
+		match_baselen = basedir_len(path_items.match);
+	read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, NULL);
 	if (!match)
 		html_status(404, "Not found", 0);
 	else if (match == 2)