summaryrefslogtreecommitdiff
path: root/builtin/worktree.c
diff options
context:
space:
mode:
authorLibravatar Eric Sunshine <sunshine@sunshineco.com>2018-08-28 17:20:19 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-08-30 09:28:02 -0700
commite5353bef550d91655b3f8fb443a26c0ba209153f (patch)
tree6666646fba84d9ad82ef0b5bde442c6856001535 /builtin/worktree.c
parentworktree: don't die() in library function find_worktree() (diff)
downloadtgif-e5353bef550d91655b3f8fb443a26c0ba209153f.tar.xz
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>
Diffstat (limited to 'builtin/worktree.c')
-rw-r--r--builtin/worktree.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/builtin/worktree.c b/builtin/worktree.c
index 41e7714396..a8128289cc 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -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;