prefer git_pathdup to git_path in some possibly-dangerous cases
[gitweb.git] / builtin / worktree.c
index 050b443dc008e4da542147edae391735426844c4..6a264ee749221cd6c6bf98ce68790bdec3dd82c5 100644 (file)
@@ -5,6 +5,7 @@
 #include "argv-array.h"
 #include "run-command.h"
 #include "sigchain.h"
+#include "refs.h"
 
 static const char * const worktree_usage[] = {
        N_("git worktree add [<options>] <path> <branch>"),
@@ -303,7 +304,7 @@ static int add(int ac, const char **av, const char *prefix)
 
        argv_array_push(&cmd, "checkout");
        if (force)
-               argv_array_push(&cmd, "--force");
+               argv_array_push(&cmd, "--ignore-other-worktrees");
        if (new_branch)
                argv_array_pushl(&cmd, "-b", new_branch, NULL);
        if (new_branch_force)