diff options
Diffstat (limited to 'ui-tree.c')
-rw-r--r-- | ui-tree.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -157,7 +157,7 @@ static void print_object(const unsigned char *sha1, char *path, const char *base | |||
157 | 157 | ||
158 | struct single_tree_ctx { | 158 | struct single_tree_ctx { |
159 | struct strbuf *path; | 159 | struct strbuf *path; |
160 | unsigned char sha1[GIT_SHA1_RAWSZ]; | 160 | struct object_id oid; |
161 | char *name; | 161 | char *name; |
162 | size_t count; | 162 | size_t count; |
163 | }; | 163 | }; |
@@ -177,7 +177,7 @@ static int single_tree_cb(const unsigned char *sha1, struct strbuf *base, | |||
177 | } | 177 | } |
178 | 178 | ||
179 | ctx->name = xstrdup(pathname); | 179 | ctx->name = xstrdup(pathname); |
180 | hashcpy(ctx->sha1, sha1); | 180 | hashcpy(ctx->oid.hash, sha1); |
181 | strbuf_addf(ctx->path, "/%s", pathname); | 181 | strbuf_addf(ctx->path, "/%s", pathname); |
182 | return 0; | 182 | return 0; |
183 | } | 183 | } |
@@ -195,13 +195,13 @@ static void write_tree_link(const unsigned char *sha1, char *name, | |||
195 | .nr = 0 | 195 | .nr = 0 |
196 | }; | 196 | }; |
197 | 197 | ||
198 | hashcpy(tree_ctx.sha1, sha1); | 198 | hashcpy(tree_ctx.oid.hash, sha1); |
199 | 199 | ||
200 | while (tree_ctx.count == 1) { | 200 | while (tree_ctx.count == 1) { |
201 | cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, rev, | 201 | cgit_tree_link(name, NULL, "ls-dir", ctx.qry.head, rev, |
202 | fullpath->buf); | 202 | fullpath->buf); |
203 | 203 | ||
204 | tree = lookup_tree(tree_ctx.sha1); | 204 | tree = lookup_tree(&tree_ctx.oid); |
205 | if (!tree) | 205 | if (!tree) |
206 | return; | 206 | return; |
207 | 207 | ||
@@ -300,17 +300,17 @@ static void ls_tail(void) | |||
300 | cgit_print_layout_end(); | 300 | cgit_print_layout_end(); |
301 | } | 301 | } |
302 | 302 | ||
303 | static void ls_tree(const unsigned char *sha1, char *path, struct walk_tree_context *walk_tree_ctx) | 303 | static void ls_tree(const struct object_id *oid, char *path, struct walk_tree_context *walk_tree_ctx) |
304 | { | 304 | { |
305 | struct tree *tree; | 305 | struct tree *tree; |
306 | struct pathspec paths = { | 306 | struct pathspec paths = { |
307 | .nr = 0 | 307 | .nr = 0 |
308 | }; | 308 | }; |
309 | 309 | ||
310 | tree = parse_tree_indirect(sha1); | 310 | tree = parse_tree_indirect(oid); |
311 | if (!tree) { | 311 | if (!tree) { |
312 | cgit_print_error_page(404, "Not found", | 312 | cgit_print_error_page(404, "Not found", |
313 | "Not a tree object: %s", sha1_to_hex(sha1)); | 313 | "Not a tree object: %s", sha1_to_hex(oid->hash)); |
314 | return; | 314 | return; |
315 | } | 315 | } |
316 | 316 | ||
@@ -380,7 +380,7 @@ void cgit_print_tree(const char *rev, char *path) | |||
380 | "Invalid revision name: %s", rev); | 380 | "Invalid revision name: %s", rev); |
381 | return; | 381 | return; |
382 | } | 382 | } |
383 | commit = lookup_commit_reference(oid.hash); | 383 | commit = lookup_commit_reference(&oid); |
384 | if (!commit || parse_commit(commit)) { | 384 | if (!commit || parse_commit(commit)) { |
385 | cgit_print_error_page(404, "Not found", | 385 | cgit_print_error_page(404, "Not found", |
386 | "Invalid commit reference: %s", rev); | 386 | "Invalid commit reference: %s", rev); |
@@ -390,7 +390,7 @@ void cgit_print_tree(const char *rev, char *path) | |||
390 | walk_tree_ctx.curr_rev = xstrdup(rev); | 390 | walk_tree_ctx.curr_rev = xstrdup(rev); |
391 | 391 | ||
392 | if (path == NULL) { | 392 | if (path == NULL) { |
393 | ls_tree(commit->tree->object.oid.hash, NULL, &walk_tree_ctx); | 393 | ls_tree(&commit->tree->object.oid, NULL, &walk_tree_ctx); |
394 | goto cleanup; | 394 | goto cleanup; |
395 | } | 395 | } |
396 | 396 | ||