Download raw body.
show base commit markers in tog log view
On Sun, Jul 23, 2023 at 12:01:07PM +1000, Mark Jamsek wrote:
> Mark Jamsek <mark@jamsek.com> wrote:
> > Stefan Sperling <stsp@stsp.name> wrote:
> > > On Sun, Jul 23, 2023 at 12:19:31AM +1000, Mark Jamsek wrote:
> > > > tog: show work tree base commit marker in log view
> > >
> > > Yes, I like this very much, thank you! ok by me.
> > >
> > > Also ok by me for the got branch -l changes + tests.
> >
> > Great, thanks!
> >
> > > Should the tog documentation mention * and ~ somewhere? Your latest
> > > patch doesn't seem to update tog.1; maybe I missed an earlier change?
> >
> > I considered it briefly but didn't act on it; however, it makes sense to
> > mention this. I've basically lifted the paragraph and list from the
> > got.1 branch -l docs and inserted it into tog.1's log entry:
> >
> > (diff applies on the previous and also includes your change to the
> > got branch -l docs)
>
> Actually, I just noticed we're individually passing each member of the
> commit_queue_entry struct to draw_commit(), so pass the struct instead.
>
> (I'll fold this into the tog base commit marker diff before sending
> but thought this would be easier to review)
sure, ok stsp
>
>
> diff /home/mark/src/got
> commit - 4707484ee92b48f003356aecbb0bc54d8fa633e5
> path + /home/mark/src/got
> blob - 5e1347b72fca7ac6b0261149e5998fe869d6aa49
> file + got/got.1
> --- got/got.1
> +++ got/got.1
> @@ -1566,7 +1566,8 @@ with one of the following annotations:
> If invoked in a work tree, the work tree's current branch is shown
> with one of the following annotations:
> .Bl -column YXZ description
> -.It * Ta work tree's base commit and file index matches the branch tip
> +.It * Ta work tree's base commit and the base commit of all tracked files
> +matches the branch tip
> .It \(a~ Ta work tree comprises mixed commits or its base commit is out-of-date
> .El
> .It Fl n
> blob - 816fab05d74cd0ab51f96eb3cad17d26d95b56e3
> file + tog/tog.1
> --- tog/tog.1
> +++ tog/tog.1
> @@ -147,6 +147,14 @@ This command is also executed if no explicit command i
> and the work tree's path prefix is implicitly prepended.
> Otherwise, the path is interpreted relative to the repository root.
> .Pp
> +If invoked in a work tree, the log entry of the work tree's base commit will
> +be prefixed with one of the following annotations:
> +.Bl -column YXZ description
> +.It * Ta work tree's base commit and the base commit of all tracked files
> +matches the branch tip
> +.It \(a~ Ta work tree comprises mixed commits or its base commit is out-of-date
> +.El
> +.Pp
> This command is also executed if no explicit command is specified.
> .Pp
> The key bindings for
> blob - 8a1028bb4f2e258d908ee56b92451061bcca21f7
> file + tog/tog.c
> --- tog/tog.c
> +++ tog/tog.c
> @@ -2402,12 +2402,13 @@ draw_commit(struct tog_view *view, struct got_commit_o
> }
>
> static const struct got_error *
> -draw_commit(struct tog_view *view, struct got_commit_object *commit,
> - struct got_object_id *id, const size_t date_display_cols,
> - int author_display_cols, int entry_idx)
> +draw_commit(struct tog_view *view, struct commit_queue_entry *entry,
> + const size_t date_display_cols, int author_display_cols)
> {
> struct tog_log_view_state *s = &view->state.log;
> const struct got_error *err = NULL;
> + struct got_commit_object *commit = entry->commit;
> + struct got_object_id *id = entry->id;
> char datebuf[12]; /* YYYY-MM-DD + SPACE + NUL */
> char *refs_str = NULL;
> char *logmsg0 = NULL, *logmsg = NULL;
> @@ -2483,7 +2484,7 @@ draw_commit(struct tog_view *view, struct got_commit_o
> while (col < avail && author_width < author_display_cols + 2) {
> if (tog_base_commit.id != NULL &&
> author_width == marker_column &&
> - entry_idx == tog_base_commit.idx)
> + entry->idx == tog_base_commit.idx)
> waddch(view->window, tog_base_commit.marker);
> else
> waddch(view->window, ' ');
> @@ -2962,8 +2963,7 @@ draw_commits(struct tog_view *view)
> break;
> if (ncommits == s->selected)
> wstandout(view->window);
> - err = draw_commit(view, entry->commit, entry->id,
> - date_display_cols, author_cols, entry->idx);
> + err = draw_commit(view, entry, date_display_cols, author_cols);
> if (ncommits == s->selected)
> wstandend(view->window);
> if (err)
>
>
> --
> Mark Jamsek <https://bsdbox.org>
> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
show base commit markers in tog log view