1 #ifndef INCLUDE_cl_merge_helpers_h__
2 #define INCLUDE_cl_merge_helpers_h__
5 #include "git2/merge.h"
7 #define AUTOMERGEABLE_MERGED_FILE \
8 "this file is changed in master\n" \
9 "this file is automergeable\n" \
10 "this file is automergeable\n" \
11 "this file is automergeable\n" \
12 "this file is automergeable\n" \
13 "this file is automergeable\n" \
14 "this file is automergeable\n" \
15 "this file is automergeable\n" \
16 "this file is changed in branch\n"
18 #define AUTOMERGEABLE_MERGED_FILE_CRLF \
19 "this file is changed in master\r\n" \
20 "this file is automergeable\r\n" \
21 "this file is automergeable\r\n" \
22 "this file is automergeable\r\n" \
23 "this file is automergeable\r\n" \
24 "this file is automergeable\r\n" \
25 "this file is automergeable\r\n" \
26 "this file is automergeable\r\n" \
27 "this file is changed in branch\r\n"
29 #define CONFLICTING_MERGE_FILE \
31 "this file is changed in master and branch\n" \
33 "this file is changed in branch and master\n" \
34 ">>>>>>> 7cb63eed597130ba4abb87b3e544b85021905520\n"
36 #define CONFLICTING_DIFF3_FILE \
38 "this file is changed in master and branch\n" \
40 "this file is a conflict\n" \
42 "this file is changed in branch and master\n" \
43 ">>>>>>> 7cb63eed597130ba4abb87b3e544b85021905520\n"
45 #define CONFLICTING_UNION_FILE \
46 "this file is changed in master and branch\n" \
47 "this file is changed in branch and master\n"
50 struct merge_index_entry
{
57 struct merge_name_entry
{
58 char ancestor_path
[128];
63 struct merge_index_with_status
{
64 struct merge_index_entry entry
;
68 struct merge_reuc_entry
{
70 unsigned int ancestor_mode
;
71 unsigned int our_mode
;
72 unsigned int their_mode
;
73 char ancestor_oid_str
[41];
75 char their_oid_str
[41];
78 struct merge_index_conflict_data
{
79 struct merge_index_with_status ancestor
;
80 struct merge_index_with_status ours
;
81 struct merge_index_with_status theirs
;
82 git_merge_diff_type_t change_type
;
85 int merge_trees_from_branches(
86 git_index
**index
, git_repository
*repo
,
87 const char *ours_name
, const char *theirs_name
,
88 git_merge_options
*opts
);
90 int merge_commits_from_branches(
91 git_index
**index
, git_repository
*repo
,
92 const char *ours_name
, const char *theirs_name
,
93 git_merge_options
*opts
);
95 int merge_branches(git_repository
*repo
,
96 const char *ours_branch
, const char *theirs_branch
,
97 git_merge_options
*merge_opts
, git_checkout_options
*checkout_opts
);
99 int merge_test_diff_list(git_merge_diff_list
*diff_list
, const struct merge_index_entry expected
[], size_t expected_len
);
101 int merge_test_merge_conflicts(git_vector
*conflicts
, const struct merge_index_conflict_data expected
[], size_t expected_len
);
103 int merge_test_index(git_index
*index
, const struct merge_index_entry expected
[], size_t expected_len
);
105 int merge_test_names(git_index
*index
, const struct merge_name_entry expected
[], size_t expected_len
);
107 int merge_test_reuc(git_index
*index
, const struct merge_reuc_entry expected
[], size_t expected_len
);
109 int merge_test_workdir(git_repository
*repo
, const struct merge_index_entry expected
[], size_t expected_len
);