Skip to content

Commit 42a5b15

Browse files
newrengitster
authored andcommitted
merge-ort: drop unnecessary temporary in check_for_directory_rename()
check_for_directory_rename() had a weirdly coded check for whether a strmap contained a certain key. Replace the temporary variable and call to strmap_get_entry() with the more natural strmap_contains() call. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cbbeeab commit 42a5b15

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

merge-ort.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2580,7 +2580,6 @@ static char *check_for_directory_rename(struct merge_options *opt,
25802580
{
25812581
char *new_path;
25822582
struct strmap_entry *rename_info;
2583-
struct strmap_entry *otherinfo;
25842583
const char *new_dir;
25852584
int other_side = 3 - side_index;
25862585

@@ -2615,14 +2614,13 @@ static char *check_for_directory_rename(struct merge_options *opt,
26152614
* to not let Side1 do the rename to dumbdir, since we know that is
26162615
* the source of one of our directory renames.
26172616
*
2618-
* That's why otherinfo and dir_rename_exclusions is here.
2617+
* That's why dir_rename_exclusions is here.
26192618
*
26202619
* As it turns out, this also prevents N-way transient rename
26212620
* confusion; See testcases 9c and 9d of t6423.
26222621
*/
26232622
new_dir = rename_info->value; /* old_dir = rename_info->key; */
2624-
otherinfo = strmap_get_entry(dir_rename_exclusions, new_dir);
2625-
if (otherinfo) {
2623+
if (strmap_contains(dir_rename_exclusions, new_dir)) {
26262624
path_msg(opt, INFO_DIR_RENAME_SKIPPED_DUE_TO_RERENAME, 1,
26272625
rename_info->key, path, new_dir, NULL,
26282626
_("WARNING: Avoiding applying %s -> %s rename "

0 commit comments

Comments
 (0)