commit bfbb258b77efcda05d51b22c11c23c2b94c3cf05 from: Sven M. Hallberg date: Thu Aug 01 16:27:44 2024 UTC tog log: show author dates if showing author names (@) commit - 20a750ff945baed4c729142993cb0217f40830b9 commit + bfbb258b77efcda05d51b22c11c23c2b94c3cf05 blob - fca64360499d25b37e4da465d063154d61ce89a8 blob + 5289fe88e2afd9cf2bdc043d4722c21fa4843071 --- tog/tog.c +++ tog/tog.c @@ -571,7 +571,7 @@ struct tog_help_view_state { KEY_("R", "Open ref view of all repository references"), \ KEY_("T", "Display tree view of the repository from the 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"), \ @@ -2441,7 +2441,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; @@ -2456,8 +2456,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);