diff --git a/include/git2/branch.h b/include/git2/branch.h index f4681dc09..69e7d1689 100644 --- a/include/git2/branch.h +++ b/include/git2/branch.h @@ -69,7 +69,7 @@ GIT_EXTERN(int) git_branch_create( GIT_EXTERN(int) git_branch_delete( git_repository *repo, const char *branch_name, - git_branch_type branch_type); + git_branch_t branch_type); /** * Fill a list with all the branches in the Repository diff --git a/include/git2/odb_backend.h b/include/git2/odb_backend.h index 9a0133f37..f4620f5f4 100644 --- a/include/git2/odb_backend.h +++ b/include/git2/odb_backend.h @@ -74,6 +74,13 @@ struct git_odb_backend { void (* free)(struct git_odb_backend *); }; +/** Streaming mode */ +enum { + GIT_STREAM_RDONLY = (1 << 1), + GIT_STREAM_WRONLY = (1 << 2), + GIT_STREAM_RW = (GIT_STREAM_RDONLY | GIT_STREAM_WRONLY), +}; + /** A stream to read/write from a backend */ struct git_odb_stream { struct git_odb_backend *backend; @@ -85,13 +92,6 @@ struct git_odb_stream { void (*free)(struct git_odb_stream *stream); }; -/** Streaming mode */ -typedef enum { - GIT_STREAM_RDONLY = (1 << 1), - GIT_STREAM_WRONLY = (1 << 2), - GIT_STREAM_RW = (GIT_STREAM_RDONLY | GIT_STREAM_WRONLY), -} git_odb_streammode; - GIT_EXTERN(int) git_odb_backend_pack(git_odb_backend **backend_out, const char *objects_dir); GIT_EXTERN(int) git_odb_backend_loose(git_odb_backend **backend_out, const char *objects_dir, int compression_level, int do_fsync); diff --git a/include/git2/refs.h b/include/git2/refs.h index 9abc32369..2760f9457 100644 --- a/include/git2/refs.h +++ b/include/git2/refs.h @@ -111,7 +111,7 @@ GIT_EXTERN(const char *) git_reference_target(git_reference *ref); * @param ref The reference * @return the type */ -GIT_EXTERN(git_rtype) git_reference_type(git_reference *ref); +GIT_EXTERN(git_ref_t) git_reference_type(git_reference *ref); /** * Get the full name of a reference diff --git a/include/git2/status.h b/include/git2/status.h index 0130b4011..caa350325 100644 --- a/include/git2/status.h +++ b/include/git2/status.h @@ -19,19 +19,19 @@ */ GIT_BEGIN_DECL -#define GIT_STATUS_CURRENT 0 +enum { + GIT_STATUS_CURRENT = 0, -/** Flags for index status */ -#define GIT_STATUS_INDEX_NEW (1 << 0) -#define GIT_STATUS_INDEX_MODIFIED (1 << 1) -#define GIT_STATUS_INDEX_DELETED (1 << 2) + GIT_STATUS_INDEX_NEW = (1 << 0), + GIT_STATUS_INDEX_MODIFIED = (1 << 1), + GIT_STATUS_INDEX_DELETED = (1 << 2), -/** Flags for worktree status */ -#define GIT_STATUS_WT_NEW (1 << 3) -#define GIT_STATUS_WT_MODIFIED (1 << 4) -#define GIT_STATUS_WT_DELETED (1 << 5) + GIT_STATUS_WT_NEW = (1 << 3), + GIT_STATUS_WT_MODIFIED = (1 << 4), + GIT_STATUS_WT_DELETED = (1 << 5), -#define GIT_STATUS_IGNORED (1 << 6) + GIT_STATUS_IGNORED = (1 << 6), +}; /** * Gather file statuses and run a callback for each one. @@ -97,11 +97,14 @@ typedef enum { * slash on the entry name). Given this flag, the directory * itself will not be included, but all the files in it will. */ -#define GIT_STATUS_OPT_INCLUDE_UNTRACKED (1 << 0) -#define GIT_STATUS_OPT_INCLUDE_IGNORED (1 << 1) -#define GIT_STATUS_OPT_INCLUDE_UNMODIFIED (1 << 2) -#define GIT_STATUS_OPT_EXCLUDE_SUBMODULES (1 << 3) -#define GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS (1 << 4) + +enum { + GIT_STATUS_OPT_INCLUDE_UNTRACKED = (1 << 0), + GIT_STATUS_OPT_INCLUDE_IGNORED = (1 << 1), + GIT_STATUS_OPT_INCLUDE_UNMODIFIED = (1 << 2), + GIT_STATUS_OPT_EXCLUDE_SUBMODULED = (1 << 3), + GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS = (1 << 4), +}; /** * Options to control how callbacks will be made by diff --git a/include/git2/types.h b/include/git2/types.h index 98eea5374..cfb0acf33 100644 --- a/include/git2/types.h +++ b/include/git2/types.h @@ -158,13 +158,13 @@ typedef enum { GIT_REF_PACKED = 4, GIT_REF_HAS_PEEL = 8, GIT_REF_LISTALL = GIT_REF_OID|GIT_REF_SYMBOLIC|GIT_REF_PACKED, -} git_rtype; +} git_ref_t; /** Basic type of any Git branch. */ typedef enum { GIT_BRANCH_LOCAL = 1, GIT_BRANCH_REMOTE = 2, -} git_branch_type; +} git_branch_t; typedef struct git_refspec git_refspec; typedef struct git_remote git_remote; diff --git a/src/branch.c b/src/branch.c index 6d5880cb2..9698bbf56 100644 --- a/src/branch.c +++ b/src/branch.c @@ -105,7 +105,7 @@ cleanup: return error; } -int git_branch_delete(git_repository *repo, const char *branch_name, git_branch_type branch_type) +int git_branch_delete(git_repository *repo, const char *branch_name, git_branch_t branch_type) { git_reference *branch = NULL; git_reference *head = NULL; diff --git a/src/refs.c b/src/refs.c index 9ba09249c..1ef3e13a4 100644 --- a/src/refs.c +++ b/src/refs.c @@ -194,10 +194,10 @@ corrupt: return -1; } -static git_rtype loose_guess_rtype(const git_buf *full_path) +static git_ref_t loose_guess_rtype(const git_buf *full_path) { git_buf ref_file = GIT_BUF_INIT; - git_rtype type; + git_ref_t type; type = GIT_REF_INVALID; @@ -1153,7 +1153,7 @@ int git_reference_lookup_resolved( /** * Getters */ -git_rtype git_reference_type(git_reference *ref) +git_ref_t git_reference_type(git_reference *ref) { assert(ref); diff --git a/tests-clar/refs/branches/delete.c b/tests-clar/refs/branches/delete.c index 8ccfaf32f..03d3c56d7 100644 --- a/tests-clar/refs/branches/delete.c +++ b/tests-clar/refs/branches/delete.c @@ -75,7 +75,7 @@ void test_refs_branches_delete__can_delete_a_remote_branch(void) cl_git_pass(git_branch_delete(repo, "nulltoken/master", GIT_BRANCH_REMOTE)); } -static void assert_non_exisitng_branch_removal(const char *branch_name, git_branch_type branch_type) +static void assert_non_exisitng_branch_removal(const char *branch_name, git_branch_t branch_type) { int error; error = git_branch_delete(repo, branch_name, branch_type);