Merge branch 'en/d-f-conflict-fix'
* en/d-f-conflict-fix: merge-recursive: Avoid excessive output for and reprocessing of renames merge-recursive: Fix multiple file rename across D/F conflict t6031: Add a testcase covering multiple renames across a D/F conflict merge-recursive: Fix typo Mark tests that use symlinks as needing SYMLINKS prerequisite t/t6035-merge-dir-to-symlink.sh: Remove TODO on passing test fast-import: Improve robustness when D->F changes provided in wrong order fast-export: Fix output order of D/F changes merge_recursive: Fix renames across paths below D/F conflicts merge-recursive: Fix D/F conflicts Add a rename + D/F conflict testcase Add additional testcases for D/F conflicts Conflicts: merge-recursive.c
This commit is contained in:
@ -148,10 +148,39 @@ static void handle_object(const unsigned char *sha1)
|
||||
free(buf);
|
||||
}
|
||||
|
||||
static int depth_first(const void *a_, const void *b_)
|
||||
{
|
||||
const struct diff_filepair *a = *((const struct diff_filepair **)a_);
|
||||
const struct diff_filepair *b = *((const struct diff_filepair **)b_);
|
||||
const char *name_a, *name_b;
|
||||
int len_a, len_b, len;
|
||||
int cmp;
|
||||
|
||||
name_a = a->one ? a->one->path : a->two->path;
|
||||
name_b = b->one ? b->one->path : b->two->path;
|
||||
|
||||
len_a = strlen(name_a);
|
||||
len_b = strlen(name_b);
|
||||
len = (len_a < len_b) ? len_a : len_b;
|
||||
|
||||
/* strcmp will sort 'd' before 'd/e', we want 'd/e' before 'd' */
|
||||
cmp = memcmp(name_a, name_b, len);
|
||||
if (cmp)
|
||||
return cmp;
|
||||
return (len_b - len_a);
|
||||
}
|
||||
|
||||
static void show_filemodify(struct diff_queue_struct *q,
|
||||
struct diff_options *options, void *data)
|
||||
{
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Handle files below a directory first, in case they are all deleted
|
||||
* and the directory changes to a file or symlink.
|
||||
*/
|
||||
qsort(q->queue, q->nr, sizeof(q->queue[0]), depth_first);
|
||||
|
||||
for (i = 0; i < q->nr; i++) {
|
||||
struct diff_filespec *ospec = q->queue[i]->one;
|
||||
struct diff_filespec *spec = q->queue[i]->two;
|
||||
|
||||
Reference in New Issue
Block a user