merge-recursive: move some struct declarations together

These structs are related and reference each other, so move them together to make it easier for folks to determine what they hold and what their purpose is. Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Apr 5, 2019 at 08:00 UTC 967d6be725b10ac1ea39d50770b358166523fe22
1 file changed +39 -39
merge-recursive.c
+39 -39
@@ -196,18 +196,6 @@ enum rename_type {
196 RENAME_TWO_FILES_TO_ONE
197 };
198
199 -struct rename_conflict_info {
200 - enum rename_type rename_type;
201 - struct diff_filepair *pair1;
202 - struct diff_filepair *pair2;
203 - const char *branch1;
204 - const char *branch2;
205 - struct stage_data *dst_entry1;
206 - struct stage_data *dst_entry2;
207 - struct diff_filespec ren1_other;
208 - struct diff_filespec ren2_other;
209 -};
210 -
199 /*
200 * Since we want to write the index eventually, we cannot reuse the index
201 * for these (temporary) data.
@@ -221,6 +209,45 @@ struct stage_data {
209 unsigned processed:1;
210 };
211
212 +struct rename {
213 + struct diff_filepair *pair;
214 + /*
215 + * Purpose of src_entry and dst_entry:
216 + *
217 + * If 'before' is renamed to 'after' then src_entry will contain
218 + * the versions of 'before' from the merge_base, HEAD, and MERGE in
219 + * stages 1, 2, and 3; dst_entry will contain the respective
220 + * versions of 'after' in corresponding locations. Thus, we have a
221 + * total of six modes and oids, though some will be null. (Stage 0
222 + * is ignored; we're interested in handling conflicts.)
223 + *
224 + * Since we don't turn on break-rewrites by default, neither
225 + * src_entry nor dst_entry can have all three of their stages have
226 + * non-null oids, meaning at most four of the six will be non-null.
227 + * Also, since this is a rename, both src_entry and dst_entry will
228 + * have at least one non-null oid, meaning at least two will be
229 + * non-null. Of the six oids, a typical rename will have three be
230 + * non-null. Only two implies a rename/delete, and four implies a
231 + * rename/add.
232 + */
233 + struct stage_data *src_entry;
234 + struct stage_data *dst_entry;
235 + unsigned add_turned_into_rename:1;
236 + unsigned processed:1;
237 +};
238 +
239 +struct rename_conflict_info {
240 + enum rename_type rename_type;
241 + struct diff_filepair *pair1;
242 + struct diff_filepair *pair2;
243 + const char *branch1;
244 + const char *branch2;
245 + struct stage_data *dst_entry1;
246 + struct stage_data *dst_entry2;
247 + struct diff_filespec ren1_other;
248 + struct diff_filespec ren2_other;
249 +};
250 +
251 static inline void setup_rename_conflict_info(enum rename_type rename_type,
252 struct diff_filepair *pair1,
253 struct diff_filepair *pair2,
@@ -645,33 +672,6 @@ static void record_df_conflict_files(struct merge_options *opt,
672 string_list_clear(&df_sorted_entries, 0);
673 }
674
648 -struct rename {
649 - struct diff_filepair *pair;
650 - /*
651 - * Purpose of src_entry and dst_entry:
652 - *
653 - * If 'before' is renamed to 'after' then src_entry will contain
654 - * the versions of 'before' from the merge_base, HEAD, and MERGE in
655 - * stages 1, 2, and 3; dst_entry will contain the respective
656 - * versions of 'after' in corresponding locations. Thus, we have a
657 - * total of six modes and oids, though some will be null. (Stage 0
658 - * is ignored; we're interested in handling conflicts.)
659 - *
660 - * Since we don't turn on break-rewrites by default, neither
661 - * src_entry nor dst_entry can have all three of their stages have
662 - * non-null oids, meaning at most four of the six will be non-null.
663 - * Also, since this is a rename, both src_entry and dst_entry will
664 - * have at least one non-null oid, meaning at least two will be
665 - * non-null. Of the six oids, a typical rename will have three be
666 - * non-null. Only two implies a rename/delete, and four implies a
667 - * rename/add.
668 - */
669 - struct stage_data *src_entry;
670 - struct stage_data *dst_entry;
671 - unsigned add_turned_into_rename:1;
672 - unsigned processed:1;
673 -};
674 -
675 static int update_stages(struct merge_options *opt, const char *path,
676 const struct diff_filespec *o,
677 const struct diff_filespec *a,