Junio C Hamano <gitster@xxxxxxxxx> writes: > Elijah Newren <newren@xxxxxxxxx> writes: > >> +struct rename_info { >> + struct string_list *head_renames; >> + struct string_list *merge_renames; >> +}; > > This type is added in order to allow the caller and the helper to > communicate the findings in a single logical structure, instead of > having to pass them as separate parameters, etc. If we anticipate > that the information that needs to be passed will grow richer in > later steps (or a follow-up series), such encapsulation makes a lot Hmph, I actually am quite confused with the existing code. The caller (originally in merge_trees(), now in handle_renames()) calls get_renames() twice and have the list of renamed paths in these two string lists. get_renames() mostly works with the elements in the "entries" list and adds the "struct rename" to the string list that is to be returned. And the caller uses these two string lists get_renames() returns when calling process_renames(), but once process_renames() is done with them, these two string lists are never looked at by anybody. So do we really need to pass this structure around in the first place? I am wondering if we can do the cleanup_rename() on both of these lists after handle_renames() calls process_renames() before returning, which will eliminate the need for this structure and a separate cleanup_renames() helper that clears the structure and the two string lists in it.