Skip to content

Commit 967d6be

Browse files
newrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 043622b commit 967d6be

File tree

1 file changed

+39
-39
lines changed

1 file changed

+39
-39
lines changed

merge-recursive.c

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -196,18 +196,6 @@ enum rename_type {
196196
RENAME_TWO_FILES_TO_ONE
197197
};
198198

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-
211199
/*
212200
* Since we want to write the index eventually, we cannot reuse the index
213201
* for these (temporary) data.
@@ -221,6 +209,45 @@ struct stage_data {
221209
unsigned processed:1;
222210
};
223211

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+
224251
static inline void setup_rename_conflict_info(enum rename_type rename_type,
225252
struct diff_filepair *pair1,
226253
struct diff_filepair *pair2,
@@ -645,33 +672,6 @@ static void record_df_conflict_files(struct merge_options *opt,
645672
string_list_clear(&df_sorted_entries, 0);
646673
}
647674

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-
675675
static int update_stages(struct merge_options *opt, const char *path,
676676
const struct diff_filespec *o,
677677
const struct diff_filespec *a,

0 commit comments

Comments
 (0)