MCPcopy Create free account
hub / github.com/git/git / unlock_worktree

Function unlock_worktree

builtin/worktree.c:1172–1201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1170}
1171
1172static 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
1203static void validate_no_submodules(const struct worktree *wt)
1204{

Callers

nothing calls this directly

Calls 10

parse_optionsFunction · 0.85
usage_with_optionsFunction · 0.85
get_worktreesFunction · 0.85
find_worktreeFunction · 0.85
is_main_worktreeFunction · 0.85
worktree_lock_reasonFunction · 0.85
repo_common_pathFunction · 0.85
unlink_or_warnFunction · 0.85
free_worktreesFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected