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 e70c6b35749c316f6e97099bd6bdac895c9d6f68 commit)
Mark Wooding committed
Feb 27, 2006 at 12:52 UTC
b9003c06a89a6d78255bb837c921ca03ee27fae6
1 file changed
+6
-4
combine-diff.c
+6
-4
@@ -621,7 +621,8 @@ static void reuse_combine_diff(struct sline *sline, unsigned long cnt,
621
}
622
623
static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
624
- int dense, const char *header)
624
+ int dense, const char *header,
625
+ struct diff_options *opt)
626
{
627
unsigned long size, cnt, lno;
628
char *result, *cp, *ep;
@@ -631,6 +632,7 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
632
char ourtmp_buf[TMPPATHLEN];
633
char *ourtmp = ourtmp_buf;
634
int working_tree_file = !memcmp(elem->sha1, null_sha1, 20);
635
+ int abbrev = opt->full_index ? 40 : DEFAULT_ABBREV;
636
637
/* Read the result of merge first */
638
if (!working_tree_file) {
@@ -735,10 +737,10 @@ static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
737
printf("index ");
738
for (i = 0; i < num_parent; i++) {
739
abb = find_unique_abbrev(elem->parent[i].sha1,
738
- DEFAULT_ABBREV);
740
+ abbrev);
741
printf("%s%s", i ? "," : "", abb);
742
}
741
- abb = find_unique_abbrev(elem->sha1, DEFAULT_ABBREV);
743
+ abb = find_unique_abbrev(elem->sha1, abbrev);
744
printf("..%s\n", abb);
745
746
if (mode_differs) {
@@ -862,7 +864,7 @@ int show_combined_diff(struct combine_diff_path *p,
864
865
default:
866
case DIFF_FORMAT_PATCH:
865
- return show_patch_diff(p, num_parent, dense, header);
867
+ return show_patch_diff(p, num_parent, dense, header, opt);
868
}
869
}
870