diff options
author | Elijah Newren <newren@gmail.com> | 2019-04-05 08:00:17 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-04-08 16:02:07 +0900 |
commit | 967d6be725b10ac1ea39d50770b358166523fe22 (patch) | |
tree | 873e333c02d60f57eb81ec5fbc32d81e1fce7108 | |
parent | merge-recursive: use 'ci' for rename_conflict_info variable name (diff) | |
download | tgif-967d6be725b10ac1ea39d50770b358166523fe22.tar.xz |
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>
-rw-r--r-- | merge-recursive.c | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/merge-recursive.c b/merge-recursive.c index ea5646debd..c4a2ef2a37 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -196,18 +196,6 @@ enum rename_type { RENAME_TWO_FILES_TO_ONE }; -struct rename_conflict_info { - enum rename_type rename_type; - struct diff_filepair *pair1; - struct diff_filepair *pair2; - const char *branch1; - const char *branch2; - struct stage_data *dst_entry1; - struct stage_data *dst_entry2; - struct diff_filespec ren1_other; - struct diff_filespec ren2_other; -}; - /* * Since we want to write the index eventually, we cannot reuse the index * for these (temporary) data. @@ -221,6 +209,45 @@ struct stage_data { unsigned processed:1; }; +struct rename { + struct diff_filepair *pair; + /* + * Purpose of src_entry and dst_entry: + * + * If 'before' is renamed to 'after' then src_entry will contain + * the versions of 'before' from the merge_base, HEAD, and MERGE in + * stages 1, 2, and 3; dst_entry will contain the respective + * versions of 'after' in corresponding locations. Thus, we have a + * total of six modes and oids, though some will be null. (Stage 0 + * is ignored; we're interested in handling conflicts.) + * + * Since we don't turn on break-rewrites by default, neither + * src_entry nor dst_entry can have all three of their stages have + * non-null oids, meaning at most four of the six will be non-null. + * Also, since this is a rename, both src_entry and dst_entry will + * have at least one non-null oid, meaning at least two will be + * non-null. Of the six oids, a typical rename will have three be + * non-null. Only two implies a rename/delete, and four implies a + * rename/add. + */ + struct stage_data *src_entry; + struct stage_data *dst_entry; + unsigned add_turned_into_rename:1; + unsigned processed:1; +}; + +struct rename_conflict_info { + enum rename_type rename_type; + struct diff_filepair *pair1; + struct diff_filepair *pair2; + const char *branch1; + const char *branch2; + struct stage_data *dst_entry1; + struct stage_data *dst_entry2; + struct diff_filespec ren1_other; + struct diff_filespec ren2_other; +}; + static inline void setup_rename_conflict_info(enum rename_type rename_type, struct diff_filepair *pair1, struct diff_filepair *pair2, @@ -645,33 +672,6 @@ static void record_df_conflict_files(struct merge_options *opt, string_list_clear(&df_sorted_entries, 0); } -struct rename { - struct diff_filepair *pair; - /* - * Purpose of src_entry and dst_entry: - * - * If 'before' is renamed to 'after' then src_entry will contain - * the versions of 'before' from the merge_base, HEAD, and MERGE in - * stages 1, 2, and 3; dst_entry will contain the respective - * versions of 'after' in corresponding locations. Thus, we have a - * total of six modes and oids, though some will be null. (Stage 0 - * is ignored; we're interested in handling conflicts.) - * - * Since we don't turn on break-rewrites by default, neither - * src_entry nor dst_entry can have all three of their stages have - * non-null oids, meaning at most four of the six will be non-null. - * Also, since this is a rename, both src_entry and dst_entry will - * have at least one non-null oid, meaning at least two will be - * non-null. Of the six oids, a typical rename will have three be - * non-null. Only two implies a rename/delete, and four implies a - * rename/add. - */ - struct stage_data *src_entry; - struct stage_data *dst_entry; - unsigned add_turned_into_rename:1; - unsigned processed:1; -}; - static int update_stages(struct merge_options *opt, const char *path, const struct diff_filespec *o, const struct diff_filespec *a, |