File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,18 @@ static struct diff_rename_src *register_rename_src(struct diff_filepair *p)
8484
8585 first = 0 ;
8686 last = rename_src_nr ;
87+
88+ if (last > 0 ) {
89+ struct diff_rename_src * src = & (rename_src [last - 1 ]);
90+ int cmp = strcmp (one -> path , src -> p -> one -> path );
91+ if (!cmp )
92+ return src ;
93+ if (cmp > 0 ) {
94+ first = last ;
95+ goto append_it ;
96+ }
97+ }
98+
8799 while (last > first ) {
88100 int next = first + ((last - first ) >> 1 );
89101 struct diff_rename_src * src = & (rename_src [next ]);
@@ -97,6 +109,7 @@ static struct diff_rename_src *register_rename_src(struct diff_filepair *p)
97109 first = next + 1 ;
98110 }
99111
112+ append_it :
100113 /* insert to make it at "first" */
101114 ALLOC_GROW (rename_src , rename_src_nr + 1 , rename_src_alloc );
102115 rename_src_nr ++ ;
You can’t perform that action at this time.
0 commit comments