Commit b59c71d8 by Edward Thomson

iterator: update enum type name for consistency

libgit2 does not use `type_t` suffixes as it's redundant; thus, rename
`git_iterator_type_t` to `git_iterator_t` for consistency.
parent df3063ea
...@@ -39,8 +39,8 @@ struct git_diff { ...@@ -39,8 +39,8 @@ struct git_diff {
git_diff_options opts; git_diff_options opts;
git_vector deltas; /* vector of git_diff_delta */ git_vector deltas; /* vector of git_diff_delta */
git_pool pool; git_pool pool;
git_iterator_type_t old_src; git_iterator_t old_src;
git_iterator_type_t new_src; git_iterator_t new_src;
git_diff_perfdata perf; git_diff_perfdata perf;
int (*strcomp)(const char *, const char *); int (*strcomp)(const char *, const char *);
......
...@@ -50,8 +50,8 @@ static int diff_file_content_init_common( ...@@ -50,8 +50,8 @@ static int diff_file_content_init_common(
fc->opts_max_size = opts->max_size ? fc->opts_max_size = opts->max_size ?
opts->max_size : DIFF_MAX_FILESIZE; opts->max_size : DIFF_MAX_FILESIZE;
if (fc->src == GIT_ITERATOR_TYPE_EMPTY) if (fc->src == GIT_ITERATOR_EMPTY)
fc->src = GIT_ITERATOR_TYPE_TREE; fc->src = GIT_ITERATOR_TREE;
if (!fc->driver && if (!fc->driver &&
git_diff_driver_lookup(&fc->driver, fc->repo, git_diff_driver_lookup(&fc->driver, fc->repo,
...@@ -425,7 +425,7 @@ int git_diff_file_content__load( ...@@ -425,7 +425,7 @@ int git_diff_file_content__load(
(diff_opts->flags & GIT_DIFF_SHOW_BINARY) == 0) (diff_opts->flags & GIT_DIFF_SHOW_BINARY) == 0)
return 0; return 0;
if (fc->src == GIT_ITERATOR_TYPE_WORKDIR) if (fc->src == GIT_ITERATOR_WORKDIR)
error = diff_file_content_load_workdir(fc, diff_opts); error = diff_file_content_load_workdir(fc, diff_opts);
else else
error = diff_file_content_load_blob(fc, diff_opts); error = diff_file_content_load_blob(fc, diff_opts);
......
...@@ -21,7 +21,7 @@ typedef struct { ...@@ -21,7 +21,7 @@ typedef struct {
uint32_t flags; uint32_t flags;
uint32_t opts_flags; uint32_t opts_flags;
git_object_size_t opts_max_size; git_object_size_t opts_max_size;
git_iterator_type_t src; git_iterator_t src;
const git_blob *blob; const git_blob *blob;
git_map map; git_map map;
} git_diff_file_content; } git_diff_file_content;
......
...@@ -341,16 +341,16 @@ bool git_diff_delta__should_skip( ...@@ -341,16 +341,16 @@ bool git_diff_delta__should_skip(
static const char *diff_mnemonic_prefix( static const char *diff_mnemonic_prefix(
git_iterator_type_t type, bool left_side) git_iterator_t type, bool left_side)
{ {
const char *pfx = ""; const char *pfx = "";
switch (type) { switch (type) {
case GIT_ITERATOR_TYPE_EMPTY: pfx = "c"; break; case GIT_ITERATOR_EMPTY: pfx = "c"; break;
case GIT_ITERATOR_TYPE_TREE: pfx = "c"; break; case GIT_ITERATOR_TREE: pfx = "c"; break;
case GIT_ITERATOR_TYPE_INDEX: pfx = "i"; break; case GIT_ITERATOR_INDEX: pfx = "i"; break;
case GIT_ITERATOR_TYPE_WORKDIR: pfx = "w"; break; case GIT_ITERATOR_WORKDIR: pfx = "w"; break;
case GIT_ITERATOR_TYPE_FS: pfx = left_side ? "1" : "2"; break; case GIT_ITERATOR_FS: pfx = left_side ? "1" : "2"; break;
default: break; default: break;
} }
...@@ -497,17 +497,17 @@ static int diff_generated_apply_options( ...@@ -497,17 +497,17 @@ static int diff_generated_apply_options(
/* Reverse src info if diff is reversed */ /* Reverse src info if diff is reversed */
if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_REVERSE)) { if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_REVERSE)) {
git_iterator_type_t tmp_src = diff->base.old_src; git_iterator_t tmp_src = diff->base.old_src;
diff->base.old_src = diff->base.new_src; diff->base.old_src = diff->base.new_src;
diff->base.new_src = tmp_src; diff->base.new_src = tmp_src;
} }
/* Unset UPDATE_INDEX unless diffing workdir and index */ /* Unset UPDATE_INDEX unless diffing workdir and index */
if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_UPDATE_INDEX) && if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_UPDATE_INDEX) &&
(!(diff->base.old_src == GIT_ITERATOR_TYPE_WORKDIR || (!(diff->base.old_src == GIT_ITERATOR_WORKDIR ||
diff->base.new_src == GIT_ITERATOR_TYPE_WORKDIR) || diff->base.new_src == GIT_ITERATOR_WORKDIR) ||
!(diff->base.old_src == GIT_ITERATOR_TYPE_INDEX || !(diff->base.old_src == GIT_ITERATOR_INDEX ||
diff->base.new_src == GIT_ITERATOR_TYPE_INDEX))) diff->base.new_src == GIT_ITERATOR_INDEX)))
diff->base.opts.flags &= ~GIT_DIFF_UPDATE_INDEX; diff->base.opts.flags &= ~GIT_DIFF_UPDATE_INDEX;
/* if ignore_submodules not explicitly set, check diff config */ /* if ignore_submodules not explicitly set, check diff config */
...@@ -742,7 +742,7 @@ static int maybe_modified( ...@@ -742,7 +742,7 @@ static int maybe_modified(
const git_index_entry *nitem = info->nitem; const git_index_entry *nitem = info->nitem;
unsigned int omode = oitem->mode; unsigned int omode = oitem->mode;
unsigned int nmode = nitem->mode; unsigned int nmode = nitem->mode;
bool new_is_workdir = (info->new_iter->type == GIT_ITERATOR_TYPE_WORKDIR); bool new_is_workdir = (info->new_iter->type == GIT_ITERATOR_WORKDIR);
bool modified_uncertain = false; bool modified_uncertain = false;
const char *matched_pathspec; const char *matched_pathspec;
int error = 0; int error = 0;
...@@ -1079,7 +1079,7 @@ static int handle_unmatched_new_item( ...@@ -1079,7 +1079,7 @@ static int handle_unmatched_new_item(
/* item contained in ignored directory, so skip over it */ /* item contained in ignored directory, so skip over it */
return iterator_advance(&info->nitem, info->new_iter); return iterator_advance(&info->nitem, info->new_iter);
else if (info->new_iter->type != GIT_ITERATOR_TYPE_WORKDIR) { else if (info->new_iter->type != GIT_ITERATOR_WORKDIR) {
if (delta_type != GIT_DELTA_CONFLICTED) if (delta_type != GIT_DELTA_CONFLICTED)
delta_type = GIT_DELTA_ADDED; delta_type = GIT_DELTA_ADDED;
} }
......
...@@ -389,7 +389,7 @@ static int apply_splits_and_deletes( ...@@ -389,7 +389,7 @@ static int apply_splits_and_deletes(
if (insert_delete_side_of_split(diff, &onto, delta) < 0) if (insert_delete_side_of_split(diff, &onto, delta) < 0)
goto on_error; goto on_error;
if (diff->new_src == GIT_ITERATOR_TYPE_WORKDIR) if (diff->new_src == GIT_ITERATOR_WORKDIR)
delta->status = GIT_DELTA_UNTRACKED; delta->status = GIT_DELTA_UNTRACKED;
else else
delta->status = GIT_DELTA_ADDED; delta->status = GIT_DELTA_ADDED;
...@@ -441,7 +441,7 @@ GIT_INLINE(git_diff_file *) similarity_get_file(git_diff *diff, size_t idx) ...@@ -441,7 +441,7 @@ GIT_INLINE(git_diff_file *) similarity_get_file(git_diff *diff, size_t idx)
typedef struct { typedef struct {
size_t idx; size_t idx;
git_iterator_type_t src; git_iterator_t src;
git_repository *repo; git_repository *repo;
git_diff_file *file; git_diff_file *file;
git_buf data; git_buf data;
...@@ -460,7 +460,7 @@ static int similarity_init( ...@@ -460,7 +460,7 @@ static int similarity_init(
info->blob = NULL; info->blob = NULL;
git_buf_init(&info->data, 0); git_buf_init(&info->data, 0);
if (info->file->size > 0 || info->src == GIT_ITERATOR_TYPE_WORKDIR) if (info->file->size > 0 || info->src == GIT_ITERATOR_WORKDIR)
return 0; return 0;
return git_diff_file__resolve_zero_size( return git_diff_file__resolve_zero_size(
...@@ -475,7 +475,7 @@ static int similarity_sig( ...@@ -475,7 +475,7 @@ static int similarity_sig(
int error = 0; int error = 0;
git_diff_file *file = info->file; git_diff_file *file = info->file;
if (info->src == GIT_ITERATOR_TYPE_WORKDIR) { if (info->src == GIT_ITERATOR_WORKDIR) {
if ((error = git_buf_joinpath( if ((error = git_buf_joinpath(
&info->data, git_repository_workdir(info->repo), file->path)) < 0) &info->data, git_repository_workdir(info->repo), file->path)) < 0)
return error; return error;
...@@ -561,13 +561,13 @@ static int similarity_measure( ...@@ -561,13 +561,13 @@ static int similarity_measure(
/* if exact match is requested, force calculation of missing OIDs now */ /* if exact match is requested, force calculation of missing OIDs now */
if (exact_match) { if (exact_match) {
if (git_oid_is_zero(&a_file->id) && if (git_oid_is_zero(&a_file->id) &&
diff->old_src == GIT_ITERATOR_TYPE_WORKDIR && diff->old_src == GIT_ITERATOR_WORKDIR &&
!git_diff__oid_for_file(&a_file->id, !git_diff__oid_for_file(&a_file->id,
diff, a_file->path, a_file->mode, a_file->size)) diff, a_file->path, a_file->mode, a_file->size))
a_file->flags |= GIT_DIFF_FLAG_VALID_ID; a_file->flags |= GIT_DIFF_FLAG_VALID_ID;
if (git_oid_is_zero(&b_file->id) && if (git_oid_is_zero(&b_file->id) &&
diff->new_src == GIT_ITERATOR_TYPE_WORKDIR && diff->new_src == GIT_ITERATOR_WORKDIR &&
!git_diff__oid_for_file(&b_file->id, !git_diff__oid_for_file(&b_file->id,
diff, b_file->path, b_file->mode, b_file->size)) diff, b_file->path, b_file->mode, b_file->size))
b_file->flags |= GIT_DIFF_FLAG_VALID_ID; b_file->flags |= GIT_DIFF_FLAG_VALID_ID;
...@@ -1013,7 +1013,7 @@ find_best_matches: ...@@ -1013,7 +1013,7 @@ find_best_matches:
delta_make_rename(tgt, src, best_match->similarity); delta_make_rename(tgt, src, best_match->similarity);
src->status = (diff->new_src == GIT_ITERATOR_TYPE_WORKDIR) ? src->status = (diff->new_src == GIT_ITERATOR_WORKDIR) ?
GIT_DELTA_UNTRACKED : GIT_DELTA_ADDED; GIT_DELTA_UNTRACKED : GIT_DELTA_ADDED;
src->nfiles = 1; src->nfiles = 1;
memset(&src->old_file, 0, sizeof(src->old_file)); memset(&src->old_file, 0, sizeof(src->old_file));
......
...@@ -405,7 +405,7 @@ int git_iterator_for_nothing( ...@@ -405,7 +405,7 @@ int git_iterator_for_nothing(
iter = git__calloc(1, sizeof(empty_iterator)); iter = git__calloc(1, sizeof(empty_iterator));
GIT_ERROR_CHECK_ALLOC(iter); GIT_ERROR_CHECK_ALLOC(iter);
iter->base.type = GIT_ITERATOR_TYPE_EMPTY; iter->base.type = GIT_ITERATOR_EMPTY;
iter->base.cb = &callbacks; iter->base.cb = &callbacks;
iter->base.flags = options->flags; iter->base.flags = options->flags;
...@@ -950,7 +950,7 @@ int git_iterator_for_tree( ...@@ -950,7 +950,7 @@ int git_iterator_for_tree(
iter = git__calloc(1, sizeof(tree_iterator)); iter = git__calloc(1, sizeof(tree_iterator));
GIT_ERROR_CHECK_ALLOC(iter); GIT_ERROR_CHECK_ALLOC(iter);
iter->base.type = GIT_ITERATOR_TYPE_TREE; iter->base.type = GIT_ITERATOR_TREE;
iter->base.cb = &callbacks; iter->base.cb = &callbacks;
if ((error = iterator_init_common(&iter->base, if ((error = iterator_init_common(&iter->base,
...@@ -974,7 +974,7 @@ int git_iterator_current_tree_entry( ...@@ -974,7 +974,7 @@ int git_iterator_current_tree_entry(
tree_iterator_frame *frame; tree_iterator_frame *frame;
tree_iterator_entry *entry; tree_iterator_entry *entry;
assert(i->type == GIT_ITERATOR_TYPE_TREE); assert(i->type == GIT_ITERATOR_TREE);
iter = (tree_iterator *)i; iter = (tree_iterator *)i;
...@@ -991,7 +991,7 @@ int git_iterator_current_parent_tree( ...@@ -991,7 +991,7 @@ int git_iterator_current_parent_tree(
tree_iterator *iter; tree_iterator *iter;
tree_iterator_frame *frame; tree_iterator_frame *frame;
assert(i->type == GIT_ITERATOR_TYPE_TREE); assert(i->type == GIT_ITERATOR_TREE);
iter = (tree_iterator *)i; iter = (tree_iterator *)i;
...@@ -1271,7 +1271,7 @@ static int filesystem_iterator_entry_hash( ...@@ -1271,7 +1271,7 @@ static int filesystem_iterator_entry_hash(
return 0; return 0;
} }
if (iter->base.type == GIT_ITERATOR_TYPE_WORKDIR) if (iter->base.type == GIT_ITERATOR_WORKDIR)
return git_repository_hashfile(&entry->id, return git_repository_hashfile(&entry->id,
iter->base.repo, entry->path, GIT_OBJECT_BLOB, NULL); iter->base.repo, entry->path, GIT_OBJECT_BLOB, NULL);
...@@ -1668,8 +1668,8 @@ int git_iterator_current_workdir_path(git_buf **out, git_iterator *i) ...@@ -1668,8 +1668,8 @@ int git_iterator_current_workdir_path(git_buf **out, git_iterator *i)
filesystem_iterator *iter = GIT_CONTAINER_OF(i, filesystem_iterator, base); filesystem_iterator *iter = GIT_CONTAINER_OF(i, filesystem_iterator, base);
const git_index_entry *entry; const git_index_entry *entry;
if (i->type != GIT_ITERATOR_TYPE_FS && if (i->type != GIT_ITERATOR_FS &&
i->type != GIT_ITERATOR_TYPE_WORKDIR) { i->type != GIT_ITERATOR_WORKDIR) {
*out = NULL; *out = NULL;
return 0; return 0;
} }
...@@ -1727,7 +1727,7 @@ bool git_iterator_current_is_ignored(git_iterator *i) ...@@ -1727,7 +1727,7 @@ bool git_iterator_current_is_ignored(git_iterator *i)
{ {
filesystem_iterator *iter = NULL; filesystem_iterator *iter = NULL;
if (i->type != GIT_ITERATOR_TYPE_WORKDIR) if (i->type != GIT_ITERATOR_WORKDIR)
return false; return false;
iter = GIT_CONTAINER_OF(i, filesystem_iterator, base); iter = GIT_CONTAINER_OF(i, filesystem_iterator, base);
...@@ -1740,7 +1740,7 @@ bool git_iterator_current_tree_is_ignored(git_iterator *i) ...@@ -1740,7 +1740,7 @@ bool git_iterator_current_tree_is_ignored(git_iterator *i)
filesystem_iterator *iter = GIT_CONTAINER_OF(i, filesystem_iterator, base); filesystem_iterator *iter = GIT_CONTAINER_OF(i, filesystem_iterator, base);
filesystem_iterator_frame *frame; filesystem_iterator_frame *frame;
if (i->type != GIT_ITERATOR_TYPE_WORKDIR) if (i->type != GIT_ITERATOR_WORKDIR)
return false; return false;
frame = filesystem_iterator_current_frame(iter); frame = filesystem_iterator_current_frame(iter);
...@@ -1894,7 +1894,7 @@ static int iterator_for_filesystem( ...@@ -1894,7 +1894,7 @@ static int iterator_for_filesystem(
const char *root, const char *root,
git_index *index, git_index *index,
git_tree *tree, git_tree *tree,
git_iterator_type_t type, git_iterator_t type,
git_iterator_options *options) git_iterator_options *options)
{ {
filesystem_iterator *iter; filesystem_iterator *iter;
...@@ -1971,7 +1971,7 @@ int git_iterator_for_filesystem( ...@@ -1971,7 +1971,7 @@ int git_iterator_for_filesystem(
git_iterator_options *options) git_iterator_options *options)
{ {
return iterator_for_filesystem(out, return iterator_for_filesystem(out,
NULL, root, NULL, NULL, GIT_ITERATOR_TYPE_FS, options); NULL, root, NULL, NULL, GIT_ITERATOR_FS, options);
} }
int git_iterator_for_workdir_ext( int git_iterator_for_workdir_ext(
...@@ -1999,7 +1999,7 @@ int git_iterator_for_workdir_ext( ...@@ -1999,7 +1999,7 @@ int git_iterator_for_workdir_ext(
GIT_ITERATOR_IGNORE_DOT_GIT; GIT_ITERATOR_IGNORE_DOT_GIT;
return iterator_for_filesystem(out, return iterator_for_filesystem(out,
repo, repo_workdir, index, tree, GIT_ITERATOR_TYPE_WORKDIR, &options); repo, repo_workdir, index, tree, GIT_ITERATOR_WORKDIR, &options);
} }
...@@ -2248,7 +2248,7 @@ int git_iterator_for_index( ...@@ -2248,7 +2248,7 @@ int git_iterator_for_index(
iter = git__calloc(1, sizeof(index_iterator)); iter = git__calloc(1, sizeof(index_iterator));
GIT_ERROR_CHECK_ALLOC(iter); GIT_ERROR_CHECK_ALLOC(iter);
iter->base.type = GIT_ITERATOR_TYPE_INDEX; iter->base.type = GIT_ITERATOR_INDEX;
iter->base.cb = &callbacks; iter->base.cb = &callbacks;
if ((error = iterator_init_common(&iter->base, repo, index, options)) < 0 || if ((error = iterator_init_common(&iter->base, repo, index, options)) < 0 ||
......
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
typedef struct git_iterator git_iterator; typedef struct git_iterator git_iterator;
typedef enum { typedef enum {
GIT_ITERATOR_TYPE_EMPTY = 0, GIT_ITERATOR_EMPTY = 0,
GIT_ITERATOR_TYPE_TREE = 1, GIT_ITERATOR_TREE = 1,
GIT_ITERATOR_TYPE_INDEX = 2, GIT_ITERATOR_INDEX = 2,
GIT_ITERATOR_TYPE_WORKDIR = 3, GIT_ITERATOR_WORKDIR = 3,
GIT_ITERATOR_TYPE_FS = 4, GIT_ITERATOR_FS = 4,
} git_iterator_type_t; } git_iterator_t;
typedef enum { typedef enum {
/** ignore case for entry sort order */ /** ignore case for entry sort order */
...@@ -78,7 +78,7 @@ typedef struct { ...@@ -78,7 +78,7 @@ typedef struct {
} git_iterator_callbacks; } git_iterator_callbacks;
struct git_iterator { struct git_iterator {
git_iterator_type_t type; git_iterator_t type;
git_iterator_callbacks *cb; git_iterator_callbacks *cb;
git_repository *repo; git_repository *repo;
...@@ -238,7 +238,7 @@ GIT_INLINE(int) git_iterator_reset(git_iterator *iter) ...@@ -238,7 +238,7 @@ GIT_INLINE(int) git_iterator_reset(git_iterator *iter)
extern int git_iterator_reset_range( extern int git_iterator_reset_range(
git_iterator *iter, const char *start, const char *end); git_iterator *iter, const char *start, const char *end);
GIT_INLINE(git_iterator_type_t) git_iterator_type(git_iterator *iter) GIT_INLINE(git_iterator_t) git_iterator_type(git_iterator *iter)
{ {
return iter->type; return iter->type;
} }
......
...@@ -422,7 +422,7 @@ static int pathspec_match_from_iterator( ...@@ -422,7 +422,7 @@ static int pathspec_match_from_iterator(
if ((error = git_iterator_reset_range(iter, ps->prefix, ps->prefix)) < 0) if ((error = git_iterator_reset_range(iter, ps->prefix, ps->prefix)) < 0)
goto done; goto done;
if (git_iterator_type(iter) == GIT_ITERATOR_TYPE_WORKDIR && if (git_iterator_type(iter) == GIT_ITERATOR_WORKDIR &&
(error = git_repository_index__weakptr( (error = git_repository_index__weakptr(
&index, git_iterator_owner(iter))) < 0) &index, git_iterator_owner(iter))) < 0)
goto done; goto done;
......
...@@ -87,14 +87,14 @@ static unsigned int workdir_delta2status( ...@@ -87,14 +87,14 @@ static unsigned int workdir_delta2status(
* discern between RENAMED vs RENAMED+MODIFED * discern between RENAMED vs RENAMED+MODIFED
*/ */
if (git_oid_is_zero(&idx2wd->old_file.id) && if (git_oid_is_zero(&idx2wd->old_file.id) &&
diff->old_src == GIT_ITERATOR_TYPE_WORKDIR && diff->old_src == GIT_ITERATOR_WORKDIR &&
!git_diff__oid_for_file( !git_diff__oid_for_file(
&idx2wd->old_file.id, diff, idx2wd->old_file.path, &idx2wd->old_file.id, diff, idx2wd->old_file.path,
idx2wd->old_file.mode, idx2wd->old_file.size)) idx2wd->old_file.mode, idx2wd->old_file.size))
idx2wd->old_file.flags |= GIT_DIFF_FLAG_VALID_ID; idx2wd->old_file.flags |= GIT_DIFF_FLAG_VALID_ID;
if (git_oid_is_zero(&idx2wd->new_file.id) && if (git_oid_is_zero(&idx2wd->new_file.id) &&
diff->new_src == GIT_ITERATOR_TYPE_WORKDIR && diff->new_src == GIT_ITERATOR_WORKDIR &&
!git_diff__oid_for_file( !git_diff__oid_for_file(
&idx2wd->new_file.id, diff, idx2wd->new_file.path, &idx2wd->new_file.id, diff, idx2wd->new_file.path,
idx2wd->new_file.mode, idx2wd->new_file.size)) idx2wd->new_file.mode, idx2wd->new_file.size))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment