@matheusbsbs / matheus-bagliano / commits / 4a39f79d34
Fork 0

resolve-undo: allow plumbing to clear the information

At the Porcelain level, operations such as merge that populate an initially cleanly merged index with conflicted entries clear the resolve-undo information upfront. Give scripted Porcelains a way to do the same, by implementing "update-index --clear-resolve-info". With this, a scripted Porcelain may "update-index --clear-resolve-info" first and repeatedly run "update-index --cacheinfo" to stuff unmerged entries to the index, to be resolved by the user with "git add" and stuff. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Dec 25, 2009 at 10:31 UTC 4a39f79d3482cd844443b4ef9a8ef9b3d72faa5b
2 files changed +17
builtin-update-index.c
+5
@@ -9,6 +9,7 @@
9 #include "tree-walk.h"
10 #include "builtin.h"
11 #include "refs.h"
12 +#include "resolve-undo.h"
13
14 /*
15 * Default to not allowing changes to the list of files. The
@@ -703,6 +704,10 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
704 verbose = 1;
705 continue;
706 }
707 + if (!strcmp(path, "--clear-resolve-undo")) {
708 + resolve_undo_clear();
709 + continue;
710 + }
711 if (!strcmp(path, "-h") || !strcmp(path, "--help"))
712 usage(update_index_usage);
713 die("unknown option %s", path);
t/t2030-unresolve-info.sh
+12
@@ -85,4 +85,16 @@ test_expect_success 'rm records reset clears' '
85 check_resolve_undo discarded
86 '
87
88 +test_expect_success 'plumbing clears' '
89 + prime_resolve_undo &&
90 + test_tick &&
91 + git commit -m merged &&
92 + echo committing keeps &&
93 + check_resolve_undo kept file initial:file second:file third:file &&
94 +
95 + echo plumbing clear &&
96 + git update-index --clear-resolve-undo &&
97 + check_resolve_undo cleared
98 +'
99 +
100 test_done