402f09ab38
Add cgit-fix-more-read_tree_recursive.diff, this time with 'Changed'-entry. OBS-URL: https://build.opensuse.org/request/show/94123 OBS-URL: https://build.opensuse.org/package/show/devel:tools:scm/cgit?expand=0&rev=11
55 lines
1.8 KiB
Diff
55 lines
1.8 KiB
Diff
--- ui-blob.c
|
|
+++ ui-blob.c
|
|
@@ -37,11 +37,14 @@ int cgit_print_file(char *path, const char *head)
|
|
return -1;
|
|
type = sha1_object_info(sha1, &size);
|
|
if(type == OBJ_COMMIT && path) {
|
|
+ struct pathspec pathspec;
|
|
commit = lookup_commit_reference(sha1);
|
|
match_path = path;
|
|
matched_sha1 = sha1;
|
|
found_path = 0;
|
|
- read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL);
|
|
+ init_pathspec(&pathspec, paths);
|
|
+ read_tree_recursive(commit->tree, "", 0, 0, &pathspec, walk_tree, NULL);
|
|
+ free_pathspec(&pathspec);
|
|
if (!found_path)
|
|
return -1;
|
|
type = sha1_object_info(sha1, &size);
|
|
@@ -80,10 +83,13 @@ void cgit_print_blob(const char *hex, char *path, const char *head)
|
|
type = sha1_object_info(sha1, &size);
|
|
|
|
if((!hex) && type == OBJ_COMMIT && path) {
|
|
+ struct pathspec pathspec;
|
|
commit = lookup_commit_reference(sha1);
|
|
match_path = path;
|
|
matched_sha1 = sha1;
|
|
- read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL);
|
|
+ init_pathspec(&pathspec, paths);
|
|
+ read_tree_recursive(commit->tree, "", 0, 0, &pathspec, walk_tree, NULL);
|
|
+ free_pathspec(&pathspec);
|
|
type = sha1_object_info(sha1,&size);
|
|
}
|
|
|
|
--- ui-plain.c
|
|
+++ ui-plain.c
|
|
@@ -145,6 +145,7 @@ void cgit_print_plain(struct cgit_context *ctx)
|
|
unsigned char sha1[20];
|
|
struct commit *commit;
|
|
const char *paths[] = {ctx->qry.path, NULL};
|
|
+ struct pathspec pathspec;
|
|
|
|
if (!rev)
|
|
rev = ctx->qry.head;
|
|
@@ -165,7 +166,9 @@ void cgit_print_plain(struct cgit_context *ctx)
|
|
}
|
|
else
|
|
match_baselen = basedir_len(paths[0]);
|
|
- read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL);
|
|
+ init_pathspec(&pathspec, paths);
|
|
+ read_tree_recursive(commit->tree, "", 0, 0, &pathspec, walk_tree, NULL);
|
|
+ free_pathspec(&pathspec);
|
|
if (!match)
|
|
html_status(404, "Not found", 0);
|
|
else if (match == 2)
|