Commit 9343a5fb1e6985acd066cde03dc94e19d44df9a9

Stefan Sperling 2018-06-23T23:36:18

allow entering tree view from log view with 't' key

diff --git a/tog/tog.c b/tog/tog.c
index d439851..a2a4b43 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -569,6 +569,21 @@ done:
 }
 
 static const struct got_error *
+browse_commit(struct commit_queue_entry *entry, struct got_repository *repo)
+{
+	const struct got_error *err = NULL;
+	struct got_tree_object *tree;
+
+	err = got_object_open_as_tree(&tree, repo, entry->commit->tree_id);
+	if (err)
+		return err;
+
+	err = show_tree_view(tree, entry->id, repo);
+	got_object_tree_close(tree);
+	return err;
+}
+
+static const struct got_error *
 show_log_view(struct got_object_id *start_id, struct got_repository *repo)
 {
 	const struct got_error *err = NULL;
@@ -710,6 +725,12 @@ show_log_view(struct got_object_id *start_id, struct got_repository *repo)
 					goto done;
 				show_panel(tog_log_view.panel);
 				break;
+			case 't':
+				err = browse_commit(selected_entry, repo);
+				if (err)
+					goto done;
+				show_panel(tog_log_view.panel);
+				break;
 			default:
 				break;
 		}