Makefile: introduce NO_PTHREADS
[gitweb.git] / builtin-checkout.c
index 06904c3bd3595b4c8cbc6c66d3a1b9c364381bd6..7f3bd7bb1cb8f211c78067df9376541e0aa3f923 100644 (file)
@@ -397,8 +397,7 @@ static int merge_working_tree(struct checkout_opts *opts,
                }
 
                /* 2-way merge to the new branch */
-               topts.initial_checkout = (!active_nr &&
-                                         (old->commit == new->commit));
+               topts.initial_checkout = is_cache_unborn();
                topts.update = 1;
                topts.merge = 1;
                topts.gently = opts->merge;
@@ -554,7 +553,7 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
        if (!opts->quiet && !old.path && old.commit && new->commit != old.commit)
                describe_detached_head("Previous HEAD position was", old.commit);
 
-       if (!old.commit) {
+       if (!old.commit && !opts->force) {
                if (!opts->quiet) {
                        fprintf(stderr, "warning: You appear to be on a branch yet to be born.\n");
                        fprintf(stderr, "warning: Forcing checkout of %s.\n", new->name);