371
struct strintmap idx_map;
372
struct strmap dir_rename_guess;
373
struct strmap *dir_rename_count;
374
- struct strset *relevant_source_dirs;
374
+ struct strintmap *relevant_source_dirs;
375
unsigned setup;
376
};
377
429
}
430
431
static void update_dir_rename_counts(struct dir_rename_info *info,
432
- struct strset *dirs_removed,
432
+ struct strintmap *dirs_removed,
433
const char *oldname,
434
const char *newname)
435
{
464
/* Get old_dir, skip if its directory isn't relevant. */
465
dirname_munge(old_dir);
466
if (info->relevant_source_dirs &&
467
- !strset_contains(info->relevant_source_dirs, old_dir))
467
+ !strintmap_contains(info->relevant_source_dirs, old_dir))
468
break;
469
470
/* Get new_dir */
509
}
510
}
511
512
- if (strset_contains(dirs_removed, old_dir))
512
+ if (strintmap_contains(dirs_removed, old_dir))
513
increment_count(info, old_dir, new_dir);
514
else
515
break;
527
}
528
529
static void initialize_dir_rename_info(struct dir_rename_info *info,
530
- struct strset *relevant_sources,
531
- struct strset *dirs_removed,
530
+ struct strintmap *relevant_sources,
531
+ struct strintmap *dirs_removed,
532
struct strmap *dir_rename_count)
533
{
534
struct hashmap_iter iter;
555
info->relevant_source_dirs = dirs_removed; /* might be NULL */
556
} else {
557
info->relevant_source_dirs = xmalloc(sizeof(struct strintmap));
558
- strset_init(info->relevant_source_dirs);
559
- strset_for_each_entry(relevant_sources, &iter, entry) {
558
+ strintmap_init(info->relevant_source_dirs, 0 /* unused */);
559
+ strintmap_for_each_entry(relevant_sources, &iter, entry) {
560
char *dirname = get_dirname(entry->key);
561
if (!dirs_removed ||
562
- strset_contains(dirs_removed, dirname))
563
- strset_add(info->relevant_source_dirs, dirname);
562
+ strintmap_contains(dirs_removed, dirname))
563
+ strintmap_set(info->relevant_source_dirs,
564
+ dirname, 0 /* value irrelevant */);
565
free(dirname);
566
}
567
}
625
}
626
627
static void cleanup_dir_rename_info(struct dir_rename_info *info,
627
- struct strset *dirs_removed,
628
+ struct strintmap *dirs_removed,
629
int keep_dir_rename_count)
630
{
631
struct hashmap_iter iter;
645
/* relevant_source_dirs */
646
if (info->relevant_source_dirs &&
647
info->relevant_source_dirs != dirs_removed) {
647
- strset_clear(info->relevant_source_dirs);
648
+ strintmap_clear(info->relevant_source_dirs);
649
FREE_AND_NULL(info->relevant_source_dirs);
650
}
651
667
const char *source_dir = entry->key;
668
struct strintmap *counts = entry->value;
669
669
- if (!strset_contains(dirs_removed, source_dir)) {
670
+ if (!strintmap_contains(dirs_removed, source_dir)) {
671
string_list_append(&to_remove, source_dir);
672
strintmap_clear(counts);
673
continue;
771
static int find_basename_matches(struct diff_options *options,
772
int minimum_score,
773
struct dir_rename_info *info,
773
- struct strset *relevant_sources,
774
- struct strset *dirs_removed)
774
+ struct strintmap *relevant_sources,
775
+ struct strintmap *dirs_removed)
776
{
777
/*
778
* When I checked in early 2020, over 76% of file renames in linux
864
865
/* Skip irrelevant sources */
866
if (relevant_sources &&
866
- !strset_contains(relevant_sources, filename))
867
+ !strintmap_contains(relevant_sources, filename))
868
continue;
869
870
/*
995
int minimum_score,
996
int copies,
997
struct dir_rename_info *info,
997
- struct strset *dirs_removed)
998
+ struct strintmap *dirs_removed)
999
{
1000
int count = 0, i;
1001
1020
}
1021
1022
static void remove_unneeded_paths_from_src(int detecting_copies,
1022
- struct strset *interesting)
1023
+ struct strintmap *interesting)
1024
{
1025
int i, new_num_src;
1026
1062
continue;
1063
1064
/* If we don't care about the source path, skip it */
1064
- if (interesting && !strset_contains(interesting, one->path))
1065
+ if (interesting && !strintmap_contains(interesting, one->path))
1066
continue;
1067
1068
if (new_num_src < i)
1075
}
1076
1077
static void handle_early_known_dir_renames(struct dir_rename_info *info,
1077
- struct strset *relevant_sources,
1078
- struct strset *dirs_removed)
1078
+ struct strintmap *relevant_sources,
1079
+ struct strintmap *dirs_removed)
1080
{
1081
/*
1082
* Not yet implemented; directory renames are determined via an
1093
}
1094
1095
void diffcore_rename_extended(struct diff_options *options,
1095
- struct strset *relevant_sources,
1096
- struct strset *dirs_removed,
1096
+ struct strintmap *relevant_sources,
1097
+ struct strintmap *dirs_removed,
1098
struct strmap *dir_rename_count)
1099
{
1100
int detect_rename = options->detect_rename;