diff options
Diffstat (limited to 'ui-blob.c')
| -rw-r--r-- | ui-blob.c | 22 |
1 files changed, 18 insertions, 4 deletions
| @@ -32,7 +32,14 @@ int cgit_print_file(char *path, const char *head) | |||
| 32 | char *buf; | 32 | char *buf; |
| 33 | unsigned long size; | 33 | unsigned long size; |
| 34 | struct commit *commit; | 34 | struct commit *commit; |
| 35 | const char *paths[] = {path, NULL}; | 35 | struct pathspec_item path_items = { |
| 36 | .match = path, | ||
| 37 | .len = strlen(path) | ||
| 38 | }; | ||
| 39 | struct pathspec paths = { | ||
| 40 | .nr = 1, | ||
| 41 | .items = &path_items | ||
| 42 | }; | ||
| 36 | if (get_sha1(head, sha1)) | 43 | if (get_sha1(head, sha1)) |
| 37 | return -1; | 44 | return -1; |
| 38 | type = sha1_object_info(sha1, &size); | 45 | type = sha1_object_info(sha1, &size); |
| @@ -41,7 +48,7 @@ int cgit_print_file(char *path, const char *head) | |||
| 41 | match_path = path; | 48 | match_path = path; |
| 42 | matched_sha1 = sha1; | 49 | matched_sha1 = sha1; |
| 43 | found_path = 0; | 50 | found_path = 0; |
| 44 | read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL); | 51 | read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, NULL); |
| 45 | if (!found_path) | 52 | if (!found_path) |
| 46 | return -1; | 53 | return -1; |
| 47 | type = sha1_object_info(sha1, &size); | 54 | type = sha1_object_info(sha1, &size); |
| @@ -63,7 +70,14 @@ void cgit_print_blob(const char *hex, char *path, const char *head) | |||
| 63 | char *buf; | 70 | char *buf; |
| 64 | unsigned long size; | 71 | unsigned long size; |
| 65 | struct commit *commit; | 72 | struct commit *commit; |
| 66 | const char *paths[] = {path, NULL}; | 73 | struct pathspec_item path_items = { |
| 74 | .match = path, | ||
| 75 | .len = strlen(path) | ||
| 76 | }; | ||
| 77 | struct pathspec paths = { | ||
| 78 | .nr = 1, | ||
| 79 | .items = &path_items | ||
| 80 | }; | ||
| 67 | 81 | ||
| 68 | if (hex) { | 82 | if (hex) { |
| 69 | if (get_sha1_hex(hex, sha1)){ | 83 | if (get_sha1_hex(hex, sha1)){ |
| @@ -83,7 +97,7 @@ void cgit_print_blob(const char *hex, char *path, const char *head) | |||
| 83 | commit = lookup_commit_reference(sha1); | 97 | commit = lookup_commit_reference(sha1); |
| 84 | match_path = path; | 98 | match_path = path; |
| 85 | matched_sha1 = sha1; | 99 | matched_sha1 = sha1; |
| 86 | read_tree_recursive(commit->tree, "", 0, 0, paths, walk_tree, NULL); | 100 | read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, NULL); |
| 87 | type = sha1_object_info(sha1,&size); | 101 | type = sha1_object_info(sha1,&size); |
| 88 | } | 102 | } |
| 89 | 103 | ||
