Commit Diff


commit - fe66084b58b0c7faa4fa6510bd049745023c6635
commit + f23456fbfb95d8089a0126438d76525b5955a136
blob - 6b7c7bd27c8c62a8167e54f6c70ee316583c9367
blob + f5978be88b972b41efa6edf3e0bf75ae89144418
--- got/got.c
+++ got/got.c
@@ -6414,7 +6414,7 @@ done:
 #endif
 
 static const struct got_error *
-list_tags(struct got_repository *repo, struct got_worktree *worktree)
+list_tags(struct got_repository *repo)
 {
 	static const struct got_error *err = NULL;
 	struct got_reflist_head refs;
@@ -6799,13 +6799,18 @@ cmd_tag(int argc, char *argv[])
 	}
 
 	if (do_list) {
+		if (worktree) {
+			/* Release work tree lock. */
+			got_worktree_close(worktree);
+			worktree = NULL;
+		}
 		error = got_repo_open(&repo, repo_path, NULL);
 		if (error != NULL)
 			goto done;
 		error = apply_unveil(got_repo_get_path(repo), 1, NULL);
 		if (error)
 			goto done;
-		error = list_tags(repo, worktree);
+		error = list_tags(repo);
 	} else {
 		error = get_gitconfig_path(&gitconfig_path);
 		if (error)