Per entry merge function */
| 4067 | |
| 4068 | /* Per entry merge function */ |
| 4069 | static int process_entry(struct merge_options *opt, |
| 4070 | const char *path, |
| 4071 | struct conflict_info *ci, |
| 4072 | struct directory_versions *dir_metadata) |
| 4073 | { |
| 4074 | int df_file_index = 0; |
| 4075 | |
| 4076 | VERIFY_CI(ci); |
| 4077 | assert(ci->filemask >= 0 && ci->filemask <= 7); |
| 4078 | /* ci->match_mask == 7 was handled in collect_merge_info_callback() */ |
| 4079 | assert(ci->match_mask == 0 || ci->match_mask == 3 || |
| 4080 | ci->match_mask == 5 || ci->match_mask == 6); |
| 4081 | |
| 4082 | if (ci->dirmask) { |
| 4083 | record_entry_for_tree(dir_metadata, path, &ci->merged); |
| 4084 | if (ci->filemask == 0) |
| 4085 | /* nothing else to handle */ |
| 4086 | return 0; |
| 4087 | assert(ci->df_conflict); |
| 4088 | } |
| 4089 | |
| 4090 | if (ci->df_conflict && ci->merged.result.mode == 0) { |
| 4091 | int i; |
| 4092 | |
| 4093 | /* |
| 4094 | * directory no longer in the way, but we do have a file we |
| 4095 | * need to place here so we need to clean away the "directory |
| 4096 | * merges to nothing" result. |
| 4097 | */ |
| 4098 | ci->df_conflict = 0; |
| 4099 | assert(ci->filemask != 0); |
| 4100 | ci->merged.clean = 0; |
| 4101 | ci->merged.is_null = 0; |
| 4102 | /* and we want to zero out any directory-related entries */ |
| 4103 | ci->match_mask = (ci->match_mask & ~ci->dirmask); |
| 4104 | ci->dirmask = 0; |
| 4105 | for (i = MERGE_BASE; i <= MERGE_SIDE2; i++) { |
| 4106 | if (ci->filemask & (1 << i)) |
| 4107 | continue; |
| 4108 | ci->stages[i].mode = 0; |
| 4109 | oidcpy(&ci->stages[i].oid, null_oid(opt->repo->hash_algo)); |
| 4110 | } |
| 4111 | } else if (ci->df_conflict && ci->merged.result.mode != 0) { |
| 4112 | /* |
| 4113 | * This started out as a D/F conflict, and the entries in |
| 4114 | * the competing directory were not removed by the merge as |
| 4115 | * evidenced by write_completed_directory() writing a value |
| 4116 | * to ci->merged.result.mode. |
| 4117 | */ |
| 4118 | struct conflict_info *new_ci; |
| 4119 | const char *branch; |
| 4120 | const char *old_path = path; |
| 4121 | int i; |
| 4122 | |
| 4123 | assert(ci->merged.result.mode == S_IFDIR); |
| 4124 | |
| 4125 | /* |
| 4126 | * If filemask is 1, we can just ignore the file as having |
no test coverage detected