Re: [PATCH 2/3] merge-ort: shuffle the computation and cleanup of potential collisions
On Mon, Jun 27, 2022 at 2:04 PM Calvin Wan <calvinwan@google.com> wrote:
Show 32 quoted lines
>
> Jonathan Tan <jonathantanmy@google.com> writes:
> > "Elijah Newren via GitGitGadget" <gitgitgadget@gmail.com> writes:
> > > @@ -2314,7 +2335,8 @@ static char *check_for_directory_rename(struct merge_options *opt,
> > > }
> > >
> > > new_path = handle_path_level_conflicts(opt, path, side_index,
> > > - rename_info, collisions);
> > > + rename_info,
> > > + &collisions[side_index]);
> >
> > Is this a fix of a latent bug? handle_path_level_conflicts() is not
> > changed in this patch.
> >
>
> I don't think so. IIUC this is what's happening given the callstack:
>
> detect_and_process_renames()
> - Now defines `struct strmap collisions[3];` and computes all
> three collisions here
> - Passes collisions into collect_renames()
> collect_renames()
> - Originally defined as `struct strmap collisions;` and computed
> collisions in here
> - Now takes collisions as an argument
> - Passes collisions into check_for_directory_rename()
> check_for_directory_rename()
> - Collisions isn't used in this function at all except to pass into
> handle_path_level_conflicts
> handle_path_level_conflicts()
> - Expecting pointer to singular collisions, not an array so side_index
> is now required
Sweet, thanks for answering for me. This is exactly right.