@ -690,7 +690,6 @@ static void path_msg(struct merge_options *opt,
strbuf_addch ( sb , ' \n ' ) ;
}
MAYBE_UNUSED
static struct diff_filespec * pool_alloc_filespec ( struct mem_pool * pool ,
const char * path )
{
@ -712,7 +711,6 @@ static struct diff_filespec *pool_alloc_filespec(struct mem_pool *pool,
return spec ;
}
MAYBE_UNUSED
static struct diff_filepair * pool_diff_queue ( struct mem_pool * pool ,
struct diff_queue_struct * queue ,
struct diff_filespec * one ,
@ -930,6 +928,7 @@ static void add_pair(struct merge_options *opt,
unsigned dir_rename_mask )
{
struct diff_filespec * one , * two ;
struct mem_pool * pool = opt - > priv - > pool ;
struct rename_info * renames = & opt - > priv - > renames ;
int names_idx = is_add ? side : 0 ;
@ -980,11 +979,11 @@ static void add_pair(struct merge_options *opt,
return ;
}
one = alloc_filespec ( pathname ) ;
two = alloc_filespec ( pathname ) ;
one = pool_ alloc_filespec( pool , pathname ) ;
two = pool_ alloc_filespec( pool , pathname ) ;
fill_filespec ( is_add ? two : one ,
& names [ names_idx ] . oid , 1 , names [ names_idx ] . mode ) ;
diff_queue ( & renames - > pairs [ side ] , one , two ) ;
pool_ diff_queue( pool , & renames - > pairs [ side ] , one , two ) ;
}
static void collect_rename_info ( struct merge_options * opt ,
@ -2893,6 +2892,7 @@ static void use_cached_pairs(struct merge_options *opt,
{
struct hashmap_iter iter ;
struct strmap_entry * entry ;
struct mem_pool * pool = opt - > priv - > pool ;
/*
* Add to side_pairs all entries from renames - > cached_pairs [ side_index ] .
@ -2906,9 +2906,9 @@ static void use_cached_pairs(struct merge_options *opt,
new_name = old_name ;
/* We don't care about oid/mode, only filenames and status */
one = alloc_filespec ( old_name ) ;
two = alloc_filespec ( new_name ) ;
diff_queue ( pairs , one , two ) ;
one = pool_ alloc_filespec( pool , old_name ) ;
two = pool_ alloc_filespec( pool , new_name ) ;
pool_ diff_queue( pool , pairs , one , two ) ;
pairs - > queue [ pairs - > nr - 1 ] - > status = entry - > value ? ' R ' : ' D ' ;
}
}
@ -3016,6 +3016,7 @@ static int detect_regular_renames(struct merge_options *opt,
diff_queued_diff = renames - > pairs [ side_index ] ;
trace2_region_enter ( " diff " , " diffcore_rename " , opt - > repo ) ;
diffcore_rename_extended ( & diff_opts ,
opt - > priv - > pool ,
& renames - > relevant_sources [ side_index ] ,
& renames - > dirs_removed [ side_index ] ,
& renames - > dir_rename_count [ side_index ] ,
@ -3066,7 +3067,7 @@ static int collect_renames(struct merge_options *opt,
if ( p - > status ! = ' A ' & & p - > status ! = ' R ' ) {
possibly_cache_new_pair ( renames , p , side_index , NULL ) ;
diff_free_filepair ( p ) ;
pool_ diff_free_filepair( opt - > priv - > pool , p ) ;
continue ;
}
@ -3079,7 +3080,7 @@ static int collect_renames(struct merge_options *opt,
possibly_cache_new_pair ( renames , p , side_index , new_path ) ;
if ( p - > status ! = ' R ' & & ! new_path ) {
diff_free_filepair ( p ) ;
pool_ diff_free_filepair( opt - > priv - > pool , p ) ;
continue ;
}
@ -3197,7 +3198,7 @@ cleanup:
side_pairs = & renames - > pairs [ s ] ;
for ( i = 0 ; i < side_pairs - > nr ; + + i ) {
struct diff_filepair * p = side_pairs - > queue [ i ] ;
diff_free_filepair ( p ) ;
pool_ diff_free_filepair( opt - > priv - > pool , p ) ;
}
}
@ -3210,7 +3211,8 @@ simple_cleanup:
if ( combined . nr ) {
int i ;
for ( i = 0 ; i < combined . nr ; i + + )
diff_free_filepair ( combined . queue [ i ] ) ;
pool_diff_free_filepair ( opt - > priv - > pool ,
combined . queue [ i ] ) ;
free ( combined . queue ) ;
}