aboutsummaryrefslogtreecommitdiff
path: root/ui-tree.c
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
Diffstat (limited to 'ui-tree.c')
-rw-r--r--ui-tree.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/ui-tree.c b/ui-tree.c
index b692b56..561f9e7 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -271,6 +271,7 @@ void cgit_print_tree(const char *rev, char *path)
if (!rev)
rev = ctx.qry.head;
+ walk_tree_ctx.curr_rev = xstrdup(rev);
if (get_sha1(rev, sha1)) {
cgit_print_error(fmt("Invalid revision name: %s", rev));
return;
@@ -281,17 +282,12 @@ void cgit_print_tree(const char *rev, char *path)
return;
}
- walk_tree_ctx.curr_rev = xstrdup(rev);
-
if (path == NULL) {
ls_tree(commit->tree->object.sha1, NULL, &walk_tree_ctx);
- goto cleanup;
+ return;
}
read_tree_recursive(commit->tree, "", 0, 0, &paths, walk_tree, &walk_tree_ctx);
if (walk_tree_ctx.state == 1)
ls_tail();
-
-cleanup:
- free(walk_tree_ctx.curr_rev);
}