commit - d6117e780bcbc5ec0e222e0a010f21056ca5c47c
commit + d01904d4bba62d3608e53c5f4940a408d3353370
blob - d5065f17c333394614e8daed43abdf49e0d48772
blob + 7aaa8ea66b4803a68c636cf6a8f09903c0764f7b
--- TODO
+++ TODO
(e.g. diffing between versions of sys/dev/pci/pcidevs is too slow)
tog:
-- allow loading new commits in 'tog log' after startup (e.g. via Ctrl-L, 'r')
- implement horizonal scrolling in all views
- implement horizonal split view mode
- implement search feature for diff view
blob - 55b3318255e7f5de44835c303f5370b76ebc849d
blob + 8911577c58aeeb5285ded12c00bece9cee219f9c
--- tog/tog.1
+++ tog/tog.1
Find the next commit which matches the current search pattern.
.It Cm N
Find the previous commit which matches the current search pattern.
+.It Cm r
+Reload the log view with new commits found in the repository.
.El
.Pp
The options for
blob - 77bc11afd6ab46efb43cde4a25a9a59c3bdec210
blob + 2c60e90ad804622a25f2e0f017c4379a92df40a3
--- tog/tog.c
+++ tog/tog.c
struct commit_queue_entry *selected_entry;
int selected;
char *in_repo_path;
+ const char *head_ref_name;
struct got_repository *repo;
struct got_reflist_head *refs;
struct got_object_id *start_id;
static const struct got_error *open_log_view(struct tog_view *,
struct got_object_id *, struct got_reflist_head *,
- struct got_repository *, const char *, int);
+ struct got_repository *, const char *, const char *, int);
static const struct got_error * show_log_view(struct tog_view *);
static const struct got_error *input_log_view(struct tog_view **,
struct tog_view **, struct tog_view **, struct tog_view *, int);
TAILQ_REMOVE(&views, dead_view, entry);
err = view_close(dead_view);
- if (err || dead_view == main_view)
+ if (err || (dead_view == main_view && new_view == NULL))
goto done;
if (view == dead_view) {
static const struct got_error *
open_log_view(struct tog_view *view, struct got_object_id *start_id,
struct got_reflist_head *refs, struct got_repository *repo,
- const char *path, int check_disk)
+ const char *head_ref_name, const char *path, int check_disk)
{
const struct got_error *err = NULL;
struct tog_log_view_state *s = &view->state.log;
s->refs = refs;
s->repo = repo;
+ s->head_ref_name = head_ref_name;
s->start_id = got_object_id_dup(start_id);
if (s->start_id == NULL) {
err = got_error_from_errno("got_object_id_dup");
{
const struct got_error *err = NULL;
struct tog_log_view_state *s = &view->state.log;
- char *parent_path;
- struct tog_view *diff_view = NULL, *tree_view = NULL;
+ char *parent_path, *in_repo_path = NULL;
+ struct tog_view *diff_view = NULL, *tree_view = NULL, *lv = NULL;
int begin_x = 0;
+ struct got_object_id *start_id;
switch (ch) {
case 'q':
break;
parent_path = dirname(s->in_repo_path);
if (parent_path && strcmp(parent_path, ".") != 0) {
- struct tog_view *lv;
err = stop_log_thread(s);
if (err)
return err;
return got_error_from_errno(
"view_open");
err = open_log_view(lv, s->start_id, s->refs,
- s->repo, parent_path, 0);
+ s->repo, s->head_ref_name, parent_path, 0);
if (err)
return err;;
if (view_is_parent_view(view))
return NULL;
}
break;
+ case 'r':
+ err = stop_log_thread(s);
+ if (err)
+ return err;
+ lv = view_open(view->nlines, view->ncols,
+ view->begin_y, view->begin_x, TOG_VIEW_LOG);
+ if (lv == NULL)
+ return got_error_from_errno("view_open");
+ err = get_head_commit_id(&start_id, s->head_ref_name ?
+ s->head_ref_name : GOT_REF_HEAD, s->repo);
+ if (err)
+ return err;
+ in_repo_path = strdup(s->in_repo_path);
+ if (in_repo_path == NULL) {
+ free(start_id);
+ return got_error_from_errno("strdup");
+ }
+ err = open_log_view(lv, start_id, s->refs, s->repo,
+ s->head_ref_name, in_repo_path, 0);
+ if (err)
+ return err;;
+ *dead_view = view;
+ *new_view = lv;
+ break;
default:
break;
}
error = got_error_from_errno("view_open");
goto done;
}
- error = open_log_view(view, start_id, &refs, repo, path, 1);
+ error = open_log_view(view, start_id, &refs, repo, worktree ?
+ got_worktree_get_head_ref_name(worktree) : NULL, path, 1);
if (error)
goto done;
error = view_loop(view);
if (err)
return err;
- err = open_log_view(log_view, commit_id, refs, repo, path, 0);
+ err = open_log_view(log_view, commit_id, refs, repo, NULL, path, 0);
if (err)
view_close(log_view);
else