"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
tog: trim tree_view_walk_path()
To:
gameoftrees@openbsd.org
Date:
Tue, 1 Dec 2020 23:00:32 +0100

Download raw body.

Thread
  • Christian Weisgerber:

    tog: trim tree_view_walk_path()

A minor one, but since I'm already rotolling tog.c ...

trim repo parameter from tree_view_walk_path(), already set by open_tree_view()

ok?

diff 2a0552e25d25a1540e6487b8733fc9f56081b8fa 27c715dc9f65e8d714c7975e89247c353d545ecd
blob - bbb3cc73e7b40155abee1e1ee81c2892084588dc
blob + 92120c7cde33afff3cb260a148050015f4d302d9
--- tog/tog.c
+++ tog/tog.c
@@ -1831,8 +1831,7 @@ tree_view_visit_subtree(struct got_tree_object *subtre
 
 static const struct got_error *
 tree_view_walk_path(struct tog_tree_view_state *s,
-    struct got_object_id *commit_id,
-    const char *path, struct got_repository *repo)
+    struct got_object_id *commit_id, const char *path)
 {
 	const struct got_error *err = NULL;
 	struct got_tree_object *tree = NULL;
@@ -1881,12 +1880,12 @@ tree_view_walk_path(struct tog_tree_view_state *s,
 			break;
 		}
 
-		err = got_object_id_by_path(&tree_id, repo, commit_id,
+		err = got_object_id_by_path(&tree_id, s->repo, commit_id,
 		    subpath);
 		if (err)
 			break;
 
-		err = got_object_open_as_tree(&tree, repo, tree_id);
+		err = got_object_open_as_tree(&tree, s->repo, tree_id);
 		free(tree_id);
 		if (err)
 			break;
@@ -1938,7 +1937,7 @@ browse_commit_tree(struct tog_view **new_view, int beg
 	if (got_path_is_root_dir(path))
 		return NULL;
 
-	return tree_view_walk_path(s, entry->id, path, repo);
+	return tree_view_walk_path(s, entry->id, path);
 }
 
 static const struct got_error *
@@ -5571,7 +5570,7 @@ cmd_tree(int argc, char *argv[])
 		goto done;
 	if (!got_path_is_root_dir(in_repo_path)) {
 		error = tree_view_walk_path(&view->state.tree, commit_id,
-		    in_repo_path, repo);
+		    in_repo_path);
 		if (error)
 			goto done;
 	}
-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de