Code

Merge branch 'jc/fix-add-u-unmerged' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 16 May 2011 23:37:33 +0000 (16:37 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 May 2011 23:37:33 +0000 (16:37 -0700)
* jc/fix-add-u-unmerged:
  Fix "add -u" that sometimes fails to resolve unmerged paths

Conflicts:
builtin/add.c

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

diff --cc builtin/add.c
index 944e5a8cc9f4741c01cdca2911212d462faadcd3,027ca3b6d10d42b6e1688ae06bd066f36e6ea161..e57abddf5297432d62bc20b8e3bde2e5eab474c4
@@@ -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