call get_worktree_paths_from_argv() after unveil(2) where possible
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
diff --git a/got/got.c b/got/got.c
index 0b09fb1..6016098 100644
--- a/got/got.c
+++ b/got/got.c
@@ -1161,10 +1161,6 @@ cmd_update(int argc, char *argv[])
if (error)
goto done;
- error = get_worktree_paths_from_argv(&paths, argc, argv, worktree);
- if (error)
- goto done;
-
error = got_repo_open(&repo, got_worktree_get_repo_path(worktree));
if (error != NULL)
goto done;
@@ -1174,6 +1170,10 @@ cmd_update(int argc, char *argv[])
if (error)
goto done;
+ error = get_worktree_paths_from_argv(&paths, argc, argv, worktree);
+ if (error)
+ goto done;
+
error = got_ref_open(&head_ref, repo, branch_name ? branch_name :
got_worktree_get_head_ref_name(worktree), 0);
if (error != NULL)
@@ -2458,10 +2458,6 @@ cmd_status(int argc, char *argv[])
if (error != NULL)
goto done;
- error = get_worktree_paths_from_argv(&paths, argc, argv, worktree);
- if (error)
- goto done;
-
error = got_repo_open(&repo, got_worktree_get_repo_path(worktree));
if (error != NULL)
goto done;
@@ -2471,6 +2467,10 @@ cmd_status(int argc, char *argv[])
if (error)
goto done;
+ error = get_worktree_paths_from_argv(&paths, argc, argv, worktree);
+ if (error)
+ goto done;
+
error = got_worktree_status(worktree, &paths, repo, print_status, NULL,
check_cancelled, NULL);
done:
@@ -3312,10 +3312,6 @@ cmd_commit(int argc, char *argv[])
if (error)
goto done;
- error = get_worktree_paths_from_argv(&paths, argc, argv, worktree);
- if (error)
- goto done;
-
error = got_repo_open(&repo, got_worktree_get_repo_path(worktree));
if (error != NULL)
goto done;
@@ -3332,6 +3328,10 @@ cmd_commit(int argc, char *argv[])
if (error)
goto done;
+ error = get_worktree_paths_from_argv(&paths, argc, argv, worktree);
+ if (error)
+ goto done;
+
cl_arg.editor = editor;
cl_arg.cmdline_log = logmsg;
cl_arg.worktree_path = got_worktree_get_root_path(worktree);