aboutsummaryrefslogtreecommitdiff
path: root/builtin-checkout.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-12-25 11:57:11 -0800
committerJunio C Hamano <gitster@pobox.com>2009-12-25 17:10:10 -0800
commit4421a8235783d0664faa9a1d45be114fd7ad8206 (patch)
tree90505e56f05e1125140a21516a19667176da6e73 /builtin-checkout.c
parent4a39f79d3482cd844443b4ef9a8ef9b3d72faa5b (diff)
downloadgit-4421a8235783d0664faa9a1d45be114fd7ad8206.tar.gz
git-4421a8235783d0664faa9a1d45be114fd7ad8206.tar.xz
resolve-undo: "checkout -m path" uses resolve-undo information
Once you resolved conflicts by "git add path", you cannot recreate the conflicted state with "git checkout -m path", because you lost information from higher stages in the index when you resolved them. Since we record the necessary information in the resolve-undo index extension these days, we can reproduce the unmerged state in the index and check it out. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-checkout.c')
-rw-r--r--builtin-checkout.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin-checkout.c b/builtin-checkout.c
index a0fe7a4e6..bdef1aa38 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -235,6 +235,10 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
if (report_path_error(ps_matched, pathspec, 0))
return 1;
+ /* "checkout -m path" to recreate conflicted state */
+ if (opts->merge)
+ unmerge_cache(pathspec);
+
/* Any unmerged paths? */
for (pos = 0; pos < active_nr; pos++) {
struct cache_entry *ce = active_cache[pos];