Skip to content

Commit fed3fef

Browse files
boretrkPeter Pettersson
authored andcommitted
merge: allocate merge flags for internal use
Allocate flags in git_merge_flag_t and git_merge_file_flag_t for internal usage to prevent accidental double allocation.
1 parent caaa1fd commit fed3fef

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

include/git2/merge.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ typedef enum {
9191
* instead simply use the first base. This flag provides a similar
9292
* merge base to `git-merge-resolve`.
9393
*/
94-
GIT_MERGE_NO_RECURSIVE = (1 << 3)
94+
GIT_MERGE_NO_RECURSIVE = (1 << 3),
95+
96+
/* This flag is reserved for internal library use */
97+
GIT_MERGE__INTERNAL_FLAG = (1 << 30)
9598
} git_merge_flag_t;
9699

97100
/**
@@ -162,7 +165,10 @@ typedef enum {
162165
GIT_MERGE_FILE_DIFF_MINIMAL = (1 << 7),
163166

164167
/** Create zdiff3 ("zealous diff3")-style files */
165-
GIT_MERGE_FILE_STYLE_ZDIFF3 = (1 << 8)
168+
GIT_MERGE_FILE_STYLE_ZDIFF3 = (1 << 8),
169+
170+
/* This flag is reserved for internal library use */
171+
GIT_MERGE_FILE__INTERNAL_FLAG = (1 << 30)
166172
} git_merge_file_flag_t;
167173

168174
#define GIT_MERGE_CONFLICT_MARKER_SIZE 7

src/merge.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,12 @@
2727

2828

2929
/** Internal merge flags. */
30-
enum {
31-
/** The merge is for a virtual base in a recursive merge. */
32-
GIT_MERGE__VIRTUAL_BASE = (1 << 31)
33-
};
34-
35-
enum {
36-
/** Accept the conflict file, staging it as the merge result. */
37-
GIT_MERGE_FILE__CONFLICTED = (1 << 30)
38-
};
30+
31+
/** The merge is for a virtual base in a recursive merge. */
32+
#define GIT_MERGE__VIRTUAL_BASE (GIT_MERGE__INTERNAL_FLAG)
33+
34+
/** Accept the conflict file, staging it as the merge result. */
35+
#define GIT_MERGE_FILE__CONFLICTED (GIT_MERGE_FILE__INTERNAL_FLAG)
3936

4037

4138
/** Types of changes when files are merged from branch to branch. */

0 commit comments

Comments
 (0)