Commit 9d2d87286d4dbe502df81e04ae1ba18c1ffe4831

blame: simplify handling of incomplete commit information

Always wait for the final blame information (the commit filename) to be
read before showing any commit information.

Commit diff

tig.c

 
36033603blame_draw(struct view *view, struct line *line, unsigned int lineno)
36043604{
36053605 struct blame *blame = line->data;
3606 struct tm *time = NULL;
3607 char *id = NULL, *author = NULL;
36063608 int col = 0;
36073609
3608 if (opt_date) {
3609 struct tm *time = blame->commit && *blame->commit->filename
3610 ? &blame->commit->time : NULL;
3610 if (blame->commit && *blame->commit->filename) {
3611 id = blame->commit->id;
3612 author = blame->commit->author;
3613 time = &blame->commit->time;
3614 }
36113615
3616 if (opt_date) {
36123617 col += draw_date(view, time, view->width);
36133618 if (col >= view->width)
36143619 return TRUE;
36233623 int max = MIN(AUTHOR_COLS - 1, view->width - col);
36243624
36253625 set_view_attr(view, LINE_MAIN_AUTHOR);
3626 if (blame->commit)
3627 draw_text(view, LINE_MAIN_AUTHOR, blame->commit->author, max, TRUE);
3626 if (author)
3627 draw_text(view, LINE_MAIN_AUTHOR, author, max, TRUE);
36283628 col += AUTHOR_COLS;
36293629 if (col >= view->width)
36303630 return TRUE;
36353635 int max = MIN(ID_COLS - 1, view->width - col);
36363636
36373637 set_view_attr(view, LINE_BLAME_ID);
3638 if (blame->commit)
3639 draw_text(view, LINE_BLAME_ID, blame->commit->id, max, FALSE);
3638 if (id)
3639 draw_text(view, LINE_BLAME_ID, id, max, FALSE);
36403640 col += ID_COLS;
36413641 if (col >= view->width)
36423642 return TRUE;
toggle raw diff