resolve-undo: teach "update-index --unresolve" to use resolve-undo info
[gitweb.git] / builtin-merge.c
index f1c84d759dd44f661fb76741d528e43702dfc901..6bc2f7af08ab94a5af8cd619d18dbe2244143c8b 100644 (file)
@@ -24,6 +24,7 @@
 #include "rerere.h"
 #include "help.h"
 #include "merge-recursive.h"
+#include "resolve-undo.h"
 
 #define DEFAULT_TWOHEAD (1<<0)
 #define DEFAULT_OCTOPUS (1<<1)
@@ -604,6 +605,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
                discard_cache();
                if (read_cache() < 0)
                        die("failed to read the cache");
+               resolve_undo_clear();
                return ret;
        }
 }
@@ -618,11 +620,10 @@ static void count_diff_files(struct diff_queue_struct *q,
 
 static int count_unmerged_entries(void)
 {
-       const struct index_state *state = &the_index;
        int i, ret = 0;
 
-       for (i = 0; i < state->cache_nr; i++)
-               if (ce_stage(state->cache[i]))
+       for (i = 0; i < active_nr; i++)
+               if (ce_stage(active_cache[i]))
                        ret++;
 
        return ret;
@@ -852,7 +853,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
        if (read_cache_unmerged())
                die("You are in the middle of a conflicted merge."
                                " (index unmerged)");
-
+       resolve_undo_clear();
        /*
         * Check if we are _not_ on a detached HEAD, i.e. if there is a
         * current branch.