]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/checkout.c
Merge branch 'ja/misc-doc-fixes'
[thirdparty/git.git] / builtin / checkout.c
index 283719549120f23fff4441d450da604598c320c0..0951f8fee5cc2a88ac9e08009a69eaf446b6fed4 100644 (file)
@@ -651,7 +651,7 @@ static void setup_branch_path(struct branch_info *branch)
         * If this is a ref, resolve it; otherwise, look up the OID for our
         * expression.  Failure here is okay.
         */
-       if (!dwim_ref(branch->name, strlen(branch->name), &branch->oid, &branch->refname))
+       if (!dwim_ref(branch->name, strlen(branch->name), &branch->oid, &branch->refname, 0))
                repo_get_oid_committish(the_repository, branch->name, &branch->oid);
 
        strbuf_branchname(&buf, branch->name, INTERPRET_BRANCH_LOCAL);
@@ -1120,8 +1120,10 @@ static void setup_new_branch_info_and_source_tree(
        if (!check_refname_format(new_branch_info->path, 0) &&
            !read_ref(new_branch_info->path, &branch_rev))
                oidcpy(rev, &branch_rev);
-       else
+       else {
+               free((char *)new_branch_info->path);
                new_branch_info->path = NULL; /* not an existing branch */
+       }
 
        new_branch_info->commit = lookup_commit_reference_gently(the_repository, rev, 1);
        if (!new_branch_info->commit) {
@@ -1343,7 +1345,7 @@ static void die_expecting_a_branch(const struct branch_info *branch_info)
        struct object_id oid;
        char *to_free;
 
-       if (dwim_ref(branch_info->name, strlen(branch_info->name), &oid, &to_free) == 1) {
+       if (dwim_ref(branch_info->name, strlen(branch_info->name), &oid, &to_free, 0) == 1) {
                const char *ref = to_free;
 
                if (skip_prefix(ref, "refs/tags/", &ref))
@@ -1707,6 +1709,8 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
                die(_("--pathspec-file-nul requires --pathspec-from-file"));
        }
 
+       opts->pathspec.recursive = 1;
+
        if (opts->pathspec.nr) {
                if (1 < !!opts->writeout_stage + !!opts->force + !!opts->merge)
                        die(_("git checkout: --ours/--theirs, --force and --merge are incompatible when\n"