@@ -43,47 +43,50 @@ struct merge_options {
43
43
struct repository * repo ;
44
44
};
45
45
46
+ void init_merge_options (struct merge_options * opt , struct repository * repo );
47
+
48
+ /* parse the option in s and update the relevant field of opt */
49
+ int parse_merge_opt (struct merge_options * opt , const char * s );
50
+
46
51
/*
47
- * For dir_rename_entry, directory names are stored as a full path from the
48
- * toplevel of the repository and do not include a trailing '/'. Also:
49
- *
50
- * dir: original name of directory being renamed
51
- * non_unique_new_dir: if true, could not determine new_dir
52
- * new_dir: final name of directory being renamed
53
- * possible_new_dirs: temporary used to help determine new_dir; see comments
54
- * in get_directory_renames() for details
52
+ * RETURN VALUES: All the merge_* functions below return a value as follows:
53
+ * > 0 Merge was clean
54
+ * = 0 Merge had conflicts
55
+ * < 0 Merge hit an unexpected and unrecoverable problem (e.g. disk
56
+ * full) and aborted merge part-way through.
55
57
*/
56
- struct dir_rename_entry {
57
- struct hashmap_entry ent ; /* must be the first member! */
58
- char * dir ;
59
- unsigned non_unique_new_dir :1 ;
60
- struct strbuf new_dir ;
61
- struct string_list possible_new_dirs ;
62
- };
63
-
64
- struct collision_entry {
65
- struct hashmap_entry ent ; /* must be the first member! */
66
- char * target_file ;
67
- struct string_list source_files ;
68
- unsigned reported_already :1 ;
69
- };
70
58
71
- static inline int merge_detect_rename (struct merge_options * opt )
72
- {
73
- return opt -> merge_detect_rename >= 0 ? opt -> merge_detect_rename :
74
- opt -> diff_detect_rename >= 0 ? opt -> diff_detect_rename : 1 ;
75
- }
59
+ /*
60
+ * rename-detecting three-way merge, no recursion.
61
+ *
62
+ * Outputs:
63
+ * - See RETURN VALUES above
64
+ * - No commit is created
65
+ * - opt->repo->index has the new index
66
+ * - $GIT_INDEX_FILE is not updated
67
+ * - The working tree is updated with results of the merge
68
+ */
69
+ int merge_trees (struct merge_options * opt ,
70
+ struct tree * head ,
71
+ struct tree * merge ,
72
+ struct tree * merge_base );
76
73
77
74
/*
78
75
* merge_recursive is like merge_trees() but with recursive ancestor
79
- * consolidation, and when successful, it creates an actual commit
80
- * and writes its address to *result.
76
+ * consolidation and, if the commit is clean, creation of a commit.
81
77
*
82
78
* NOTE: empirically, about a decade ago it was determined that with more
83
79
* than two merge bases, optimal behavior was found when the
84
80
* merge_bases were passed in the order of oldest commit to newest
85
81
* commit. Also, merge_bases will be consumed (emptied) so make a
86
82
* copy if you need it.
83
+ *
84
+ * Outputs:
85
+ * - See RETURN VALUES above
86
+ * - If merge is clean, a commit is created and its address written to *result
87
+ * - opt->repo->index has the new index
88
+ * - $GIT_INDEX_FILE is not updated
89
+ * - The working tree is updated with results of the merge
87
90
*/
88
91
int merge_recursive (struct merge_options * opt ,
89
92
struct commit * h1 ,
@@ -92,17 +95,16 @@ int merge_recursive(struct merge_options *opt,
92
95
struct commit * * result );
93
96
94
97
/*
95
- * rename-detecting three-way merge, no recursion; result of merge is written
96
- * to opt->repo->index.
97
- */
98
- int merge_trees (struct merge_options * opt ,
99
- struct tree * head ,
100
- struct tree * merge ,
101
- struct tree * merge_base );
102
-
103
- /*
104
- * "git-merge-recursive" can be fed trees; wrap them into
105
- * virtual commits and call merge_recursive() proper.
98
+ * merge_recursive_generic can operate on trees instead of commits, by
99
+ * wrapping the trees into virtual commits, and calling merge_recursive().
100
+ * It also writes out the in-memory index to disk if the merge is successful.
101
+ *
102
+ * Outputs:
103
+ * - See RETURN VALUES above
104
+ * - If merge is clean, a commit is created and its address written to *result
105
+ * - opt->repo->index has the new index
106
+ * - $GIT_INDEX_FILE is updated
107
+ * - The working tree is updated with results of the merge
106
108
*/
107
109
int merge_recursive_generic (struct merge_options * opt ,
108
110
const struct object_id * head ,
@@ -111,9 +113,4 @@ int merge_recursive_generic(struct merge_options *opt,
111
113
const struct object_id * * merge_bases ,
112
114
struct commit * * result );
113
115
114
- void init_merge_options (struct merge_options * opt ,
115
- struct repository * repo );
116
-
117
- int parse_merge_opt (struct merge_options * opt , const char * s );
118
-
119
116
#endif
0 commit comments