Re: [PATCH 21/30] merge-recursive: Add get_directory_renames()
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 14, 2017, 05:30 UTC
- Message-ID
- <xmqqmv3p4ebo.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <20171110190550.27059-22-newren@gmail.com>
Elijah Newren <newren@gmail.com> writes:
> + entry = dir_rename_find_entry(dir_renames, old_dir);
> + if (!entry) {
> + entry = xcalloc(1, sizeof(struct dir_rename_entry));
> + hashmap_entry_init(entry, strhash(old_dir));Please make these two lines into its own dir_rename_entry_init() helper. Because the structure is defined as
+struct dir_rename_entry { + struct hashmap_entry ent; /* must be the first member! */ + char *dir; + unsigned non_unique_new_dir:1; + char *new_dir; + struct string_list possible_new_dirs; +}; +
in the previous patch, we'd want to see its string_list member to be initialised explicitly (we do not want to depend on "filling with NUL happens to make it a NODUP kind of string_list, which suits our purpose"). The definition of _init() function may belong to the previous step.