combine-diff: Honour --full-index.
For some reason, combined diffs don't honour the --full-index flag when
emitting patches. Fix this.
Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
(cherry picked from e70c6b3574
commit)
This commit is contained in:
parent
a64dd34d8c
commit
b9003c06a8
@ -621,7 +621,8 @@ static void reuse_combine_diff(struct sline *sline, unsigned long cnt,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
||||||
int dense, const char *header)
|
int dense, const char *header,
|
||||||
|
struct diff_options *opt)
|
||||||
{
|
{
|
||||||
unsigned long size, cnt, lno;
|
unsigned long size, cnt, lno;
|
||||||
char *result, *cp, *ep;
|
char *result, *cp, *ep;
|
||||||
@ -631,6 +632,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
|||||||
char ourtmp_buf[TMPPATHLEN];
|
char ourtmp_buf[TMPPATHLEN];
|
||||||
char *ourtmp = ourtmp_buf;
|
char *ourtmp = ourtmp_buf;
|
||||||
int working_tree_file = !memcmp(elem->sha1, null_sha1, 20);
|
int working_tree_file = !memcmp(elem->sha1, null_sha1, 20);
|
||||||
|
int abbrev = opt->full_index ? 40 : DEFAULT_ABBREV;
|
||||||
|
|
||||||
/* Read the result of merge first */
|
/* Read the result of merge first */
|
||||||
if (!working_tree_file) {
|
if (!working_tree_file) {
|
||||||
@ -735,10 +737,10 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
|||||||
printf("index ");
|
printf("index ");
|
||||||
for (i = 0; i < num_parent; i++) {
|
for (i = 0; i < num_parent; i++) {
|
||||||
abb = find_unique_abbrev(elem->parent[i].sha1,
|
abb = find_unique_abbrev(elem->parent[i].sha1,
|
||||||
DEFAULT_ABBREV);
|
abbrev);
|
||||||
printf("%s%s", i ? "," : "", abb);
|
printf("%s%s", i ? "," : "", abb);
|
||||||
}
|
}
|
||||||
abb = find_unique_abbrev(elem->sha1, DEFAULT_ABBREV);
|
abb = find_unique_abbrev(elem->sha1, abbrev);
|
||||||
printf("..%s\n", abb);
|
printf("..%s\n", abb);
|
||||||
|
|
||||||
if (mode_differs) {
|
if (mode_differs) {
|
||||||
@ -862,7 +864,7 @@ int show_combined_diff(struct combine_diff_path *p,
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
case DIFF_FORMAT_PATCH:
|
case DIFF_FORMAT_PATCH:
|
||||||
return show_patch_diff(p, num_parent, dense, header);
|
return show_patch_diff(p, num_parent, dense, header, opt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user