Re: [PATCH v2 01/10] Move computation of dir_rename_count from merge-ort to diffcore-rename
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Feb 24, 2021, 15:25 UTC
- Message-ID
- <bb0ef143-3050-6f3e-79ed-f06c1536f0a7@gmail.com>
- In-Reply-To
- <fec4f1d44c0694cf92c9b98f2b6519a15fb78188.1614123848.git.gitgitgadget@gmail.com>
On 2/23/2021 6:43 PM, Elijah Newren via GitGitGadget wrote:
Show 7 quoted lines
> ... While the > diffstat looks large, viewing this commit with --color-moved makes it > clear that only about 20 lines changed. With this patch, the > computation of dir_rename_count is still only done after inexact rename > detection, but subsequent commits will add a preliminary computation of > dir_rename_count after exact rename detection, followed by some updates > after inexact rename detection.
The --color-moved recommendation is a good one. Everything seems to be pretty standard, except this function:
Show 19 quoted lines
> +static void compute_dir_rename_counts(struct strmap *dir_rename_count,
> + struct strset *dirs_removed)
> +{
> + int i;
> +
> + /* Set up dir_rename_count */
> + for (i = 0; i < rename_dst_nr; ++i) {
> + /*
> + * Make dir_rename_count contain a map of a map:
> + * old_directory -> {new_directory -> count}
> + * In other words, for every pair look at the directories for
> + * the old filename and the new filename and count how many
> + * times that pairing occurs.
> + */
> + update_dir_rename_counts(dir_rename_count, dirs_removed,
> + rename_dst[i].p->one->path,
> + rename_dst[i].p->two->path);
> + }
> +}is very similar to this:
Show 26 quoted lines
> -static void compute_rename_counts(struct diff_queue_struct *pairs,
> - struct strmap *dir_rename_count,
> - struct strset *dirs_removed)
> -{
> - int i;
> -
> - for (i = 0; i < pairs->nr; ++i) {
> - struct diff_filepair *pair = pairs->queue[i];
> -
> - /* File not part of directory rename if it wasn't renamed */
> - if (pair->status != 'R')
> - continue;
> -
> - /*
> - * Make dir_rename_count contain a map of a map:
> - * old_directory -> {new_directory -> count}
> - * In other words, for every pair look at the directories for
> - * the old filename and the new filename and count how many
> - * times that pairing occurs.
> - */
> - update_dir_rename_counts(dir_rename_count, dirs_removed,
> - pair->one->path,
> - pair->two->path);
> - }
> -}
> -but we dropped that "File not part of directory rename" check.
It seems that is no longer possible to use with the new data structure, but I wonder if this will cause a slowdown in the directory renames when merging? Or, has the data already been filtered before calling compute_dir_rename_counts()?
Thanks, -Stolee