merge-ort: small cleanups of check_for_directory_rename

No functional changes, just some preparatory cleanups. Suggested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Elijah Newren <newren@palantir.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Jul 5, 2022 at 01:33 UTC 51e41e4eaf2bd1d0344627d3326a3e20f90f4580
1 file changed +6 -6
merge-ort.c
+6 -6
@@ -2267,18 +2267,17 @@ static char *check_for_directory_rename(struct merge_options *opt,
2267 struct strmap *collisions,
2268 int *clean_merge)
2269 {
2270 - char *new_path = NULL;
2270 + char *new_path;
2271 struct strmap_entry *rename_info;
2272 - struct strmap_entry *otherinfo = NULL;
2272 + struct strmap_entry *otherinfo;
2273 const char *new_dir;
2274
2275 + /* Cases where we don't have a directory rename for this path */
2276 if (strmap_empty(dir_renames))
2276 - return new_path;
2277 + return NULL;
2278 rename_info = check_dir_renamed(path, dir_renames);
2279 if (!rename_info)
2279 - return new_path;
2280 - /* old_dir = rename_info->key; */
2281 - new_dir = rename_info->value;
2280 + return NULL;
2281
2282 /*
2283 * This next part is a little weird. We do not want to do an
@@ -2304,6 +2303,7 @@ static char *check_for_directory_rename(struct merge_options *opt,
2303 * As it turns out, this also prevents N-way transient rename
2304 * confusion; See testcases 9c and 9d of t6043.
2305 */
2306 + new_dir = rename_info->value; /* old_dir = rename_info->key; */
2307 otherinfo = strmap_get_entry(dir_rename_exclusions, new_dir);
2308 if (otherinfo) {
2309 path_msg(opt, rename_info->key, 1,