Commit df3063eafeff67b855b98068f8fdb3ecfd1daf65

Edward Thomson 2020-01-18T14:04:44

rebase: update enum type name for consistency libgit2 does not use `type_t` suffixes as it's redundant; thus, rename `git_rebase_type_t` to `git_rebase_t` for consistency.

diff --git a/src/rebase.c b/src/rebase.c
index d171fa2..0a38807 100644
--- a/src/rebase.c
+++ b/src/rebase.c
@@ -49,18 +49,18 @@
 #define REBASE_FILE_MODE    0666
 
 typedef enum {
-	GIT_REBASE_TYPE_NONE = 0,
-	GIT_REBASE_TYPE_APPLY = 1,
-	GIT_REBASE_TYPE_MERGE = 2,
-	GIT_REBASE_TYPE_INTERACTIVE = 3,
-} git_rebase_type_t;
+	GIT_REBASE_NONE = 0,
+	GIT_REBASE_APPLY = 1,
+	GIT_REBASE_MERGE = 2,
+	GIT_REBASE_INTERACTIVE = 3,
+} git_rebase_t;
 
 struct git_rebase {
 	git_repository *repo;
 
 	git_rebase_options options;
 
-	git_rebase_type_t type;
+	git_rebase_t type;
 	char *state_path;
 
 	int head_detached : 1,
@@ -86,18 +86,18 @@ struct git_rebase {
 #define GIT_REBASE_STATE_INIT {0}
 
 static int rebase_state_type(
-	git_rebase_type_t *type_out,
+	git_rebase_t *type_out,
 	char **path_out,
 	git_repository *repo)
 {
 	git_buf path = GIT_BUF_INIT;
-	git_rebase_type_t type = GIT_REBASE_TYPE_NONE;
+	git_rebase_t type = GIT_REBASE_NONE;
 
 	if (git_buf_joinpath(&path, repo->gitdir, REBASE_APPLY_DIR) < 0)
 		return -1;
 
 	if (git_path_isdir(git_buf_cstr(&path))) {
-		type = GIT_REBASE_TYPE_APPLY;
+		type = GIT_REBASE_APPLY;
 		goto done;
 	}
 
@@ -106,14 +106,14 @@ static int rebase_state_type(
 		return -1;
 
 	if (git_path_isdir(git_buf_cstr(&path))) {
-		type = GIT_REBASE_TYPE_MERGE;
+		type = GIT_REBASE_MERGE;
 		goto done;
 	}
 
 done:
 	*type_out = type;
 
-	if (type != GIT_REBASE_TYPE_NONE && path_out)
+	if (type != GIT_REBASE_NONE && path_out)
 		*path_out = git_buf_detach(&path);
 
 	git_buf_dispose(&path);
@@ -314,7 +314,7 @@ int git_rebase_open(
 	if ((error = rebase_state_type(&rebase->type, &rebase->state_path, repo)) < 0)
 		goto done;
 
-	if (rebase->type == GIT_REBASE_TYPE_NONE) {
+	if (rebase->type == GIT_REBASE_NONE) {
 		git_error_set(GIT_ERROR_REBASE, "there is no rebase in progress");
 		error = GIT_ENOTFOUND;
 		goto done;
@@ -370,14 +370,14 @@ int git_rebase_open(
 		rebase->orig_head_name = git_buf_detach(&orig_head_name);
 
 	switch (rebase->type) {
-	case GIT_REBASE_TYPE_INTERACTIVE:
+	case GIT_REBASE_INTERACTIVE:
 		git_error_set(GIT_ERROR_REBASE, "interactive rebase is not supported");
 		error = -1;
 		break;
-	case GIT_REBASE_TYPE_MERGE:
+	case GIT_REBASE_MERGE:
 		error = rebase_open_merge(rebase);
 		break;
-	case GIT_REBASE_TYPE_APPLY:
+	case GIT_REBASE_APPLY:
 		git_error_set(GIT_ERROR_REBASE, "patch application rebase is not supported");
 		error = -1;
 		break;
@@ -509,12 +509,12 @@ int git_rebase_init_options(git_rebase_options *opts, unsigned int version)
 static int rebase_ensure_not_in_progress(git_repository *repo)
 {
 	int error;
-	git_rebase_type_t type;
+	git_rebase_t type;
 
 	if ((error = rebase_state_type(&type, NULL, repo)) < 0)
 		return error;
 
-	if (type != GIT_REBASE_TYPE_NONE) {
+	if (type != GIT_REBASE_NONE) {
 		git_error_set(GIT_ERROR_REBASE, "there is an existing rebase in progress");
 		return -1;
 	}
@@ -729,7 +729,7 @@ int git_rebase_init(
 
 	rebase->repo = repo;
 	rebase->inmemory = inmemory;
-	rebase->type = GIT_REBASE_TYPE_MERGE;
+	rebase->type = GIT_REBASE_MERGE;
 
 	if ((error = rebase_init_operations(rebase, repo, branch, upstream, onto)) < 0)
 		goto done;
@@ -764,7 +764,7 @@ static void normalize_checkout_options_for_apply(
 	if (!checkout_opts->ancestor_label)
 		checkout_opts->ancestor_label = "ancestor";
 
-	if (rebase->type == GIT_REBASE_TYPE_MERGE) {
+	if (rebase->type == GIT_REBASE_MERGE) {
 		if (!checkout_opts->our_label)
 			checkout_opts->our_label = rebase->onto_name;
 
@@ -917,7 +917,7 @@ int git_rebase_next(
 
 	if (rebase->inmemory)
 		error = rebase_next_inmemory(out, rebase);
-	else if (rebase->type == GIT_REBASE_TYPE_MERGE)
+	else if (rebase->type == GIT_REBASE_MERGE)
 		error = rebase_next_merge(out, rebase);
 	else
 		abort();
@@ -1128,7 +1128,7 @@ int git_rebase_commit(
 	if (rebase->inmemory)
 		error = rebase_commit_inmemory(
 			id, rebase, author, committer, message_encoding, message);
-	else if (rebase->type == GIT_REBASE_TYPE_MERGE)
+	else if (rebase->type == GIT_REBASE_MERGE)
 		error = rebase_commit_merge(
 			id, rebase, author, committer, message_encoding, message);
 	else