]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/checkout.c
Merge branch 'jk/unused-params-even-more'
[thirdparty/git.git] / builtin / checkout.c
index 72f7110fd80a38431734b8996a9b2f1f6c7887a0..2e72a5e5a944e99ef7e3e44cdcb2e8b2feb22a90 100644 (file)
@@ -726,6 +726,8 @@ static int merge_working_tree(const struct checkout_opts *opts,
                        struct tree *result;
                        struct tree *work;
                        struct merge_options o;
+                       struct strbuf sb = STRBUF_INIT;
+
                        if (!opts->merge)
                                return 1;
 
@@ -736,6 +738,13 @@ static int merge_working_tree(const struct checkout_opts *opts,
                        if (!old_branch_info->commit)
                                return 1;
 
+                       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 */
 
                        /*