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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374
diff --git a/src/diff.h b/src/diff.h
index 1a4ee47..69233b3 100644
--- a/src/diff.h
+++ b/src/diff.h
@@ -39,8 +39,8 @@ struct git_diff {
git_diff_options opts;
git_vector deltas; /* vector of git_diff_delta */
git_pool pool;
- git_iterator_type_t old_src;
- git_iterator_type_t new_src;
+ git_iterator_t old_src;
+ git_iterator_t new_src;
git_diff_perfdata perf;
int (*strcomp)(const char *, const char *);
diff --git a/src/diff_file.c b/src/diff_file.c
index 6c9a8e0..621bff5 100644
--- a/src/diff_file.c
+++ b/src/diff_file.c
@@ -50,8 +50,8 @@ static int diff_file_content_init_common(
fc->opts_max_size = opts->max_size ?
opts->max_size : DIFF_MAX_FILESIZE;
- if (fc->src == GIT_ITERATOR_TYPE_EMPTY)
- fc->src = GIT_ITERATOR_TYPE_TREE;
+ if (fc->src == GIT_ITERATOR_EMPTY)
+ fc->src = GIT_ITERATOR_TREE;
if (!fc->driver &&
git_diff_driver_lookup(&fc->driver, fc->repo,
@@ -425,7 +425,7 @@ int git_diff_file_content__load(
(diff_opts->flags & GIT_DIFF_SHOW_BINARY) == 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);
else
error = diff_file_content_load_blob(fc, diff_opts);
diff --git a/src/diff_file.h b/src/diff_file.h
index 9354912..8d743e8 100644
--- a/src/diff_file.h
+++ b/src/diff_file.h
@@ -21,7 +21,7 @@ typedef struct {
uint32_t flags;
uint32_t opts_flags;
git_object_size_t opts_max_size;
- git_iterator_type_t src;
+ git_iterator_t src;
const git_blob *blob;
git_map map;
} git_diff_file_content;
diff --git a/src/diff_generate.c b/src/diff_generate.c
index bd0b71c..b69ef30 100644
--- a/src/diff_generate.c
+++ b/src/diff_generate.c
@@ -341,16 +341,16 @@ bool git_diff_delta__should_skip(
static const char *diff_mnemonic_prefix(
- git_iterator_type_t type, bool left_side)
+ git_iterator_t type, bool left_side)
{
const char *pfx = "";
switch (type) {
- case GIT_ITERATOR_TYPE_EMPTY: pfx = "c"; break;
- case GIT_ITERATOR_TYPE_TREE: pfx = "c"; break;
- case GIT_ITERATOR_TYPE_INDEX: pfx = "i"; break;
- case GIT_ITERATOR_TYPE_WORKDIR: pfx = "w"; break;
- case GIT_ITERATOR_TYPE_FS: pfx = left_side ? "1" : "2"; break;
+ case GIT_ITERATOR_EMPTY: pfx = "c"; break;
+ case GIT_ITERATOR_TREE: pfx = "c"; break;
+ case GIT_ITERATOR_INDEX: pfx = "i"; break;
+ case GIT_ITERATOR_WORKDIR: pfx = "w"; break;
+ case GIT_ITERATOR_FS: pfx = left_side ? "1" : "2"; break;
default: break;
}
@@ -497,17 +497,17 @@ static int diff_generated_apply_options(
/* Reverse src info if diff is reversed */
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.new_src = tmp_src;
}
/* Unset UPDATE_INDEX unless diffing workdir and index */
if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_UPDATE_INDEX) &&
- (!(diff->base.old_src == GIT_ITERATOR_TYPE_WORKDIR ||
- diff->base.new_src == GIT_ITERATOR_TYPE_WORKDIR) ||
- !(diff->base.old_src == GIT_ITERATOR_TYPE_INDEX ||
- diff->base.new_src == GIT_ITERATOR_TYPE_INDEX)))
+ (!(diff->base.old_src == GIT_ITERATOR_WORKDIR ||
+ diff->base.new_src == GIT_ITERATOR_WORKDIR) ||
+ !(diff->base.old_src == GIT_ITERATOR_INDEX ||
+ diff->base.new_src == GIT_ITERATOR_INDEX)))
diff->base.opts.flags &= ~GIT_DIFF_UPDATE_INDEX;
/* if ignore_submodules not explicitly set, check diff config */
@@ -742,7 +742,7 @@ static int maybe_modified(
const git_index_entry *nitem = info->nitem;
unsigned int omode = oitem->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;
const char *matched_pathspec;
int error = 0;
@@ -1079,7 +1079,7 @@ static int handle_unmatched_new_item(
/* item contained in ignored directory, so skip over it */
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)
delta_type = GIT_DELTA_ADDED;
}
diff --git a/src/diff_tform.c b/src/diff_tform.c
index 70bbb00..437144a 100644
--- a/src/diff_tform.c
+++ b/src/diff_tform.c
@@ -389,7 +389,7 @@ static int apply_splits_and_deletes(
if (insert_delete_side_of_split(diff, &onto, delta) < 0)
goto on_error;
- if (diff->new_src == GIT_ITERATOR_TYPE_WORKDIR)
+ if (diff->new_src == GIT_ITERATOR_WORKDIR)
delta->status = GIT_DELTA_UNTRACKED;
else
delta->status = GIT_DELTA_ADDED;
@@ -441,7 +441,7 @@ GIT_INLINE(git_diff_file *) similarity_get_file(git_diff *diff, size_t idx)
typedef struct {
size_t idx;
- git_iterator_type_t src;
+ git_iterator_t src;
git_repository *repo;
git_diff_file *file;
git_buf data;
@@ -460,7 +460,7 @@ static int similarity_init(
info->blob = NULL;
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 git_diff_file__resolve_zero_size(
@@ -475,7 +475,7 @@ static int similarity_sig(
int error = 0;
git_diff_file *file = info->file;
- if (info->src == GIT_ITERATOR_TYPE_WORKDIR) {
+ if (info->src == GIT_ITERATOR_WORKDIR) {
if ((error = git_buf_joinpath(
&info->data, git_repository_workdir(info->repo), file->path)) < 0)
return error;
@@ -561,13 +561,13 @@ static int similarity_measure(
/* if exact match is requested, force calculation of missing OIDs now */
if (exact_match) {
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,
diff, a_file->path, a_file->mode, a_file->size))
a_file->flags |= GIT_DIFF_FLAG_VALID_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,
diff, b_file->path, b_file->mode, b_file->size))
b_file->flags |= GIT_DIFF_FLAG_VALID_ID;
@@ -1013,7 +1013,7 @@ find_best_matches:
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;
src->nfiles = 1;
memset(&src->old_file, 0, sizeof(src->old_file));
diff --git a/src/iterator.c b/src/iterator.c
index 28ffddf..e26e2c0 100644
--- a/src/iterator.c
+++ b/src/iterator.c
@@ -405,7 +405,7 @@ int git_iterator_for_nothing(
iter = git__calloc(1, sizeof(empty_iterator));
GIT_ERROR_CHECK_ALLOC(iter);
- iter->base.type = GIT_ITERATOR_TYPE_EMPTY;
+ iter->base.type = GIT_ITERATOR_EMPTY;
iter->base.cb = &callbacks;
iter->base.flags = options->flags;
@@ -950,7 +950,7 @@ int git_iterator_for_tree(
iter = git__calloc(1, sizeof(tree_iterator));
GIT_ERROR_CHECK_ALLOC(iter);
- iter->base.type = GIT_ITERATOR_TYPE_TREE;
+ iter->base.type = GIT_ITERATOR_TREE;
iter->base.cb = &callbacks;
if ((error = iterator_init_common(&iter->base,
@@ -974,7 +974,7 @@ int git_iterator_current_tree_entry(
tree_iterator_frame *frame;
tree_iterator_entry *entry;
- assert(i->type == GIT_ITERATOR_TYPE_TREE);
+ assert(i->type == GIT_ITERATOR_TREE);
iter = (tree_iterator *)i;
@@ -991,7 +991,7 @@ int git_iterator_current_parent_tree(
tree_iterator *iter;
tree_iterator_frame *frame;
- assert(i->type == GIT_ITERATOR_TYPE_TREE);
+ assert(i->type == GIT_ITERATOR_TREE);
iter = (tree_iterator *)i;
@@ -1271,7 +1271,7 @@ static int filesystem_iterator_entry_hash(
return 0;
}
- if (iter->base.type == GIT_ITERATOR_TYPE_WORKDIR)
+ if (iter->base.type == GIT_ITERATOR_WORKDIR)
return git_repository_hashfile(&entry->id,
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)
filesystem_iterator *iter = GIT_CONTAINER_OF(i, filesystem_iterator, base);
const git_index_entry *entry;
- if (i->type != GIT_ITERATOR_TYPE_FS &&
- i->type != GIT_ITERATOR_TYPE_WORKDIR) {
+ if (i->type != GIT_ITERATOR_FS &&
+ i->type != GIT_ITERATOR_WORKDIR) {
*out = NULL;
return 0;
}
@@ -1727,7 +1727,7 @@ bool git_iterator_current_is_ignored(git_iterator *i)
{
filesystem_iterator *iter = NULL;
- if (i->type != GIT_ITERATOR_TYPE_WORKDIR)
+ if (i->type != GIT_ITERATOR_WORKDIR)
return false;
iter = GIT_CONTAINER_OF(i, filesystem_iterator, base);
@@ -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_frame *frame;
- if (i->type != GIT_ITERATOR_TYPE_WORKDIR)
+ if (i->type != GIT_ITERATOR_WORKDIR)
return false;
frame = filesystem_iterator_current_frame(iter);
@@ -1894,7 +1894,7 @@ static int iterator_for_filesystem(
const char *root,
git_index *index,
git_tree *tree,
- git_iterator_type_t type,
+ git_iterator_t type,
git_iterator_options *options)
{
filesystem_iterator *iter;
@@ -1971,7 +1971,7 @@ int git_iterator_for_filesystem(
git_iterator_options *options)
{
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(
@@ -1999,7 +1999,7 @@ int git_iterator_for_workdir_ext(
GIT_ITERATOR_IGNORE_DOT_GIT;
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(
iter = git__calloc(1, sizeof(index_iterator));
GIT_ERROR_CHECK_ALLOC(iter);
- iter->base.type = GIT_ITERATOR_TYPE_INDEX;
+ iter->base.type = GIT_ITERATOR_INDEX;
iter->base.cb = &callbacks;
if ((error = iterator_init_common(&iter->base, repo, index, options)) < 0 ||
diff --git a/src/iterator.h b/src/iterator.h
index bbe357f..ebd6936 100644
--- a/src/iterator.h
+++ b/src/iterator.h
@@ -17,12 +17,12 @@
typedef struct git_iterator git_iterator;
typedef enum {
- GIT_ITERATOR_TYPE_EMPTY = 0,
- GIT_ITERATOR_TYPE_TREE = 1,
- GIT_ITERATOR_TYPE_INDEX = 2,
- GIT_ITERATOR_TYPE_WORKDIR = 3,
- GIT_ITERATOR_TYPE_FS = 4,
-} git_iterator_type_t;
+ GIT_ITERATOR_EMPTY = 0,
+ GIT_ITERATOR_TREE = 1,
+ GIT_ITERATOR_INDEX = 2,
+ GIT_ITERATOR_WORKDIR = 3,
+ GIT_ITERATOR_FS = 4,
+} git_iterator_t;
typedef enum {
/** ignore case for entry sort order */
@@ -78,7 +78,7 @@ typedef struct {
} git_iterator_callbacks;
struct git_iterator {
- git_iterator_type_t type;
+ git_iterator_t type;
git_iterator_callbacks *cb;
git_repository *repo;
@@ -238,7 +238,7 @@ GIT_INLINE(int) git_iterator_reset(git_iterator *iter)
extern int git_iterator_reset_range(
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;
}
diff --git a/src/pathspec.c b/src/pathspec.c
index 9eb9523..19ea9eb 100644
--- a/src/pathspec.c
+++ b/src/pathspec.c
@@ -422,7 +422,7 @@ static int pathspec_match_from_iterator(
if ((error = git_iterator_reset_range(iter, ps->prefix, ps->prefix)) < 0)
goto done;
- if (git_iterator_type(iter) == GIT_ITERATOR_TYPE_WORKDIR &&
+ if (git_iterator_type(iter) == GIT_ITERATOR_WORKDIR &&
(error = git_repository_index__weakptr(
&index, git_iterator_owner(iter))) < 0)
goto done;
diff --git a/src/status.c b/src/status.c
index 42c98f6..6a12844 100644
--- a/src/status.c
+++ b/src/status.c
@@ -87,14 +87,14 @@ static unsigned int workdir_delta2status(
* discern between RENAMED vs RENAMED+MODIFED
*/
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(
&idx2wd->old_file.id, diff, idx2wd->old_file.path,
idx2wd->old_file.mode, idx2wd->old_file.size))
idx2wd->old_file.flags |= GIT_DIFF_FLAG_VALID_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(
&idx2wd->new_file.id, diff, idx2wd->new_file.path,
idx2wd->new_file.mode, idx2wd->new_file.size))