Merge branch 'rs/strbuf-detach'
[gitweb.git] / builtin / checkout.c
index 91f8509f85396cb957ee87d1b0e8ba1284c8c800..0a3679eb776ec962d943f3d1902c9c6e7f1feea7 100644 (file)
@@ -126,6 +126,7 @@ static int update_some(const struct object_id *oid, struct strbuf *base,
        if (pos >= 0) {
                struct cache_entry *old = active_cache[pos];
                if (ce->ce_mode == old->ce_mode &&
+                   !ce_intent_to_add(old) &&
                    oideq(&ce->oid, &old->oid)) {
                        old->ce_flags |= CE_UPDATE;
                        discard_cache_entry(ce);
@@ -730,13 +731,6 @@ static int merge_working_tree(const struct checkout_opts *opts,
                                      "the following files:\n%s"), sb.buf);
                        strbuf_release(&sb);
 
-                       if (repo_index_has_changes(the_repository,
-                                                  get_commit_tree(old_branch_info->commit),
-                                                  &sb))
-                               warning(_("staged changes in the following files may be lost: %s"),
-                                       sb.buf);
-                       strbuf_release(&sb);
-
                        /* Do more real merge */
 
                        /*
@@ -1769,7 +1763,7 @@ int cmd_restore(int argc, const char **argv, const char *prefix)
        struct option *options;
        struct option restore_options[] = {
                OPT_STRING('s', "source", &opts.from_treeish, "<tree-ish>",
-                          N_("where the checkout from")),
+                          N_("which tree-ish to checkout from")),
                OPT_BOOL('S', "staged", &opts.checkout_index,
                           N_("restore the index")),
                OPT_BOOL('W', "worktree", &opts.checkout_worktree,