wt-status.h: drop stdio.h include
[gitweb.git] / builtin / checkout.c
index f95e7975f7e970cf205c9e97c25296324477f249..ffa776c6e10c9665489bd4ca6eac1d35efb011c8 100644 (file)
@@ -376,7 +376,7 @@ static int checkout_paths(const struct checkout_opts *opts,
                                                        ps_matched,
                                                        opts);
 
-       if (report_path_error(ps_matched, &opts->pathspec, opts->prefix)) {
+       if (report_path_error(ps_matched, &opts->pathspec)) {
                free(ps_matched);
                return 1;
        }
@@ -700,7 +700,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
                topts.initial_checkout = is_cache_unborn();
                topts.update = 1;
                topts.merge = 1;
-               topts.gently = opts->merge && old_branch_info->commit;
+               topts.quiet = opts->merge && old_branch_info->commit;
                topts.verbose_update = opts->show_progress;
                topts.fn = twoway_merge;
                if (opts->overwrite_ignore) {
@@ -725,6 +725,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
                         */
                        struct tree *result;
                        struct tree *work;
+                       struct tree *old_tree;
                        struct merge_options o;
                        struct strbuf sb = STRBUF_INIT;
 
@@ -737,6 +738,12 @@ static int merge_working_tree(const struct checkout_opts *opts,
                         */
                        if (!old_branch_info->commit)
                                return 1;
+                       old_tree = get_commit_tree(old_branch_info->commit);
+
+                       if (repo_index_has_changes(the_repository, old_tree, &sb))
+                               die(_("cannot continue with staged changes in "
+                                     "the following files:\n%s"), sb.buf);
+                       strbuf_release(&sb);
 
                        if (repo_index_has_changes(the_repository,
                                                   get_commit_tree(old_branch_info->commit),
@@ -781,7 +788,7 @@ static int merge_working_tree(const struct checkout_opts *opts,
                        ret = merge_trees(&o,
                                          get_commit_tree(new_branch_info->commit),
                                          work,
-                                         get_commit_tree(old_branch_info->commit),
+                                         old_tree,
                                          &result);
                        if (ret < 0)
                                exit(128);