| 1170 | } |
| 1171 | |
| 1172 | static int unlock_worktree(int ac, const char **av, const char *prefix, |
| 1173 | struct repository *repo UNUSED) |
| 1174 | { |
| 1175 | struct option options[] = { |
| 1176 | OPT_END() |
| 1177 | }; |
| 1178 | struct worktree **worktrees, *wt; |
| 1179 | char *path; |
| 1180 | int ret; |
| 1181 | |
| 1182 | ac = parse_options(ac, av, prefix, options, git_worktree_unlock_usage, 0); |
| 1183 | if (ac != 1) |
| 1184 | usage_with_options(git_worktree_unlock_usage, options); |
| 1185 | |
| 1186 | worktrees = get_worktrees(); |
| 1187 | wt = find_worktree(worktrees, prefix, av[0]); |
| 1188 | if (!wt) |
| 1189 | die(_("'%s' is not a working tree"), av[0]); |
| 1190 | if (is_main_worktree(wt)) |
| 1191 | die(_("The main working tree cannot be locked or unlocked")); |
| 1192 | if (!worktree_lock_reason(wt)) |
| 1193 | die(_("'%s' is not locked"), av[0]); |
| 1194 | |
| 1195 | path = repo_common_path(the_repository, "worktrees/%s/locked", wt->id); |
| 1196 | ret = unlink_or_warn(path); |
| 1197 | |
| 1198 | free_worktrees(worktrees); |
| 1199 | free(path); |
| 1200 | return ret; |
| 1201 | } |
| 1202 | |
| 1203 | static void validate_no_submodules(const struct worktree *wt) |
| 1204 | { |
nothing calls this directly
no test coverage detected