commit - 04cc582a80a4cd5be1f1e7d987164c7319ed2afc
commit + e1cd8fed16970685c1501256ce7683bc4fca5579
blob - df1b81bf79be09548eca828410496219ccc1f446
blob + 50007d6fa81efd0b12d0793b274f5d90b77a589b
--- tog/tog.c
+++ tog/tog.c
show_log_view(struct tog_view *, struct got_object_id *,
struct got_repository *, const char *);
static const struct got_error *
-show_blame_view(const char *, struct got_object_id *, struct got_repository *);
+show_blame_view(struct tog_view *, const char *, struct got_object_id *,
+ struct got_repository *);
static const struct got_error *
show_tree_view(struct got_tree_object *, struct got_object_id *,
struct got_repository *);
}
static const struct got_error *
-show_blame_view(const char *path, struct got_object_id *commit_id,
- struct got_repository *repo)
+show_blame_view(struct tog_view *view, const char *path,
+ struct got_object_id *commit_id, struct got_repository *repo)
{
const struct got_error *err = NULL, *thread_err = NULL;
int ch, done = 0, first_displayed_line = 1, last_displayed_line;
struct tog_blame blame;
struct got_object_id_queue blamed_commits;
struct got_object_qid *blamed_commit = NULL;
- struct tog_view *view = NULL, *diff_view;
+ struct tog_view *diff_view;
SIMPLEQ_INIT(&blamed_commits);
goto done;
SIMPLEQ_INSERT_HEAD(&blamed_commits, blamed_commit, entry);
- view = open_view(0, 0, 0, 0);
- if (view == NULL) {
- err = got_error_from_errno();
- goto done;
- }
show_panel(view->panel);
last_displayed_line = view->nlines;
got_object_close(pobj);
if (blame.thread)
thread_err = stop_blame(&blame);
- if (view)
- close_view(view);
while (!SIMPLEQ_EMPTY(&blamed_commits)) {
blamed_commit = SIMPLEQ_FIRST(&blamed_commits);
SIMPLEQ_REMOVE_HEAD(&blamed_commits, entry);
struct got_object_id *commit_id = NULL;
char *commit_id_str = NULL;
int ch;
+ struct tog_view *view;
#ifndef PROFILE
if (pledge("stdio rpath wpath cpath flock proc tty", NULL) == -1)
if (error != NULL)
goto done;
- error = show_blame_view(path, commit_id, repo);
+ view = open_view(0, 0, 0, 0);
+ if (view == NULL) {
+ error = got_error_from_errno();
+ goto done;
+ }
+ error = show_blame_view(view, path, commit_id, repo);
+ close_view(view);
done:
free(commit_id);
if (repo)
}
static const struct got_error *
-blame_tree_entry(struct got_tree_entry *te, struct tog_parent_trees *parents,
- struct got_object_id *commit_id, struct got_repository *repo)
+blame_tree_entry(struct tog_view *view, struct got_tree_entry *te,
+ struct tog_parent_trees *parents, struct got_object_id *commit_id,
+ struct got_repository *repo)
{
const struct got_error *err = NULL;
char *path;
if (err)
return err;
- err = show_blame_view(path, commit_id, repo);
+ err = show_blame_view(view, path, commit_id, repo);
free(path);
return err;
}
selected = 0;
first_displayed_entry = NULL;
} else if (S_ISREG(selected_entry->mode)) {
- err = blame_tree_entry(selected_entry,
- &parents, commit_id, repo);
+ struct tog_view *blame_view;
+ blame_view = open_view(0, 0, 0, 0);
+ if (blame_view == NULL) {
+ err = got_error_from_errno();
+ goto done;
+ }
+ err = blame_tree_entry(blame_view,
+ selected_entry, &parents,
+ commit_id, repo);
+ close_view(blame_view);
if (err)
goto done;
}