From: Omar Polo Subject: tog: add key to toggle between author and committer To: gameoftrees@openbsd.org Date: Mon, 18 Jul 2022 22:44:43 +0200 i've been reminded by the recent commit(s) to the TODO file; this adds a C key for the log view that toggles the display of the author in the log view. ok? diff /home/op/w/got commit - d2587c5f95c6edb51ccc8d4abfac838b58f3a463 path + /home/op/w/got blob - 4ec26b8962b911a5c478faf7aebc3d0686931d6e file + tog/tog.1 --- tog/tog.1 +++ tog/tog.1 @@ -214,6 +214,8 @@ view listing all references in the repository. This can then be used to open a new .Cm log view for arbitrary branches and tags. +.It Cm C +Switch between showing the author and the committer. .El .Pp The options for blob - 97ac0690a9232815bb10bc4a237246e2ec53e069 file + tog/tog.c --- tog/tog.c +++ tog/tog.c @@ -137,6 +137,7 @@ STAILQ_HEAD(tog_colors, tog_color); static struct got_reflist_head tog_refs = TAILQ_HEAD_INITIALIZER(tog_refs); static struct got_reflist_object_id_map *tog_refs_idmap; static enum got_diff_algorithm tog_diff_algo = GOT_DIFF_ALGORITHM_MYERS; +static int tog_show_committer; static const struct got_error * tog_ref_cmp_by_name(void *arg, int *cmp, struct got_reference *re1, @@ -1962,7 +1963,10 @@ draw_commit(struct tog_view *view, struct got_commit_o goto done; } - author = strdup(got_object_commit_get_author(commit)); + if (tog_show_committer) + author = strdup(got_object_commit_get_committer(commit)); + else + author = strdup(got_object_commit_get_author(commit)); if (author == NULL) { err = got_error_from_errno("strdup"); goto done; @@ -3258,6 +3262,11 @@ input_log_view(struct tog_view **new_view, struct tog_ case CTRL('n'): err = log_move_cursor_down(view, 0); break; + case 'C': + tog_show_committer = !tog_show_committer; + if (view->reset) + err = view->reset(view); + break; case 'G': case KEY_END: { /* We don't know yet how many commits, so we're forced to