switch the "tog <path>" log view shortcut to the global reference list, too ok stsp
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 42 43 44 45 46 47 48 49 50 51 52 53 54
diff --git a/tog/tog.c b/tog/tog.c
index c02189d..34ef259 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -2756,9 +2756,12 @@ cmd_log(int argc, char *argv[])
if (error)
goto done;
- error = tog_load_refs(repo);
- if (error)
- goto done;
+ /* already loaded by tog_log_with_path()? */
+ if (SIMPLEQ_EMPTY(&tog_refs)) {
+ error = tog_load_refs(repo);
+ if (error)
+ goto done;
+ }
if (start_commit == NULL) {
error = got_repo_match_object_id(&start_id, &label,
@@ -6353,9 +6356,6 @@ tog_log_with_path(int argc, char *argv[])
struct got_object_id *commit_id = NULL, *id = NULL;
char *cwd = NULL, *repo_path = NULL, *in_repo_path = NULL;
char *commit_id_str = NULL, **cmd_argv = NULL;
- struct got_reflist_head refs;
-
- SIMPLEQ_INIT(&refs);
cwd = getcwd(NULL, 0);
if (cwd == NULL)
@@ -6383,12 +6383,12 @@ tog_log_with_path(int argc, char *argv[])
if (error)
goto done;
- error = got_ref_list(&refs, repo, NULL, got_ref_cmp_by_name, NULL);
+ error = tog_load_refs(repo);
if (error)
goto done;
error = got_repo_match_object_id(&commit_id, NULL, worktree ?
got_worktree_get_head_ref_name(worktree) : GOT_REF_HEAD,
- GOT_OBJ_TYPE_COMMIT, &refs, repo);
+ GOT_OBJ_TYPE_COMMIT, &tog_refs, repo);
if (error)
goto done;
@@ -6435,7 +6435,7 @@ done:
free(cmd_argv[i]);
free(cmd_argv);
}
- got_ref_list_free(&refs);
+ tog_free_refs();
return error;
}