static void *oidmap_value_bykey(git_oidmap *map, const git_oid *key)
{
- khint_t pos = git_oidmap_lookup_index(map, key);
+ size_t pos = git_oidmap_lookup_index(map, key);
if (!git_oidmap_valid_index(map, pos))
return NULL;
if (replace_name(&tag, repo, e, prio, sha1)) {
if (!found) {
e = git__malloc(sizeof(struct commit_name));
- GITERR_CHECK_ALLOC(e);
+ GIT_ERROR_CHECK_ALLOC(e);
e->path = NULL;
e->tag = NULL;
if ((error = git_reference_lookup_resolved(&ref, repo, refname, -1)) < 0)
return error;
- if ((error = git_reference_peel(&peeled, ref, GIT_OBJ_ANY)) < 0)
+ if ((error = git_reference_peel(&peeled, ref, GIT_OBJECT_ANY)) < 0)
goto cleanup;
git_oid_cpy(ref_target_out, git_reference_target(ref));
struct commit_name *name;
name = git__malloc(sizeof(struct commit_name));
- GITERR_CHECK_ALLOC(name);
+ GIT_ERROR_CHECK_ALLOC(name);
memcpy(name, in, sizeof(struct commit_name));
name->tag = NULL;
return -1;
name->path = git__strdup(in->path);
- GITERR_CHECK_ALLOC(name->path);
+ GIT_ERROR_CHECK_ALLOC(name->path);
*out = name;
return 0;
int error;
tag = git__malloc(sizeof(struct possible_tag));
- GITERR_CHECK_ALLOC(tag);
+ GIT_ERROR_CHECK_ALLOC(tag);
memcpy(tag, in, sizeof(struct possible_tag));
tag->name = NULL;
{
if (n->prio == 2 && !n->tag) {
if (git_tag_lookup(&n->tag, repo, &n->sha1) < 0) {
- giterr_set(GITERR_TAG, "annotated tag '%s' not available", n->path);
+ git_error_set(GIT_ERROR_TAG, "annotated tag '%s' not available", n->path);
return -1;
}
}
if (n->tag && !n->name_checked) {
if (!git_tag_name(n->tag)) {
- giterr_set(GITERR_TAG, "annotated tag '%s' has no embedded name", n->path);
+ git_error_set(GIT_ERROR_TAG, "annotated tag '%s' has no embedded name", n->path);
return -1;
}
int *out,
git_repository *repo,
const git_oid *oid_in,
- int abbreviated_size)
+ unsigned int abbreviated_size)
{
size_t size = abbreviated_size;
git_odb *odb;
/* If we didn't find any shorter prefix, we have to do the whole thing */
*out = GIT_OID_HEXSZ;
-
+
return 0;
}
int depth,
git_repository *repo,
const git_oid* id,
- size_t abbrev_size)
+ unsigned int abbrev_size)
{
int error, size = 0;
char oid_str[GIT_OID_HEXSZ + 1];
git_oid_tostr(oid_str, sizeof(oid_str), oid);
- giterr_set(GITERR_DESCRIBE, message_format, oid_str);
+ git_error_set(GIT_ERROR_DESCRIBE, message_format, oid_str);
return GIT_ENOTFOUND;
}
unannotated_cnt++;
} else if (match_cnt < data->opts->max_candidates_tags) {
struct possible_tag *t = git__malloc(sizeof(struct commit_name));
- GITERR_CHECK_ALLOC(t);
+ GIT_ERROR_CHECK_ALLOC(t);
if ((error = git_vector_insert(&all_matches, t)) < 0)
goto cleanup;
goto cleanup;
}
if (unannotated_cnt) {
- error = describe_not_found(git_commit_id(commit),
+ error = describe_not_found(git_commit_id(commit),
"cannot describe - "
"no annotated tags can describe '%s'; "
"however, there were unannotated tags.");
goto cleanup;
}
else {
- error = describe_not_found(git_commit_id(commit),
+ error = describe_not_found(git_commit_id(commit),
"cannot describe - "
"no tags can describe '%s'.");
goto cleanup;
assert(committish);
data.result = git__calloc(1, sizeof(git_describe_result));
- GITERR_CHECK_ALLOC(data.result);
+ GIT_ERROR_CHECK_ALLOC(data.result);
data.result->repo = git_object_owner(committish);
data.repo = git_object_owner(committish);
if ((error = normalize_options(&normalized, opts)) < 0)
return error;
- GITERR_CHECK_VERSION(
+ GIT_ERROR_CHECK_VERSION(
&normalized,
GIT_DESCRIBE_OPTIONS_VERSION,
"git_describe_options");
data.opts = &normalized;
data.names = git_oidmap_alloc();
- GITERR_CHECK_ALLOC(data.names);
+ GIT_ERROR_CHECK_ALLOC(data.names);
/** TODO: contains to be implemented */
- if ((error = git_object_peel((git_object **)(&commit), committish, GIT_OBJ_COMMIT)) < 0)
+ if ((error = git_object_peel((git_object **)(&commit), committish, GIT_OBJECT_COMMIT)) < 0)
goto cleanup;
if ((error = git_reference_foreach_name(
goto cleanup;
if (git_oidmap_size(data.names) == 0 && !opts->show_commit_oid_as_fallback) {
- giterr_set(GITERR_DESCRIBE, "cannot describe - "
+ git_error_set(GIT_ERROR_DESCRIBE, "cannot describe - "
"no reference found, cannot describe anything.");
error = -1;
goto cleanup;
if ((error = git_reference_name_to_id(¤t_id, repo, GIT_HEAD_FILE)) < 0)
return error;
- if ((error = git_object_lookup(&commit, repo, ¤t_id, GIT_OBJ_COMMIT)) < 0)
+ if ((error = git_object_lookup(&commit, repo, ¤t_id, GIT_OBJECT_COMMIT)) < 0)
return error;
/* The first step is to perform a describe of HEAD, so we can leverage this */
assert(out && result);
- GITERR_CHECK_VERSION(given, GIT_DESCRIBE_FORMAT_OPTIONS_VERSION, "git_describe_format_options");
+ GIT_ERROR_CHECK_VERSION(given, GIT_DESCRIBE_FORMAT_OPTIONS_VERSION, "git_describe_format_options");
normalize_format_options(&opts, given);
git_buf_sanitize(out);
if (opts.always_use_long_format && opts.abbreviated_size == 0) {
- giterr_set(GITERR_DESCRIBE, "cannot describe - "
+ git_error_set(GIT_ERROR_DESCRIBE, "cannot describe - "
"'always_use_long_format' is incompatible with a zero"
"'abbreviated_size'");
return -1;