@@ -54,6 +54,24 @@ static unsigned int path_hash(const char *path)
return ignore_case ? strihash(path) : strhash(path);
}
+/*
+ * For dir_rename_entry, directory names are stored as a full path from the
+ * toplevel of the repository and do not include a trailing '/'. Also:
+ *
+ * dir: original name of directory being renamed
+ * non_unique_new_dir: if true, could not determine new_dir
+ * new_dir: final name of directory being renamed
+ * possible_new_dirs: temporary used to help determine new_dir; see comments
+ * in get_directory_renames() for details
+ */
+struct dir_rename_entry {
+ struct hashmap_entry ent; /* must be the first member! */
+ char *dir;
+ unsigned non_unique_new_dir:1;
+ struct strbuf new_dir;
+ struct string_list possible_new_dirs;
+};
+
static struct dir_rename_entry *dir_rename_find_entry(struct hashmap *hashmap,
char *dir)
{
@@ -92,6 +110,13 @@ static void dir_rename_entry_init(struct dir_rename_entry *entry,
string_list_init(&entry->possible_new_dirs, 0);
}
+struct collision_entry {
+ struct hashmap_entry ent; /* must be the first member! */
+ char *target_file;
+ struct string_list source_files;
+ unsigned reported_already:1;
+};
+
static struct collision_entry *collision_find_entry(struct hashmap *hashmap,
char *target_file)
{
@@ -358,6 +383,12 @@ static int add_cacheinfo(struct merge_options *opt,
return ret;
}
+static inline int merge_detect_rename(struct merge_options *opt)
+{
+ return opt->merge_detect_rename >= 0 ? opt->merge_detect_rename :
+ opt->diff_detect_rename >= 0 ? opt->diff_detect_rename : 1;
+}
+
static void init_tree_desc_from_tree(struct tree_desc *desc, struct tree *tree)
{
parse_tree(tree);
@@ -39,36 +39,17 @@ struct merge_options {
struct repository *repo;
};
-/*
- * For dir_rename_entry, directory names are stored as a full path from the
- * toplevel of the repository and do not include a trailing '/'. Also:
- *
- * dir: original name of directory being renamed
- * non_unique_new_dir: if true, could not determine new_dir
- * new_dir: final name of directory being renamed
- * possible_new_dirs: temporary used to help determine new_dir; see comments
- * in get_directory_renames() for details
- */
-struct dir_rename_entry {
- struct hashmap_entry ent; /* must be the first member! */
- char *dir;
- unsigned non_unique_new_dir:1;
- struct strbuf new_dir;
- struct string_list possible_new_dirs;
-};
+void init_merge_options(struct merge_options *opt, struct repository *repo);
-struct collision_entry {
- struct hashmap_entry ent; /* must be the first member! */
- char *target_file;
- struct string_list source_files;
- unsigned reported_already:1;
-};
+/* parse the option in s and update the relevant field of opt */
+int parse_merge_opt(struct merge_options *opt, const char *s);
-static inline int merge_detect_rename(struct merge_options *opt)
-{
- return opt->merge_detect_rename >= 0 ? opt->merge_detect_rename :
- opt->diff_detect_rename >= 0 ? opt->diff_detect_rename : 1;
-}
+/* rename-detecting three-way merge, no recursion */
+int merge_trees(struct merge_options *opt,
+ struct tree *head,
+ struct tree *merge,
+ struct tree *merge_base,
+ struct tree **result);
/* merge_trees() but with recursive ancestor consolidation */
int merge_recursive(struct merge_options *opt,
@@ -77,16 +58,9 @@ int merge_recursive(struct merge_options *opt,
struct commit_list *merge_bases,
struct commit **result);
-/* rename-detecting three-way merge, no recursion */
-int merge_trees(struct merge_options *opt,
- struct tree *head,
- struct tree *merge,
- struct tree *merge_base,
- struct tree **result);
-
/*
- * "git-merge-recursive" can be fed trees; wrap them into
- * virtual commits and call merge_recursive() proper.
+ * merge_recursive_generic can operate on trees instead of commits, by
+ * wrapping the trees into virtual commits, and calling merge_recursive().
*/
int merge_recursive_generic(struct merge_options *opt,
const struct object_id *head,
@@ -95,9 +69,4 @@ int merge_recursive_generic(struct merge_options *opt,
const struct object_id **merge_bases,
struct commit **result);
-void init_merge_options(struct merge_options *opt,
- struct repository *repo);
-
-int parse_merge_opt(struct merge_options *opt, const char *s);
-
#endif
No substantive code changes (view this with diff --color-moved), but a few small code cleanups: * Move structs and an inline function only used by merge-recursive.c into merge-recursive.c * Re-order function declarations to be more logical * Add or fix some explanatory comments Signed-off-by: Elijah Newren <newren@gmail.com> --- merge-recursive.c | 31 +++++++++++++++++++++++++++ merge-recursive.h | 53 ++++++++++------------------------------------- 2 files changed, 42 insertions(+), 42 deletions(-)