commit 7b0989c733694e4d79049803668c74b4840b6e20 from: Sven M. Hallberg date: Mon Aug 19 08:39:14 2024 UTC tog log: show author dates if showing author names (@) commit - 3b1c57a08e0ae678850bad996672d98768e09f84 commit + 7b0989c733694e4d79049803668c74b4840b6e20 blob - 091072c0d6ba8b4c672d3c4534c282af4f86830b blob + db270280ca4d6040a9b0446506b8b3dbb684c927 --- tog/tog.c +++ tog/tog.c @@ -575,7 +575,7 @@ struct tog_help_view_state { " commit"), \ KEY_("m", "Mark or unmark the selected entry for diffing with the " \ "next selected commit"), \ - KEY_("@", "Toggle between displaying author and committer name"), \ + KEY_("@", "Toggle between displaying author and committer data"), \ KEY_("&", "Open prompt to enter term to limit commits displayed"), \ KEY_("C-g Backspace", "Cancel current search or log operation"), \ KEY_("C-l", "Reload the log view with new commits in the repository"), \ @@ -2483,7 +2483,7 @@ draw_commit(struct tog_view *view, struct commit_queue int col, limit, scrollx, logmsg_x; const int avail = view->ncols, marker_column = author_display_cols + 1; struct tm tm; - time_t committer_time; + time_t timestamp; struct tog_color *tc; struct got_reflist_head *refs; @@ -2498,8 +2498,11 @@ draw_commit(struct tog_view *view, struct commit_queue return got_error_set_errno(rc, "pthread_cond_wait"); } - committer_time = got_object_commit_get_committer_time(commit); - if (gmtime_r(&committer_time, &tm) == NULL) + if (s->use_committer) + timestamp = got_object_commit_get_committer_time(commit); + else + timestamp = got_object_commit_get_author_time(commit); + if (gmtime_r(×tamp, &tm) == NULL) return got_error_from_errno("gmtime_r"); if (strftime(datebuf, sizeof(datebuf), "%F ", &tm) == 0) return got_error(GOT_ERR_NO_SPACE);