|
|
|
@ -39,6 +39,7 @@ static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr,
@@ -39,6 +39,7 @@ static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr,
|
|
|
|
|
p->mode = q->queue[i]->two->mode; |
|
|
|
|
memcpy(p->parent[n].sha1, q->queue[i]->one->sha1, 20); |
|
|
|
|
p->parent[n].mode = q->queue[i]->one->mode; |
|
|
|
|
p->parent[n].status = q->queue[i]->status; |
|
|
|
|
*tail = p; |
|
|
|
|
tail = &p->next; |
|
|
|
|
} |
|
|
|
@ -62,6 +63,7 @@ static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr,
@@ -62,6 +63,7 @@ static struct combine_diff_path *intersect_paths(struct combine_diff_path *curr,
|
|
|
|
|
memcpy(p->parent[n].sha1, |
|
|
|
|
q->queue[i]->one->sha1, 20); |
|
|
|
|
p->parent[n].mode = q->queue[i]->one->mode; |
|
|
|
|
p->parent[n].status = q->queue[i]->status; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -716,10 +718,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
@@ -716,10 +718,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
|
|
|
|
|
|
|
|
|
if (show_hunks || mode_differs) { |
|
|
|
|
const char *abb; |
|
|
|
|
char null_abb[DEFAULT_ABBREV + 1]; |
|
|
|
|
|
|
|
|
|
memset(null_abb, '0', DEFAULT_ABBREV); |
|
|
|
|
null_abb[DEFAULT_ABBREV] = 0; |
|
|
|
|
if (header) { |
|
|
|
|
shown_header++; |
|
|
|
|
puts(header); |
|
|
|
@ -734,26 +733,33 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
@@ -734,26 +733,33 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
|
|
|
|
for (i = 0; i < num_parent; i++) { |
|
|
|
|
if (elem->parent[i].mode != elem->mode) |
|
|
|
|
mode_differs = 1; |
|
|
|
|
if (memcmp(elem->parent[i].sha1, null_sha1, 20)) |
|
|
|
|
abb = find_unique_abbrev(elem->parent[i].sha1, |
|
|
|
|
DEFAULT_ABBREV); |
|
|
|
|
else |
|
|
|
|
abb = null_abb; |
|
|
|
|
abb = find_unique_abbrev(elem->parent[i].sha1, |
|
|
|
|
DEFAULT_ABBREV); |
|
|
|
|
printf("%s%s", i ? "," : "", abb); |
|
|
|
|
} |
|
|
|
|
if (memcmp(elem->sha1, null_sha1, 20)) |
|
|
|
|
abb = find_unique_abbrev(elem->sha1, DEFAULT_ABBREV); |
|
|
|
|
else |
|
|
|
|
abb = null_abb; |
|
|
|
|
abb = find_unique_abbrev(elem->sha1, DEFAULT_ABBREV); |
|
|
|
|
printf("..%s\n", abb); |
|
|
|
|
|
|
|
|
|
if (mode_differs) { |
|
|
|
|
printf("mode "); |
|
|
|
|
for (i = 0; i < num_parent; i++) { |
|
|
|
|
printf("%s%06o", i ? "," : "", |
|
|
|
|
elem->parent[i].mode); |
|
|
|
|
int added = !!elem->mode; |
|
|
|
|
for (i = 0; added && i < num_parent; i++) |
|
|
|
|
if (elem->parent[i].status != |
|
|
|
|
DIFF_STATUS_ADDED) |
|
|
|
|
added = 0; |
|
|
|
|
if (added) |
|
|
|
|
printf("new file mode %06o", elem->mode); |
|
|
|
|
else { |
|
|
|
|
if (!elem->mode) |
|
|
|
|
printf("deleted file "); |
|
|
|
|
printf("mode "); |
|
|
|
|
for (i = 0; i < num_parent; i++) { |
|
|
|
|
printf("%s%06o", i ? "," : "", |
|
|
|
|
elem->parent[i].mode); |
|
|
|
|
} |
|
|
|
|
if (elem->mode) |
|
|
|
|
printf("..%06o", elem->mode); |
|
|
|
|
} |
|
|
|
|
printf("..%06o\n", elem->mode); |
|
|
|
|
putchar('\n'); |
|
|
|
|
} |
|
|
|
|
dump_sline(sline, cnt, num_parent); |
|
|
|
|
} |
|
|
|
@ -820,8 +826,11 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, const cha
@@ -820,8 +826,11 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, const cha
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (opt->output_format == DIFF_FORMAT_RAW || |
|
|
|
|
opt->output_format == DIFF_FORMAT_NAME_STATUS) |
|
|
|
|
printf("%c%c", mod_type, inter_name_termination); |
|
|
|
|
opt->output_format == DIFF_FORMAT_NAME_STATUS) { |
|
|
|
|
for (i = 0; i < num_parent; i++) |
|
|
|
|
putchar(p->parent[i].status); |
|
|
|
|
putchar(inter_name_termination); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (line_termination) { |
|
|
|
|
if (quote_c_style(p->path, NULL, NULL, 0)) |
|
|
|
|