From cfc5789ada444423232fa1533f401b5972eb3f6c Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 25 Dec 2009 00:30:51 -0800 Subject: resolve-undo: record resolved conflicts in a new index extension section When resolving a conflict using "git add" to create a stage #0 entry, or "git rm" to remove entries at higher stages, remove_index_entry_at() function is eventually called to remove unmerged (i.e. higher stage) entries from the index. Introduce a "resolve_undo_info" structure and keep track of the removed cache entries, and save it in a new index extension section in the index_state. Operations like "read-tree -m", "merge", "checkout [-m] " and "reset" are signs that recorded information in the index is no longer necessary. The data is removed from the index extension when operations start; they may leave conflicted entries in the index, and later user actions like "git add" will record their conflicted states afresh. Signed-off-by: Junio C Hamano --- builtin-read-tree.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'builtin-read-tree.c') diff --git a/builtin-read-tree.c b/builtin-read-tree.c index 2a3a32cbfe..7d378b7548 100644 --- a/builtin-read-tree.c +++ b/builtin-read-tree.c @@ -13,6 +13,7 @@ #include "dir.h" #include "builtin.h" #include "parse-options.h" +#include "resolve-undo.h" static int nr_trees; static struct tree *trees[MAX_UNPACK_TREES]; @@ -122,6 +123,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix) die("You need to resolve your current index first"); stage = opts.merge = 1; } + resolve_undo_clear(); for (i = 0; i < argc; i++) { const char *arg = argv[i]; -- cgit v1.2.3