Diff options
Diffstat (limited to 'source/ui-blame.c')
-rw-r--r--source/ui-blame.c17
1 file changed, 4 insertions, 13 deletions
diff --git a/source/ui-blame.c b/source/ui-blame.c
index 28fd16f..7254118 100644
--- a/source/ui-blame.c
+++ b/source/ui-blame.c
@@ -369,18 +369,8 @@ void cgit_print_blame(void)
const char *rev = ctx.qry.oid;
struct object_id oid;
struct commit *commit;
- int path_len = ctx.qry.path ? strlen(ctx.qry.path) : 0;
- // nowildcard_len matches len so git treats the path as literal rather
- // than as a glob, which is what a request naming one file means.
- struct pathspec_item path_items = {
- .match = ctx.qry.path,
- .len = path_len,
- .nowildcard_len = path_len
- };
- struct pathspec paths = {
- .nr = 1,
- .items = &path_items
- };
+ struct pathspec_item path_item;
+ struct pathspec paths = { 0 };
struct walk_tree_context walk = {
.found = TARGET_MISSING
};
@@ -393,7 +383,8 @@ void cgit_print_blame(void)
return;
walk.rev = rev;
- walk.match_baselen = path_items.match ? basedir_len(path_items.match) : -1;
+ walk.match_baselen = ctx.qry.path ? basedir_len(ctx.qry.path) : -1;
+ cgit_literal_pathspec(&paths, &path_item, ctx.qry.path);
read_tree(the_repository, repo_get_commit_tree(the_repository, commit), &paths, walk_tree, &walk);
if (walk.found == TARGET_MISSING)