summaryrefslogtreecommitdiff
path: root/builtin-update-index.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2010-01-20 14:44:31 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-01-20 14:46:35 -0800
commit6751e0471df1bdc4a1d5e5a3929a531c74e95aeb (patch)
tree4f25445b5ceb6f83473f60a36c7d09d2e1f0378e /builtin-update-index.c
parentMerge branch 'js/exec-error-report' (diff)
parentrerere forget path: forget recorded resolution (diff)
downloadtgif-6751e0471df1bdc4a1d5e5a3929a531c74e95aeb.tar.xz
Merge branch 'jc/cache-unmerge'
* jc/cache-unmerge: rerere forget path: forget recorded resolution rerere: refactor rerere logic to make it independent from I/O rerere: remove silly 1024-byte line limit resolve-undo: teach "update-index --unresolve" to use resolve-undo info resolve-undo: "checkout -m path" uses resolve-undo information resolve-undo: allow plumbing to clear the information resolve-undo: basic tests resolve-undo: record resolved conflicts in a new index extension section builtin-merge.c: use standard active_cache macros Conflicts: builtin-ls-files.c builtin-merge.c builtin-rerere.c
Diffstat (limited to 'builtin-update-index.c')
-rw-r--r--builtin-update-index.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/builtin-update-index.c b/builtin-update-index.c
index a64a752990..3ab214d24e 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -9,6 +9,7 @@
#include "tree-walk.h"
#include "builtin.h"
#include "refs.h"
+#include "resolve-undo.h"
/*
* Default to not allowing changes to the list of files. The
@@ -440,7 +441,18 @@ static int unresolve_one(const char *path)
/* See if there is such entry in the index. */
pos = cache_name_pos(path, namelen);
- if (pos < 0) {
+ if (0 <= pos) {
+ /* already merged */
+ pos = unmerge_cache_entry_at(pos);
+ if (pos < active_nr) {
+ struct cache_entry *ce = active_cache[pos];
+ if (ce_stage(ce) &&
+ ce_namelen(ce) == namelen &&
+ !memcmp(ce->name, path, namelen))
+ return 0;
+ }
+ /* no resolve-undo information; fall back */
+ } else {
/* If there isn't, either it is unmerged, or
* resolved as "removed" by mistake. We do not
* want to do anything in the former case.
@@ -719,6 +731,10 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
verbose = 1;
continue;
}
+ if (!strcmp(path, "--clear-resolve-undo")) {
+ resolve_undo_clear();
+ continue;
+ }
if (!strcmp(path, "-h") || !strcmp(path, "--help"))
usage(update_index_usage);
die("unknown option %s", path);