1410
return merge_file_1(o, &one, &a, &b, path, branch1, branch2, mfi);
1411
}
1412
1413
-static int conflict_rename_via_dir(struct merge_options *o,
1414
- struct diff_filepair *pair,
1415
- const char *rename_branch,
1416
- const char *other_branch)
1413
+static int handle_rename_via_dir(struct merge_options *o,
1414
+ struct diff_filepair *pair,
1415
+ const char *rename_branch,
1416
+ const char *other_branch)
1417
{
1418
/*
1419
* Handle file adds that need to be renamed due to directory rename
1515
return ret;
1516
}
1517
1518
-static int conflict_rename_delete(struct merge_options *o,
1519
- struct diff_filepair *pair,
1520
- const char *rename_branch,
1521
- const char *delete_branch)
1518
+static int handle_rename_delete(struct merge_options *o,
1519
+ struct diff_filepair *pair,
1520
+ const char *rename_branch,
1521
+ const char *delete_branch)
1522
{
1523
const struct diff_filespec *orig = pair->one;
1524
const struct diff_filespec *dest = pair->two;
1620
return ret;
1621
}
1622
1623
-static int conflict_rename_rename_1to2(struct merge_options *o,
1624
- struct rename_conflict_info *ci)
1623
+static int handle_rename_rename_1to2(struct merge_options *o,
1624
+ struct rename_conflict_info *ci)
1625
{
1626
/* One file was renamed in both branches, but to different names. */
1627
struct diff_filespec *one = ci->pair1->one;
1682
return 0;
1683
}
1684
1685
-static int conflict_rename_rename_2to1(struct merge_options *o,
1686
- struct rename_conflict_info *ci)
1685
+static int handle_rename_rename_2to1(struct merge_options *o,
1686
+ struct rename_conflict_info *ci)
1687
{
1688
/* Two files, a & b, were renamed to the same thing, c. */
1689
struct diff_filespec *a = ci->pair1->one;
2425
* "NOTE" in update_stages(), doing so will modify the current
2426
* in-memory index which will break calls to would_lose_untracked()
2427
* that we need to make. Instead, we need to just make sure that
2428
- * the various conflict_rename_*() functions update the index
2428
+ * the various handle_rename_*() functions update the index
2429
* explicitly rather than relying on unpack_trees() to have done it.
2430
*/
2431
get_tree_entry(&tree->object.oid,
2829
free(pairs);
2830
}
2831
2832
-static int handle_renames(struct merge_options *o,
2833
- struct tree *common,
2834
- struct tree *head,
2835
- struct tree *merge,
2836
- struct string_list *entries,
2837
- struct rename_info *ri)
2832
+static int detect_and_process_renames(struct merge_options *o,
2833
+ struct tree *common,
2834
+ struct tree *head,
2835
+ struct tree *merge,
2836
+ struct string_list *entries,
2837
+ struct rename_info *ri)
2838
{
2839
struct diff_queue_struct *head_pairs, *merge_pairs;
2840
struct hashmap *dir_re_head, *dir_re_merge;
3105
return !is_dirty && mfi.clean;
3106
}
3107
3108
-static int conflict_rename_normal(struct merge_options *o,
3109
- const char *path,
3110
- struct object_id *o_oid, unsigned int o_mode,
3111
- struct object_id *a_oid, unsigned int a_mode,
3112
- struct object_id *b_oid, unsigned int b_mode,
3113
- struct rename_conflict_info *ci)
3108
+static int handle_rename_normal(struct merge_options *o,
3109
+ const char *path,
3110
+ struct object_id *o_oid, unsigned int o_mode,
3111
+ struct object_id *a_oid, unsigned int a_mode,
3112
+ struct object_id *b_oid, unsigned int b_mode,
3113
+ struct rename_conflict_info *ci)
3114
{
3115
/* Merge the content and write it out */
3116
return merge_content(o, path, was_dirty(o, path),
3137
switch (conflict_info->rename_type) {
3138
case RENAME_NORMAL:
3139
case RENAME_ONE_FILE_TO_ONE:
3140
- clean_merge = conflict_rename_normal(o,
3141
- path,
3142
- o_oid, o_mode,
3143
- a_oid, a_mode,
3144
- b_oid, b_mode,
3145
- conflict_info);
3140
+ clean_merge = handle_rename_normal(o,
3141
+ path,
3142
+ o_oid, o_mode,
3143
+ a_oid, a_mode,
3144
+ b_oid, b_mode,
3145
+ conflict_info);
3146
break;
3147
case RENAME_VIA_DIR:
3148
clean_merge = 1;
3149
- if (conflict_rename_via_dir(o,
3150
- conflict_info->pair1,
3151
- conflict_info->branch1,
3152
- conflict_info->branch2))
3149
+ if (handle_rename_via_dir(o,
3150
+ conflict_info->pair1,
3151
+ conflict_info->branch1,
3152
+ conflict_info->branch2))
3153
clean_merge = -1;
3154
break;
3155
case RENAME_DELETE:
3156
clean_merge = 0;
3157
- if (conflict_rename_delete(o,
3158
- conflict_info->pair1,
3159
- conflict_info->branch1,
3160
- conflict_info->branch2))
3157
+ if (handle_rename_delete(o,
3158
+ conflict_info->pair1,
3159
+ conflict_info->branch1,
3160
+ conflict_info->branch2))
3161
clean_merge = -1;
3162
break;
3163
case RENAME_ONE_FILE_TO_TWO:
3164
clean_merge = 0;
3165
- if (conflict_rename_rename_1to2(o, conflict_info))
3165
+ if (handle_rename_rename_1to2(o, conflict_info))
3166
clean_merge = -1;
3167
break;
3168
case RENAME_TWO_FILES_TO_ONE:
3169
clean_merge = 0;
3170
- if (conflict_rename_rename_2to1(o, conflict_info))
3170
+ if (handle_rename_rename_2to1(o, conflict_info))
3171
clean_merge = -1;
3172
break;
3173
default:
3307
get_files_dirs(o, merge);
3308
3309
entries = get_unmerged();
3310
- clean = handle_renames(o, common, head, merge, entries,
3311
- &re_info);
3310
+ clean = detect_and_process_renames(o, common, head, merge,
3311
+ entries, &re_info);
3312
record_df_conflict_files(o, entries);
3313
if (clean < 0)
3314
goto cleanup;