commit - fed7eaa8d19e52e6af447e1e7ee0e7357fdea62a
commit + 2b380cc817b771c4c1b50a2030d92bf72be175a7
blob - 1b742e6c0209ec2ddb3e1160d232e025523588ce
blob + 67c3cc42531a198326a1b2a56b78425a32fa3179
--- tog/tog.c
+++ tog/tog.c
s->thread_args.view = view;
s->thread_args.first_displayed_entry = &s->first_displayed_entry;
s->thread_args.selected_entry = &s->selected_entry;
-
- errcode = pthread_create(&s->thread, NULL, log_thread,
- &s->thread_args);
- if (errcode) {
- err = got_error_set_errno(errcode);
- goto done;
- }
-
done:
if (err)
close_log_view(view);
{
struct tog_log_view_state *s = &view->state.log;
+ if (s->thread == NULL) {
+ int errcode = pthread_create(&s->thread, NULL, log_thread,
+ &s->thread_args);
+ if (errcode)
+ return got_error_set_errno(errcode);
+ }
+
return draw_commits(view, &s->last_displayed_entry,
&s->selected_entry, s->first_displayed_entry,
&s->commits, s->selected, view->nlines,
break;
case 'k':
case KEY_UP:
+ if (s->first_displayed_entry == NULL)
+ break;
if (s->selected > 0)
s->selected--;
if (s->selected > 0)
&s->commits);
break;
case KEY_PPAGE:
+ if (s->first_displayed_entry == NULL)
+ break;
if (TAILQ_FIRST(&s->commits.head) ==
s->first_displayed_entry) {
s->selected = 0;
break;
case 'j':
case KEY_DOWN:
+ if (s->first_displayed_entry == NULL)
+ break;
if (s->selected < MIN(view->nlines - 2,
s->commits.ncommits - 1)) {
s->selected++;
case KEY_NPAGE: {
struct commit_queue_entry *first;
first = s->first_displayed_entry;
+ if (first == NULL)
+ break;
err = scroll_down(&s->first_displayed_entry,
view->nlines, &s->last_displayed_entry,
&s->commits, &s->thread_args.log_complete,
break;
case KEY_ENTER:
case '\r':
+ if (s->selected_entry == NULL)
+ break;
if (view_is_parent_view(view))
begin_x = view_split_begin_x(view->begin_x);
err = open_diff_view_for_commit(&diff_view, begin_x,
*new_view = diff_view;
break;
case 't':
+ if (s->selected_entry == NULL)
+ break;
if (view_is_parent_view(view))
begin_x = view_split_begin_x(view->begin_x);
err = browse_commit(&tree_view, begin_x,
struct got_repository *thread_repo = NULL;
struct got_object_id *obj_id = NULL;
struct got_object *obj = NULL;
- int errcode;
err = got_object_id_by_path(&obj_id, repo, commit_id, path);
if (err)
blame->thread_args.complete = blame_complete;
*blame_complete = 0;
- errcode = pthread_create(&blame->thread, NULL, blame_thread,
- &blame->thread_args);
- if (errcode) {
- err = got_error_set_errno(errcode);
- goto done;
- }
-
done:
if (blob)
got_object_blob_close(blob);
{
const struct got_error *err = NULL;
struct tog_blame_view_state *s = &view->state.blame;
+ int errcode;
+
+ if (s->blame.thread == NULL) {
+ errcode = pthread_create(&s->blame.thread, NULL, blame_thread,
+ &s->blame.thread_args);
+ if (errcode)
+ return got_error_set_errno(errcode);
+ }
err = draw_blame(view, s->blamed_commit->id, s->blame.f,
s->path, s->blame.lines, s->blame.nlines, s->blame_complete,