worktree: move delete_git_dir() earlier in file for upcoming new callers
authorEric Sunshine <sunshine@sunshineco.com>
Tue, 28 Aug 2018 21:20:19 +0000 (17:20 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 30 Aug 2018 16:28:02 +0000 (09:28 -0700)
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>
builtin/worktree.c
index 41e7714396dc3334bcb29f2454d210d63a649243..a8128289cce78a007ee8adf94b51e6989ce35191 100644 (file)
@@ -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;