Commit Diff


commit - 756050ac401f1e724f0c1fd97af4a9855589c703
commit + 10aab77fd5164e672b109e74278bc080a7546fb8
blob - 4ec26b8962b911a5c478faf7aebc3d0686931d6e
blob + 765c5ecd53d258c8af195523d4fb1fea0c8f41d3
--- 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 @
+Toggle between showing the author and the committer name.
 .El
 .Pp
 The options for
blob - a1c09fab6d16d0c21514c895128b7972db68d6c6
blob + 82d0b3a26a196343c75bd02c869e612c75190979
--- tog/tog.c
+++ tog/tog.c
@@ -376,6 +376,7 @@ struct tog_log_view_state {
 	struct commit_queue_entry *matched_entry;
 	struct commit_queue_entry *search_entry;
 	struct tog_colors colors;
+	int use_committer;
 };
 
 #define TOG_COLOR_DIFF_MINUS		1
@@ -1971,7 +1972,10 @@ draw_commit(struct tog_view *view, struct got_commit_o
 			goto done;
 	}
 
-	author = strdup(got_object_commit_get_author(commit));
+	if (s->use_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;
@@ -2281,12 +2285,16 @@ draw_commits(struct tog_view *view)
 	ncommits = 0;
 	view->maxx = 0;
 	while (entry) {
+		struct got_commit_object *c = entry->commit;
 		char *author, *eol, *msg, *msg0;
 		wchar_t *wauthor, *wmsg;
 		int width;
 		if (ncommits >= limit - 1)
 			break;
-		author = strdup(got_object_commit_get_author(entry->commit));
+		if (s->use_committer)
+			author = strdup(got_object_commit_get_committer(c));
+		else
+			author = strdup(got_object_commit_get_author(c));
 		if (author == NULL) {
 			err = got_error_from_errno("strdup");
 			goto done;
@@ -2297,7 +2305,7 @@ draw_commits(struct tog_view *view)
 			author_cols = width;
 		free(wauthor);
 		free(author);
-		err = got_object_commit_get_logmsg(&msg0, entry->commit);
+		err = got_object_commit_get_logmsg(&msg0, c);
 		if (err)
 			goto done;
 		msg = msg0;
@@ -3268,6 +3276,9 @@ input_log_view(struct tog_view **new_view, struct tog_
 	case CTRL('n'):
 		err = log_move_cursor_down(view, 0);
 		break;
+	case '@':
+		s->use_committer = !s->use_committer;
+		break;
 	case 'G':
 	case KEY_END: {
 		/* We don't know yet how many commits, so we're forced to