Commit Diff


commit - 5e9266f9d6904304336b0a80b14ba5676953c9f0
commit + 152c1c93d3f4f950c827a16175c3f439311e28c0
blob - 10aa4faaaa396db46f4ad7b4b3d7298f8d6a02ed
blob + a6e5d2c3a0a744769371049bfa316978694d35ab
--- tog/tog.1
+++ tog/tog.1
@@ -346,6 +346,13 @@ view for the currently selected file.
 Open a
 .Cm log
 view for the currently selected tree entry.
+.It Cm r
+Open a
+.Cm ref
+view listing all references in the repository.
+This can then be used to open a new
+.Cm tree
+view for arbitrary branches and tags.
 .It Cm Backspace
 Move back to the parent directory.
 .It Cm i
blob - 7a8da014ea57dd3e28bf67cd12619ae6389b3918
blob + 8442a98a5d8df651d1a68212c02dc9bb7284c585
--- tog/tog.c
+++ tog/tog.c
@@ -5358,7 +5358,7 @@ input_tree_view(struct tog_view **new_view, struct tog
 {
 	const struct got_error *err = NULL;
 	struct tog_tree_view_state *s = &view->state.tree;
-	struct tog_view *log_view;
+	struct tog_view *log_view, *ref_view;
 	int begin_x = 0, nscrolled;
 
 	switch (ch) {
@@ -5385,6 +5385,32 @@ input_tree_view(struct tog_view **new_view, struct tog
 			view->child_focussed = 1;
 		} else
 			*new_view = log_view;
+		break;
+	case 'r':
+		if (view_is_parent_view(view))
+			begin_x = view_split_begin_x(view->begin_x);
+		ref_view = view_open(view->nlines, view->ncols,
+		    view->begin_y, begin_x, TOG_VIEW_REF);
+		if (ref_view == NULL)
+			return got_error_from_errno("view_open");
+		err = open_ref_view(ref_view, s->repo);
+		if (err) {
+			view_close(ref_view);
+			return err;
+		}
+		if (view_is_parent_view(view)) {
+			err = view_close_child(view);
+			if (err)
+				return err;
+			err = view_set_child(view, ref_view);
+			if (err) {
+				view_close(ref_view);
+				break;
+			}
+			*focus_view = ref_view;
+			view->child_focussed = 1;
+		} else
+			*new_view = ref_view;
 		break;
 	case 'k':
 	case KEY_UP: