Skip to content

Commit b145c7c

Browse files
committed
Parse committer date in --pretty=raw output
This is a complement to 7351f17.
1 parent cc7479d commit b145c7c

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/main.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,8 @@ main_add_reflog(struct view *view, struct main_state *state, char *reflog)
415415
bool
416416
main_read(struct view *view, struct buffer *buf, bool force_stop)
417417
{
418+
struct view_column *column = get_view_column(view, VIEW_COLUMN_DATE);
419+
bool use_author_date = column && column->opt.date.use_author;
418420
struct main_state *state = view->private;
419421
struct graph *graph = state->graph;
420422
enum line_type type;
@@ -509,11 +511,16 @@ main_read(struct view *view, struct buffer *buf, bool force_stop)
509511

510512
case LINE_AUTHOR:
511513
parse_author_line(line + STRING_SIZE("author "),
512-
&commit->author, &commit->time);
514+
&commit->author, use_author_date ? &commit->time : NULL);
513515
if (state->with_graph)
514516
graph->render_parents(graph, &commit->graph);
515517
break;
516518

519+
case LINE_COMMITTER:
520+
parse_author_line(line + STRING_SIZE("committer "),
521+
NULL, use_author_date ? NULL : &commit->time);
522+
break;
523+
517524
default:
518525
/* Fill in the commit title if it has not already been set. */
519526
if (*commit->title)

test/main/date-test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export LINES=27
88

99
tigrc <<EOF
1010
set vertical-split = no
11+
set main-view-date-use-author = yes
1112
EOF
1213

1314
steps '

0 commit comments

Comments
 (0)