We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2cd8ccb + 8ab41d0 commit cf8df3dCopy full SHA for cf8df3d
diffcore-rename.c
@@ -81,6 +81,18 @@ static struct diff_rename_src *register_rename_src(struct diff_filepair *p)
81
82
first = 0;
83
last = rename_src_nr;
84
+
85
+ if (last > 0) {
86
+ struct diff_rename_src *src = &(rename_src[last-1]);
87
+ int cmp = strcmp(one->path, src->p->one->path);
88
+ if (!cmp)
89
+ return src;
90
+ if (cmp > 0) {
91
+ first = last;
92
+ goto append_it;
93
+ }
94
95
96
while (last > first) {
97
int next = (last + first) >> 1;
98
struct diff_rename_src *src = &(rename_src[next]);
@@ -94,6 +106,7 @@ static struct diff_rename_src *register_rename_src(struct diff_filepair *p)
106
first = next+1;
107
}
108
109
+append_it:
110
/* insert to make it at "first" */
111
ALLOC_GROW(rename_src, rename_src_nr + 1, rename_src_alloc);
99
112
rename_src_nr++;
0 commit comments