vendor/libgit2/src/diff_generate.c in rugged-0.28.5 vs vendor/libgit2/src/diff_generate.c in rugged-0.99.0

- old
+ new

@@ -7,11 +7,11 @@ #include "diff_generate.h" #include "diff.h" #include "patch_generate.h" -#include "fileops.h" +#include "futils.h" #include "config.h" #include "attr_file.h" #include "filter.h" #include "pathspec.h" #include "index.h" @@ -177,11 +177,11 @@ delta->new_file.id_abbrev = GIT_OID_HEXSZ; } delta->old_file.flags |= GIT_DIFF_FLAG_VALID_ID; - if (has_old || !git_oid_iszero(&delta->new_file.id)) + if (has_old || !git_oid_is_zero(&delta->new_file.id)) delta->new_file.flags |= GIT_DIFF_FLAG_VALID_ID; return diff_insert_delta(diff, delta, matched_pathspec); } @@ -238,11 +238,11 @@ delta->new_file.size = new_entry->file_size; delta->new_file.mode = new_mode; delta->old_file.flags |= GIT_DIFF_FLAG_EXISTS; delta->new_file.flags |= GIT_DIFF_FLAG_EXISTS; - if (!git_oid_iszero(&new_entry->id)) + if (!git_oid_is_zero(&new_entry->id)) delta->new_file.flags |= GIT_DIFF_FLAG_VALID_ID; } return diff_insert_delta(diff, delta, matched_pathspec); } @@ -339,20 +339,20 @@ return false; } 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; } /* note: without a deeper look at pathspecs, there is no easy way * to get the (o)bject / (w)ork tree mnemonics working... @@ -470,21 +470,21 @@ /* load config values that affect diff behavior */ if ((val = git_repository_config_snapshot(&cfg, repo)) < 0) return val; - if (!git_config__cvar(&val, cfg, GIT_CVAR_SYMLINKS) && val) + if (!git_config__configmap_lookup(&val, cfg, GIT_CONFIGMAP_SYMLINKS) && val) diff->diffcaps |= GIT_DIFFCAPS_HAS_SYMLINKS; - if (!git_config__cvar(&val, cfg, GIT_CVAR_IGNORESTAT) && val) + if (!git_config__configmap_lookup(&val, cfg, GIT_CONFIGMAP_IGNORESTAT) && val) diff->diffcaps |= GIT_DIFFCAPS_IGNORE_STAT; if ((diff->base.opts.flags & GIT_DIFF_IGNORE_FILEMODE) == 0 && - !git_config__cvar(&val, cfg, GIT_CVAR_FILEMODE) && val) + !git_config__configmap_lookup(&val, cfg, GIT_CONFIGMAP_FILEMODE) && val) diff->diffcaps |= GIT_DIFFCAPS_TRUST_MODE_BITS; - if (!git_config__cvar(&val, cfg, GIT_CVAR_TRUSTCTIME) && val) + if (!git_config__configmap_lookup(&val, cfg, GIT_CONFIGMAP_TRUSTCTIME) && val) diff->diffcaps |= GIT_DIFFCAPS_TRUST_CTIME; /* Don't set GIT_DIFFCAPS_USE_DEV - compile time option in core git */ /* If not given explicit `opts`, check `diff.xyz` configs */ @@ -495,21 +495,21 @@ /* add other defaults here */ } /* 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 */ if (diff->base.opts.ignore_submodules <= 0) { git_config_entry *entry; @@ -558,15 +558,15 @@ int git_diff__oid_for_file( git_oid *out, git_diff *diff, const char *path, uint16_t mode, - git_off_t size) + git_object_size_t size) { git_index_entry entry; - if (size < 0 || size > UINT32_MAX) { + if (size > UINT32_MAX) { git_error_set(GIT_ERROR_NOMEMORY, "file size overflow (for 32-bits) on '%s'", path); return -1; } memset(&entry, 0, sizeof(entry)); @@ -740,11 +740,11 @@ git_delta_t status = GIT_DELTA_MODIFIED; const git_index_entry *oitem = info->oitem; 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; if (!diff_pathspec_match(&matched_pathspec, diff, oitem)) @@ -795,17 +795,17 @@ } /* if oids and modes match (and are valid), then file is unmodified */ } else if (git_oid_equal(&oitem->id, &nitem->id) && omode == nmode && - !git_oid_iszero(&oitem->id)) { + !git_oid_is_zero(&oitem->id)) { status = GIT_DELTA_UNMODIFIED; /* if we have an unknown OID and a workdir iterator, then check some * circumstances that can accelerate things or need special handling */ - } else if (git_oid_iszero(&nitem->id) && new_is_workdir) { + } else if (git_oid_is_zero(&nitem->id) && new_is_workdir) { bool use_ctime = ((diff->diffcaps & GIT_DIFFCAPS_TRUST_CTIME) != 0); git_index *index = git_iterator_index(info->new_iter); status = GIT_DELTA_UNMODIFIED; @@ -841,11 +841,11 @@ } /* if we got here and decided that the files are modified, but we * haven't calculated the OID of the new item, then calculate it now */ - if (modified_uncertain && git_oid_iszero(&nitem->id)) { + if (modified_uncertain && git_oid_is_zero(&nitem->id)) { const git_oid *update_check = DIFF_FLAG_IS_SET(diff, GIT_DIFF_UPDATE_INDEX) && omode == nmode ? &oitem->id : NULL; if ((error = git_diff__oid_for_entry( @@ -875,11 +875,11 @@ return error; } return diff_delta__from_two( diff, status, oitem, omode, nitem, nmode, - git_oid_iszero(&noid) ? NULL : &noid, matched_pathspec); + git_oid_is_zero(&noid) ? NULL : &noid, matched_pathspec); } static bool entry_is_prefixed( git_diff_generated *diff, const git_index_entry *item, @@ -1077,10 +1077,10 @@ DIFF_FLAG_ISNT_SET(diff, GIT_DIFF_RECURSE_IGNORED_DIRS) && git_iterator_current_tree_is_ignored(info->new_iter)) /* 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; } else if (nitem->mode == GIT_FILEMODE_COMMIT) {