diff options
| -rw-r--r-- | ui-blame.c | 6 | ||||
| -rw-r--r-- | ui-blob.c | 17 | ||||
| -rw-r--r-- | ui-commit.c | 2 | ||||
| -rw-r--r-- | ui-diff.c | 4 | ||||
| -rw-r--r-- | ui-log.c | 4 | ||||
| -rw-r--r-- | ui-plain.c | 7 | ||||
| -rw-r--r-- | ui-tree.c | 8 |
7 files changed, 29 insertions, 19 deletions
| @@ -290,8 +290,10 @@ void cgit_print_blame(void) | |||
| 290 | walk_tree_ctx.match_baselen = (path_items.match) ? | 290 | walk_tree_ctx.match_baselen = (path_items.match) ? |
| 291 | basedir_len(path_items.match) : -1; | 291 | basedir_len(path_items.match) : -1; |
| 292 | 292 | ||
| 293 | read_tree_recursive(the_repository, commit->maybe_tree, "", 0, 0, | 293 | read_tree_recursive(the_repository, |
| 294 | &paths, walk_tree, &walk_tree_ctx); | 294 | repo_get_commit_tree(the_repository, commit), |
| 295 | "", 0, 0, | ||
| 296 | &paths, walk_tree, &walk_tree_ctx); | ||
| 295 | if (!walk_tree_ctx.state) | 297 | if (!walk_tree_ctx.state) |
| 296 | cgit_print_error_page(404, "Not found", "Not found"); | 298 | cgit_print_error_page(404, "Not found", "Not found"); |
| 297 | else if (walk_tree_ctx.state == 2) | 299 | else if (walk_tree_ctx.state == 2) |
| @@ -56,8 +56,9 @@ int cgit_ref_path_exists(const char *path, const char *ref, int file_only) | |||
| 56 | goto done; | 56 | goto done; |
| 57 | if (oid_object_info(the_repository, &oid, &size) != OBJ_COMMIT) | 57 | if (oid_object_info(the_repository, &oid, &size) != OBJ_COMMIT) |
| 58 | goto done; | 58 | goto done; |
| 59 | read_tree_recursive(the_repository, lookup_commit_reference(the_repository, &oid)->maybe_tree, | 59 | read_tree_recursive(the_repository, |
| 60 | "", 0, 0, &paths, walk_tree, &walk_tree_ctx); | 60 | repo_get_commit_tree(the_repository, lookup_commit_reference(the_repository, &oid)), |
| 61 | "", 0, 0, &paths, walk_tree, &walk_tree_ctx); | ||
| 61 | 62 | ||
| 62 | done: | 63 | done: |
| 63 | free(path_items.match); | 64 | free(path_items.match); |
| @@ -91,8 +92,10 @@ int cgit_print_file(char *path, const char *head, int file_only) | |||
| 91 | type = oid_object_info(the_repository, &oid, &size); | 92 | type = oid_object_info(the_repository, &oid, &size); |
| 92 | if (type == OBJ_COMMIT) { | 93 | if (type == OBJ_COMMIT) { |
| 93 | commit = lookup_commit_reference(the_repository, &oid); | 94 | commit = lookup_commit_reference(the_repository, &oid); |
| 94 | read_tree_recursive(the_repository, commit->maybe_tree, | 95 | read_tree_recursive(the_repository, |
| 95 | "", 0, 0, &paths, walk_tree, &walk_tree_ctx); | 96 | repo_get_commit_tree(the_repository, commit), |
| 97 | "", 0, 0, &paths, walk_tree, | ||
| 98 | &walk_tree_ctx); | ||
| 96 | if (!walk_tree_ctx.found_path) | 99 | if (!walk_tree_ctx.found_path) |
| 97 | return -1; | 100 | return -1; |
| 98 | type = oid_object_info(the_repository, &oid, &size); | 101 | type = oid_object_info(the_repository, &oid, &size); |
| @@ -148,8 +151,10 @@ void cgit_print_blob(const char *hex, char *path, const char *head, int file_onl | |||
| 148 | 151 | ||
| 149 | if ((!hex) && type == OBJ_COMMIT && path) { | 152 | if ((!hex) && type == OBJ_COMMIT && path) { |
| 150 | commit = lookup_commit_reference(the_repository, &oid); | 153 | commit = lookup_commit_reference(the_repository, &oid); |
| 151 | read_tree_recursive(the_repository, commit->maybe_tree, | 154 | read_tree_recursive(the_repository, |
| 152 | "", 0, 0, &paths, walk_tree, &walk_tree_ctx); | 155 | repo_get_commit_tree(the_repository, commit), |
| 156 | "", 0, 0, &paths, walk_tree, | ||
| 157 | &walk_tree_ctx); | ||
| 153 | type = oid_object_info(the_repository, &oid, &size); | 158 | type = oid_object_info(the_repository, &oid, &size); |
| 154 | } | 159 | } |
| 155 | 160 | ||
diff --git a/ui-commit.c b/ui-commit.c index 9a47b54..783211f 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
| @@ -78,7 +78,7 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
| 78 | html(")</td></tr>\n"); | 78 | html(")</td></tr>\n"); |
| 79 | html("<tr><th>tree</th><td colspan='2' class='sha1'>"); | 79 | html("<tr><th>tree</th><td colspan='2' class='sha1'>"); |
| 80 | tmp = xstrdup(hex); | 80 | tmp = xstrdup(hex); |
| 81 | cgit_tree_link(oid_to_hex(&commit->maybe_tree->object.oid), NULL, NULL, | 81 | cgit_tree_link(oid_to_hex(get_commit_tree_oid(commit)), NULL, NULL, |
| 82 | ctx.qry.head, tmp, NULL); | 82 | ctx.qry.head, tmp, NULL); |
| 83 | if (prefix) { | 83 | if (prefix) { |
| 84 | html(" /"); | 84 | html(" /"); |
| @@ -413,7 +413,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, | |||
| 413 | "Bad commit: %s", oid_to_hex(new_rev_oid)); | 413 | "Bad commit: %s", oid_to_hex(new_rev_oid)); |
| 414 | return; | 414 | return; |
| 415 | } | 415 | } |
| 416 | new_tree_oid = &commit->maybe_tree->object.oid; | 416 | new_tree_oid = get_commit_tree_oid(commit); |
| 417 | 417 | ||
| 418 | if (old_rev) { | 418 | if (old_rev) { |
| 419 | if (get_oid(old_rev, old_rev_oid)) { | 419 | if (get_oid(old_rev, old_rev_oid)) { |
| @@ -434,7 +434,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, | |||
| 434 | "Bad commit: %s", oid_to_hex(old_rev_oid)); | 434 | "Bad commit: %s", oid_to_hex(old_rev_oid)); |
| 435 | return; | 435 | return; |
| 436 | } | 436 | } |
| 437 | old_tree_oid = &commit2->maybe_tree->object.oid; | 437 | old_tree_oid = get_commit_tree_oid(commit2); |
| 438 | } else { | 438 | } else { |
| 439 | old_tree_oid = NULL; | 439 | old_tree_oid = NULL; |
| 440 | } | 440 | } |
| @@ -153,8 +153,8 @@ static int show_commit(struct commit *commit, struct rev_info *revs) | |||
| 153 | rem_lines = 0; | 153 | rem_lines = 0; |
| 154 | 154 | ||
| 155 | revs->diffopt.flags.recursive = 1; | 155 | revs->diffopt.flags.recursive = 1; |
| 156 | diff_tree_oid(&parent->maybe_tree->object.oid, | 156 | diff_tree_oid(get_commit_tree_oid(parent), |
| 157 | &commit->maybe_tree->object.oid, | 157 | get_commit_tree_oid(commit), |
| 158 | "", &revs->diffopt); | 158 | "", &revs->diffopt); |
| 159 | diffcore_std(&revs->diffopt); | 159 | diffcore_std(&revs->diffopt); |
| 160 | 160 | ||
| @@ -193,13 +193,14 @@ void cgit_print_plain(void) | |||
| 193 | if (!path_items.match) { | 193 | if (!path_items.match) { |
| 194 | path_items.match = ""; | 194 | path_items.match = ""; |
| 195 | walk_tree_ctx.match_baselen = -1; | 195 | walk_tree_ctx.match_baselen = -1; |
| 196 | print_dir(&commit->maybe_tree->object.oid, "", 0, ""); | 196 | print_dir(get_commit_tree_oid(commit), "", 0, ""); |
| 197 | walk_tree_ctx.match = 2; | 197 | walk_tree_ctx.match = 2; |
| 198 | } | 198 | } |
| 199 | else | 199 | else |
| 200 | walk_tree_ctx.match_baselen = basedir_len(path_items.match); | 200 | walk_tree_ctx.match_baselen = basedir_len(path_items.match); |
| 201 | read_tree_recursive(the_repository, commit->maybe_tree, | 201 | read_tree_recursive(the_repository, |
| 202 | "", 0, 0, &paths, walk_tree, &walk_tree_ctx); | 202 | repo_get_commit_tree(the_repository, commit), |
| 203 | "", 0, 0, &paths, walk_tree, &walk_tree_ctx); | ||
| 203 | if (!walk_tree_ctx.match) | 204 | if (!walk_tree_ctx.match) |
| 204 | cgit_print_error_page(404, "Not found", "Not found"); | 205 | cgit_print_error_page(404, "Not found", "Not found"); |
| 205 | else if (walk_tree_ctx.match == 2) | 206 | else if (walk_tree_ctx.match == 2) |
| @@ -370,12 +370,14 @@ void cgit_print_tree(const char *rev, char *path) | |||
| 370 | walk_tree_ctx.curr_rev = xstrdup(rev); | 370 | walk_tree_ctx.curr_rev = xstrdup(rev); |
| 371 | 371 | ||
| 372 | if (path == NULL) { | 372 | if (path == NULL) { |
| 373 | ls_tree(&commit->maybe_tree->object.oid, NULL, &walk_tree_ctx); | 373 | ls_tree(get_commit_tree_oid(commit), NULL, &walk_tree_ctx); |
| 374 | goto cleanup; | 374 | goto cleanup; |
| 375 | } | 375 | } |
| 376 | 376 | ||
| 377 | read_tree_recursive(the_repository, commit->maybe_tree, "", 0, 0, | 377 | read_tree_recursive(the_repository, |
| 378 | &paths, walk_tree, &walk_tree_ctx); | 378 | repo_get_commit_tree(the_repository, commit), |
| 379 | "", 0, 0, | ||
| 380 | &paths, walk_tree, &walk_tree_ctx); | ||
| 379 | if (walk_tree_ctx.state == 1) | 381 | if (walk_tree_ctx.state == 1) |
| 380 | ls_tail(); | 382 | ls_tail(); |
| 381 | else if (walk_tree_ctx.state == 2) | 383 | else if (walk_tree_ctx.state == 2) |
