allow entering tree view from log view with 't' key
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
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;
}