use a separate repository structure for blame thread
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
diff --git a/tog/tog.c b/tog/tog.c
index df9498a..d5ade28 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -1326,6 +1326,7 @@ show_blame_view(const char *path, struct got_object_id *commit_id,
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
struct tog_blame_cb_args blame_cb_args;
struct tog_blame_thread_args blame_thread_args;
+ struct got_repository *blame_thread_repo = NULL;
err = got_object_open_by_path(&obj, repo, commit_id, path);
if (err)
@@ -1353,6 +1354,10 @@ show_blame_view(const char *path, struct got_object_id *commit_id,
goto done;
}
+ err = got_repo_open(&blame_thread_repo, got_repo_get_path(repo));
+ if (err)
+ goto done;
+
if (tog_blame_view.window == NULL) {
tog_blame_view.window = newwin(0, 0, 0, 0);
if (tog_blame_view.window == NULL)
@@ -1383,7 +1388,7 @@ show_blame_view(const char *path, struct got_object_id *commit_id,
blame_thread_args.path = path;
blame_thread_args.commit_id = commit_id;
- blame_thread_args.repo = repo;
+ blame_thread_args.repo = blame_thread_repo;
blame_thread_args.blame_cb_args = &blame_cb_args;
blame_thread_args.complete = &blame_complete;
@@ -1491,6 +1496,8 @@ done:
if (err && err->code == GOT_ERR_ITER_COMPLETED)
err = NULL;
}
+ if (blame_thread_repo)
+ got_repo_close(blame_thread_repo);
if (blob)
got_object_blob_close(blob);
if (pobj)