Code

ignore-errors requires cl
[git.git] / combine-diff.c
index 0682acd50d618e4ba8319372c46c72b3e479b8e6..65c786807b3cca8408d5119d03a8e4e268bd3e76 100644 (file)
@@ -31,9 +31,9 @@ static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr,
                        memset(p->parent, 0,
                               sizeof(p->parent[0]) * num_parent);
 
-                       memcpy(p->sha1, q->queue[i]->two->sha1, 20);
+                       hashcpy(p->sha1, q->queue[i]->two->sha1);
                        p->mode = q->queue[i]->two->mode;
-                       memcpy(p->parent[n].sha1, q->queue[i]->one->sha1, 20);
+                       hashcpy(p->parent[n].sha1, q->queue[i]->one->sha1);
                        p->parent[n].mode = q->queue[i]->one->mode;
                        p->parent[n].status = q->queue[i]->status;
                        *tail = p;
@@ -56,8 +56,7 @@ static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr,
                        len = strlen(path);
                        if (len == p->len && !memcmp(path, p->path, len)) {
                                found = 1;
-                               memcpy(p->parent[n].sha1,
-                                      q->queue[i]->one->sha1, 20);
+                               hashcpy(p->parent[n].sha1, q->queue[i]->one->sha1);
                                p->parent[n].mode = q->queue[i]->one->mode;
                                p->parent[n].status = q->queue[i]->status;
                                break;
@@ -857,8 +856,10 @@ void diff_tree_combined(const unsigned char *sha1,
                /* show stat against the first parent even
                 * when doing combined diff.
                 */
-               if (i == 0 && opt->output_format & DIFF_FORMAT_DIFFSTAT)
-                       diffopts.output_format = DIFF_FORMAT_DIFFSTAT;
+               int stat_opt = (opt->output_format &
+                               (DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT));
+               if (i == 0 && stat_opt)
+                       diffopts.output_format = stat_opt;
                else
                        diffopts.output_format = DIFF_FORMAT_NO_OUTPUT;
                diff_tree_sha1(parent[i], sha1, "", &diffopts);
@@ -888,7 +889,8 @@ void diff_tree_combined(const unsigned char *sha1,
                        }
                        needsep = 1;
                }
-               else if (opt->output_format & DIFF_FORMAT_DIFFSTAT)
+               else if (opt->output_format &
+                        (DIFF_FORMAT_NUMSTAT|DIFF_FORMAT_DIFFSTAT))
                        needsep = 1;
                if (opt->output_format & DIFF_FORMAT_PATCH) {
                        if (needsep)
@@ -927,6 +929,7 @@ void diff_tree_combined_merge(const unsigned char *sha1,
        for (parents = commit->parents, num_parent = 0;
             parents;
             parents = parents->next, num_parent++)
-               memcpy(parent + num_parent, parents->item->object.sha1, 20);
+               hashcpy((unsigned char*)(parent + num_parent),
+                       parents->item->object.sha1);
        diff_tree_combined(sha1, parent, num_parent, dense, rev);
 }