mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
worktree: move delete_git_dir() earlier in file for upcoming new callers
This is a pure code movement to avoid having to forward-declare the function when new callers are subsequently added. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
4c5fa9e6c4
commit
e5353bef55
|
@ -47,6 +47,20 @@ static int git_worktree_config(const char *var, const char *value, void *cb)
|
|||
return git_default_config(var, value, cb);
|
||||
}
|
||||
|
||||
static int delete_git_dir(struct worktree *wt)
|
||||
{
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
int ret = 0;
|
||||
|
||||
strbuf_addstr(&sb, git_common_path("worktrees/%s", wt->id));
|
||||
if (remove_dir_recursively(&sb, 0)) {
|
||||
error_errno(_("failed to delete '%s'"), sb.buf);
|
||||
ret = -1;
|
||||
}
|
||||
strbuf_release(&sb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int prune_worktree(const char *id, struct strbuf *reason)
|
||||
{
|
||||
struct stat st;
|
||||
|
@ -822,20 +836,6 @@ static int delete_git_work_tree(struct worktree *wt)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int delete_git_dir(struct worktree *wt)
|
||||
{
|
||||
struct strbuf sb = STRBUF_INIT;
|
||||
int ret = 0;
|
||||
|
||||
strbuf_addstr(&sb, git_common_path("worktrees/%s", wt->id));
|
||||
if (remove_dir_recursively(&sb, 0)) {
|
||||
error_errno(_("failed to delete '%s'"), sb.buf);
|
||||
ret = -1;
|
||||
}
|
||||
strbuf_release(&sb);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int remove_worktree(int ac, const char **av, const char *prefix)
|
||||
{
|
||||
int force = 0;
|
||||
|
|
Loading…
Reference in a new issue