mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
Merge branch 'jc/combine-diff-many-parents' into maint
* jc/combine-diff-many-parents: t4038: add tests for "diff --cc --raw <trees>" combine-diff: lift 32-way limit of combined diff
This commit is contained in:
commit
d49f9f178b
|
@ -982,14 +982,10 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
|||
free(sline);
|
||||
}
|
||||
|
||||
#define COLONS "::::::::::::::::::::::::::::::::"
|
||||
|
||||
static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct rev_info *rev)
|
||||
{
|
||||
struct diff_options *opt = &rev->diffopt;
|
||||
int i, offset;
|
||||
const char *prefix;
|
||||
int line_termination, inter_name_termination;
|
||||
int line_termination, inter_name_termination, i;
|
||||
|
||||
line_termination = opt->line_termination;
|
||||
inter_name_termination = '\t';
|
||||
|
@ -1000,17 +996,14 @@ static void show_raw_diff(struct combine_diff_path *p, int num_parent, struct re
|
|||
show_log(rev);
|
||||
|
||||
if (opt->output_format & DIFF_FORMAT_RAW) {
|
||||
offset = strlen(COLONS) - num_parent;
|
||||
if (offset < 0)
|
||||
offset = 0;
|
||||
prefix = COLONS + offset;
|
||||
/* As many colons as there are parents */
|
||||
for (i = 0; i < num_parent; i++)
|
||||
putchar(':');
|
||||
|
||||
/* Show the modes */
|
||||
for (i = 0; i < num_parent; i++) {
|
||||
printf("%s%06o", prefix, p->parent[i].mode);
|
||||
prefix = " ";
|
||||
}
|
||||
printf("%s%06o", prefix, p->mode);
|
||||
for (i = 0; i < num_parent; i++)
|
||||
printf("%06o ", p->parent[i].mode);
|
||||
printf("%06o", p->mode);
|
||||
|
||||
/* Show sha1's */
|
||||
for (i = 0; i < num_parent; i++)
|
||||
|
|
|
@ -89,4 +89,28 @@ test_expect_success 'diagnose truncated file' '
|
|||
grep "diff --cc file" out
|
||||
'
|
||||
|
||||
test_expect_success 'setup for --cc --raw' '
|
||||
blob=$(echo file | git hash-object --stdin -w) &&
|
||||
base_tree=$(echo "100644 blob $blob file" | git mktree) &&
|
||||
trees= &&
|
||||
for i in `test_seq 1 40`
|
||||
do
|
||||
blob=$(echo file$i | git hash-object --stdin -w) &&
|
||||
trees="$trees$(echo "100644 blob $blob file" | git mktree)$LF"
|
||||
done
|
||||
'
|
||||
|
||||
test_expect_success 'check --cc --raw with four trees' '
|
||||
four_trees=$(echo "$trees" | sed -e 4q) &&
|
||||
git diff --cc --raw $four_trees $base_tree >out &&
|
||||
# Check for four leading colons in the output:
|
||||
grep "^::::[^:]" out
|
||||
'
|
||||
|
||||
test_expect_success 'check --cc --raw with forty trees' '
|
||||
git diff --cc --raw $trees $base_tree >out &&
|
||||
# Check for forty leading colons in the output:
|
||||
grep "^::::::::::::::::::::::::::::::::::::::::[^:]" out
|
||||
'
|
||||
|
||||
test_done
|
||||
|
|
Loading…
Reference in a new issue