Merge branch 'jc/fix-add-u-unmerged'
authorJunio C Hamano <gitster@pobox.com>
Fri, 13 May 2011 18:01:15 +0000 (11:01 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 13 May 2011 18:01:15 +0000 (11:01 -0700)
* jc/fix-add-u-unmerged:
  Fix "add -u" that sometimes fails to resolve unmerged paths

1  2 
builtin/add.c
t/t2200-add-update.sh

diff --cc builtin/add.c
index d39a6ab930adf2e3cd716d3e9925350befed8947,027ca3b6d10d42b6e1688ae06bd066f36e6ea161..704141fddfe9033c6031953ae35e799896963441
@@@ -35,30 -57,9 +56,9 @@@ static void update_callback(struct diff
        for (i = 0; i < q->nr; i++) {
                struct diff_filepair *p = q->queue[i];
                const char *path = p->one->path;
-               switch (p->status) {
+               switch (fix_unmerged_status(p, data)) {
                default:
 -                      die("unexpected diff status %c", p->status);
 +                      die(_("unexpected diff status %c"), p->status);
-               case DIFF_STATUS_UNMERGED:
-                       /*
-                        * ADD_CACHE_IGNORE_REMOVAL is unset if "git
-                        * add -u" is calling us, In such a case, a
-                        * missing work tree file needs to be removed
-                        * if there is an unmerged entry at stage #2,
-                        * but such a diff record is followed by
-                        * another with DIFF_STATUS_DELETED (and if
-                        * there is no stage #2, we won't see DELETED
-                        * nor MODIFIED).  We can simply continue
-                        * either way.
-                        */
-                       if (!(data->flags & ADD_CACHE_IGNORE_REMOVAL))
-                               continue;
-                       /*
-                        * Otherwise, it is "git add path" is asking
-                        * to explicitly add it; we fall through.  A
-                        * missing work tree file is an error and is
-                        * caught by add_file_to_index() in such a
-                        * case.
-                        */
                case DIFF_STATUS_MODIFIED:
                case DIFF_STATUS_TYPE_CHANGED:
                        if (add_file_to_index(&the_index, path, data->flags)) {
Simple merge