Merge branch 'nd/diff-i-t-a'
authorJunio C Hamano <gitster@pobox.com>
Thu, 25 Jun 2015 17:47:46 +0000 (10:47 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Jun 2015 17:47:46 +0000 (10:47 -0700)
* nd/diff-i-t-a:
Revert "diff-lib.c: adjust position of i-t-a entries in diff"

1  2 
builtin/add.c
diff-lib.c
diff --combined builtin/add.c
index df5135bf62acabfa9f68793435c1576ba7c1a36a,3390933d68b2dd6c7296a7d2103d009fa27f2ca8..4bd98b799e7e1a46beb09249ab2299f4d2b335b8
@@@ -63,7 -63,6 +63,6 @@@ static void update_callback(struct diff
                switch (fix_unmerged_status(p, data)) {
                default:
                        die(_("unexpected diff status %c"), p->status);
-               case DIFF_STATUS_ADDED:
                case DIFF_STATUS_MODIFIED:
                case DIFF_STATUS_TYPE_CHANGED:
                        if (add_file_to_index(&the_index, path, data->flags)) {
@@@ -209,8 -208,7 +208,8 @@@ static int edit_patch(int argc, const c
        if (run_diff_files(&rev, 0))
                die(_("Could not write patch"));
  
 -      launch_editor(file, NULL, NULL);
 +      if (launch_editor(file, NULL, NULL))
 +              die(_("editing patch failed"));
  
        if (stat(file, &st))
                die_errno(_("Could not stat '%s'"), file);
diff --combined diff-lib.c
index 0d8c5358e4236bf1d0c2ceb214d6a4fa09b2d2de,a85c4971ac8ece6397c05d0674bbac8c75cf219f..241a8435eb1f7ddb88664343a5d9c42a1951886f
@@@ -125,7 -125,7 +125,7 @@@ int run_diff_files(struct rev_info *rev
                        dpath->next = NULL;
                        memcpy(dpath->path, ce->name, path_len);
                        dpath->path[path_len] = '\0';
 -                      hashclr(dpath->sha1);
 +                      oidclr(&dpath->oid);
                        memset(&(dpath->parent[0]), 0,
                               sizeof(struct combine_diff_parent)*5);
  
                                if (2 <= stage) {
                                        int mode = nce->ce_mode;
                                        num_compare_stages++;
 -                                      hashcpy(dpath->parent[stage-2].sha1, nce->sha1);
 +                                      hashcpy(dpath->parent[stage-2].oid.hash, nce->sha1);
                                        dpath->parent[stage-2].mode = ce_mode_from_stat(nce, mode);
                                        dpath->parent[stage-2].status =
                                                DIFF_STATUS_MODIFIED;
                                               ce->sha1, !is_null_sha1(ce->sha1),
                                               ce->name, 0);
                                continue;
-                       } else if (ce->ce_flags & CE_INTENT_TO_ADD) {
-                               diff_addremove(&revs->diffopt, '+', ce->ce_mode,
-                                              EMPTY_BLOB_SHA1_BIN, 0,
-                                              ce->name, 0);
-                               continue;
                        }
  
                        changed = match_stat_with_submodule(&revs->diffopt, ce, &st,
@@@ -344,14 -339,14 +339,14 @@@ static int show_modified(struct rev_inf
                memcpy(p->path, new->name, pathlen);
                p->path[pathlen] = 0;
                p->mode = mode;
 -              hashclr(p->sha1);
 +              oidclr(&p->oid);
                memset(p->parent, 0, 2 * sizeof(struct combine_diff_parent));
                p->parent[0].status = DIFF_STATUS_MODIFIED;
                p->parent[0].mode = new->ce_mode;
 -              hashcpy(p->parent[0].sha1, new->sha1);
 +              hashcpy(p->parent[0].oid.hash, new->sha1);
                p->parent[1].status = DIFF_STATUS_MODIFIED;
                p->parent[1].mode = old->ce_mode;
 -              hashcpy(p->parent[1].sha1, old->sha1);
 +              hashcpy(p->parent[1].oid.hash, old->sha1);
                show_combined_diff(p, 2, revs->dense_combined_merges, revs);
                free(p);
                return 0;
@@@ -381,13 -376,6 +376,6 @@@ static void do_oneway_diff(struct unpac
        struct rev_info *revs = o->unpack_data;
        int match_missing, cached;
  
-       /* i-t-a entries do not actually exist in the index */
-       if (idx && (idx->ce_flags & CE_INTENT_TO_ADD)) {
-               idx = NULL;
-               if (!tree)
-                       return; /* nothing to diff.. */
-       }
        /* if the entry is not checked out, don't examine work tree */
        cached = o->index_only ||
                (idx && ((idx->ce_flags & CE_VALID) || ce_skip_worktree(idx)));