summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/attr.c14
-rw-r--r--src/attr_file.c14
-rw-r--r--src/branch.c2
-rw-r--r--src/commit.c6
-rw-r--r--src/config.c16
-rw-r--r--src/config_cache.c8
-rw-r--r--src/config_file.c12
-rw-r--r--src/crlf.c6
-rw-r--r--src/delta-apply.c2
-rw-r--r--src/delta-apply.h2
-rw-r--r--src/diff.c2
-rw-r--r--src/fileops.c10
-rw-r--r--src/fileops.h6
-rw-r--r--src/filter.c4
-rw-r--r--src/filter.h2
-rw-r--r--src/ignore.c2
-rw-r--r--src/index.c2
-rw-r--r--src/indexer.c8
-rw-r--r--src/iterator.c6
-rw-r--r--src/notes.c10
-rw-r--r--src/object.c12
-rw-r--r--src/odb.c24
-rw-r--r--src/odb.h4
-rw-r--r--src/odb_loose.c2
-rw-r--r--src/odb_pack.c10
-rw-r--r--src/pack.c14
-rw-r--r--src/path.c4
-rw-r--r--src/pkt.c4
-rw-r--r--src/protocol.c2
-rw-r--r--src/refs.c8
-rw-r--r--src/refspec.c4
-rw-r--r--src/refspec.h2
-rw-r--r--src/remote.c10
-rw-r--r--src/repository.c10
-rw-r--r--src/revwalk.c22
-rw-r--r--src/signature.c4
-rw-r--r--src/status.c2
-rw-r--r--src/submodule.c4
-rw-r--r--src/tag.c14
-rw-r--r--src/transport.c6
-rw-r--r--src/transports/git.c10
-rw-r--r--src/transports/http.c6
-rw-r--r--src/tree.c14
-rw-r--r--src/vector.c6
44 files changed, 166 insertions, 166 deletions
diff --git a/src/attr.c b/src/attr.c
index 093f64d5c..5fef91427 100644
--- a/src/attr.c
+++ b/src/attr.c
@@ -245,13 +245,13 @@ static int load_attr_file(
struct stat st;
if (p_stat(filename, &st) < 0)
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
if (sig != NULL &&
(git_time_t)st.st_mtime == sig->seconds &&
(git_off_t)st.st_size == sig->size &&
(unsigned int)st.st_ino == sig->ino)
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
error = git_futils_readbuffer_updated(&content, filename, NULL, NULL);
if (error < 0)
@@ -286,7 +286,7 @@ static int load_attr_blob_from_index(
entry = git_index_get(index, error);
if (old_oid && git_oid_cmp(old_oid, &entry->oid) == 0)
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
if ((error = git_blob_lookup(blob, repo, &entry->oid)) < 0)
return error;
@@ -396,7 +396,7 @@ int git_attr_cache__push_file(
if (error) {
/* not finding a file is not an error for this function */
- if (error == GIT_ENOTFOUND) {
+ if (error == GIT_NOTFOUND) {
giterr_clear();
error = 0;
}
@@ -550,7 +550,7 @@ static int collect_attr_files(
error = git_futils_find_system_file(&dir, GIT_ATTR_FILE_SYSTEM);
if (!error)
error = push_attr_file(repo, files, NULL, dir.ptr);
- else if (error == GIT_ENOTFOUND)
+ else if (error == GIT_NOTFOUND)
error = 0;
}
@@ -577,11 +577,11 @@ int git_attr_cache__init(git_repository *repo)
return -1;
ret = git_config_get_string(&cache->cfg_attr_file, cfg, GIT_ATTR_CONFIG);
- if (ret < 0 && ret != GIT_ENOTFOUND)
+ if (ret < 0 && ret != GIT_NOTFOUND)
return ret;
ret = git_config_get_string(&cache->cfg_excl_file, cfg, GIT_IGNORE_CONFIG);
- if (ret < 0 && ret != GIT_ENOTFOUND)
+ if (ret < 0 && ret != GIT_NOTFOUND)
return ret;
giterr_clear();
diff --git a/src/attr_file.c b/src/attr_file.c
index 5030ad5de..601b286cf 100644
--- a/src/attr_file.c
+++ b/src/attr_file.c
@@ -99,7 +99,7 @@ int git_attr_file__parse_buffer(
/* if the rule wasn't a pattern, on to the next */
if (error < 0) {
git_attr_rule__clear(rule); /* reset rule contents */
- if (error == GIT_ENOTFOUND)
+ if (error == GIT_NOTFOUND)
error = 0;
} else {
rule = NULL; /* vector now "owns" the rule */
@@ -328,7 +328,7 @@ void git_attr_path__free(git_attr_path *info)
/*
* This will return 0 if the spec was filled out,
- * GIT_ENOTFOUND if the fnmatch does not require matching, or
+ * GIT_NOTFOUND if the fnmatch does not require matching, or
* another error code there was an actual problem.
*/
int git_attr_fnmatch__parse(
@@ -347,7 +347,7 @@ int git_attr_fnmatch__parse(
while (git__isspace(*pattern)) pattern++;
if (!*pattern || *pattern == '#') {
*base = git__next_line(pattern);
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
spec->flags = 0;
@@ -464,7 +464,7 @@ static int merge_assignments(void **old_raw, void *new_raw)
GIT_REFCOUNT_DEC(*old, git_attr_assignment__free);
*old = new;
- return GIT_EEXISTS;
+ return GIT_EXISTS;
}
int git_attr_assignment__parse(
@@ -551,7 +551,7 @@ int git_attr_assignment__parse(
error = git_vector_insert_sorted(
assigns, massign, &merge_assignments);
- if (error < 0 && error != GIT_EEXISTS)
+ if (error < 0 && error != GIT_EXISTS)
return error;
}
}
@@ -559,7 +559,7 @@ int git_attr_assignment__parse(
/* insert allocated assign into vector */
error = git_vector_insert_sorted(assigns, assign, &merge_assignments);
- if (error < 0 && error != GIT_EEXISTS)
+ if (error < 0 && error != GIT_EXISTS)
return error;
/* clear assign since it is now "owned" by the vector */
@@ -571,7 +571,7 @@ int git_attr_assignment__parse(
*base = git__next_line(scan);
- return (assigns->length == 0) ? GIT_ENOTFOUND : 0;
+ return (assigns->length == 0) ? GIT_NOTFOUND : 0;
}
static void git_attr_rule__clear(git_attr_rule *rule)
diff --git a/src/branch.c b/src/branch.c
index 9698bbf56..45f67ffdc 100644
--- a/src/branch.c
+++ b/src/branch.c
@@ -190,7 +190,7 @@ int git_branch_move(git_repository *repo, const char *old_branch_name, const cha
if ((error = git_buf_joinpath(&old_reference_name, GIT_REFS_HEADS_DIR, old_branch_name)) < 0)
goto cleanup;
- /* We need to be able to return GIT_ENOTFOUND */
+ /* We need to be able to return GIT_NOTFOUND */
if ((error = git_reference_lookup(&reference, repo, git_buf_cstr(&old_reference_name))) < 0)
goto cleanup;
diff --git a/src/commit.c b/src/commit.c
index 2bf12f3a5..1c6bee97a 100644
--- a/src/commit.c
+++ b/src/commit.c
@@ -100,7 +100,7 @@ static int update_reference(git_repository *repo, git_oid *oid, const char *ref_
/* If we haven't found the reference at all, we assume we need to create
* a new reference and that's it */
- if (res == GIT_ENOTFOUND) {
+ if (res == GIT_NOTFOUND) {
giterr_clear();
return git_reference_create_oid(NULL, repo, ref_name, oid, 1);
}
@@ -125,7 +125,7 @@ static int update_reference(git_repository *repo, git_oid *oid, const char *ref_
* this is means we're creating a new branch, for example.
* We need to create a new direct reference with that name
*/
- if (res == GIT_ENOTFOUND) {
+ if (res == GIT_NOTFOUND) {
giterr_clear();
res = git_reference_create_oid(NULL, repo, sym_target, oid, 1);
git_reference_free(ref);
@@ -320,7 +320,7 @@ int git_commit_parent(git_commit **parent, git_commit *commit, unsigned int n)
parent_oid = git_vector_get(&commit->parent_oids, n);
if (parent_oid == NULL) {
giterr_set(GITERR_INVALID, "Parent %u does not exist", n);
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
return git_commit_lookup(parent, commit->object.repo, parent_oid);
diff --git a/src/config.c b/src/config.c
index 618202c34..b60faf820 100644
--- a/src/config.c
+++ b/src/config.c
@@ -263,7 +263,7 @@ int git_config_lookup_map_value(
size_t i;
if (!value)
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
for (i = 0; i < map_n; ++i) {
git_cvar_map *m = maps + i;
@@ -295,7 +295,7 @@ int git_config_lookup_map_value(
}
}
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
int git_config_get_mapped(
@@ -387,12 +387,12 @@ int git_config_get_string(const char **out, git_config *cfg, const char *name)
git_vector_foreach(&cfg->files, i, internal) {
git_config_file *file = internal->file;
int ret = file->get(file, name, out);
- if (ret != GIT_ENOTFOUND)
+ if (ret != GIT_NOTFOUND)
return ret;
}
giterr_set(GITERR_CONFIG, "Config variable '%s' not found", name);
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
int git_config_get_multivar(git_config *cfg, const char *name, const char *regexp,
@@ -400,7 +400,7 @@ int git_config_get_multivar(git_config *cfg, const char *name, const char *regex
{
file_internal *internal;
git_config_file *file;
- int ret = GIT_ENOTFOUND;
+ int ret = GIT_NOTFOUND;
unsigned int i;
assert(cfg->files.length);
@@ -413,7 +413,7 @@ int git_config_get_multivar(git_config *cfg, const char *name, const char *regex
internal = git_vector_get(&cfg->files, i - 1);
file = internal->file;
ret = file->get_multivar(file, name, regexp, fn, data);
- if (ret < 0 && ret != GIT_ENOTFOUND)
+ if (ret < 0 && ret != GIT_NOTFOUND)
return ret;
}
@@ -424,14 +424,14 @@ int git_config_set_multivar(git_config *cfg, const char *name, const char *regex
{
file_internal *internal;
git_config_file *file;
- int ret = GIT_ENOTFOUND;
+ int ret = GIT_NOTFOUND;
unsigned int i;
for (i = cfg->files.length; i > 0; --i) {
internal = git_vector_get(&cfg->files, i - 1);
file = internal->file;
ret = file->set_multivar(file, name, regexp, value);
- if (ret < 0 && ret != GIT_ENOTFOUND)
+ if (ret < 0 && ret != GIT_NOTFOUND)
return ret;
}
diff --git a/src/config_cache.c b/src/config_cache.c
index 057f21439..b23fd7b31 100644
--- a/src/config_cache.c
+++ b/src/config_cache.c
@@ -66,22 +66,22 @@ int git_repository__cvar(int *out, git_repository *repo, git_cvar_cached cvar)
int error;
error = git_repository_config__weakptr(&config, repo);
- if (error < GIT_SUCCESS)
+ if (error < 0)
return error;
error = git_config_get_mapped(out,
config, data->cvar_name, data->maps, data->map_count);
- if (error == GIT_ENOTFOUND)
+ if (error == GIT_NOTFOUND)
*out = data->default_value;
- else if (error < GIT_SUCCESS)
+ else if (error < 0)
return error;
repo->cvar_cache[(int)cvar] = *out;
}
- return GIT_SUCCESS;
+ return 0;
}
void git_repository__cvar_cache_clear(git_repository *repo)
diff --git a/src/config_file.c b/src/config_file.c
index cbc48bcd9..6ecc974ff 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -161,7 +161,7 @@ static int config_open(git_config_file *cfg)
res = git_futils_readbuffer(&b->reader.buffer, b->file_path);
/* It's fine if the file doesn't exist */
- if (res == GIT_ENOTFOUND)
+ if (res == GIT_NOTFOUND)
return 0;
if (res < 0 || config_parse(b) < 0) {
@@ -289,7 +289,7 @@ static int config_get(git_config_file *cfg, const char *name, const char **out)
/* no error message; the config system will write one */
if (!git_strmap_valid_index(b->values, pos))
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
*out = ((cvar_t *)git_strmap_value_at(b->values, pos))->value;
@@ -315,7 +315,7 @@ static int config_get_multivar(
git__free(key);
if (!git_strmap_valid_index(b->values, pos))
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
var = git_strmap_value_at(b->values, pos);
@@ -377,7 +377,7 @@ static int config_set_multivar(
pos = git_strmap_lookup_index(b->values, key);
if (!git_strmap_valid_index(b->values, pos)) {
git__free(key);
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
var = git_strmap_value_at(b->values, pos);
@@ -444,7 +444,7 @@ static int config_delete(git_config_file *cfg, const char *name)
git__free(key);
if (!git_strmap_valid_index(b->values, pos))
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
var = git_strmap_value_at(b->values, pos);
@@ -978,7 +978,7 @@ static int config_write(diskfile_backend *cfg, const char *key, const regex_t *p
result = git_futils_readbuffer(&cfg->reader.buffer, cfg->file_path);
/* Initialise the reading position */
- if (result == GIT_ENOTFOUND) {
+ if (result == GIT_NOTFOUND) {
cfg->reader.read_ptr = NULL;
cfg->reader.eof = 1;
data_start = NULL;
diff --git a/src/crlf.c b/src/crlf.c
index 0ee1eef35..5fb1be516 100644
--- a/src/crlf.c
+++ b/src/crlf.c
@@ -85,13 +85,13 @@ static int crlf_load_attributes(struct crlf_attrs *ca, git_repository *repo, con
error = git_attr_get_many(attr_vals,
repo, 0, path, NUM_CONV_ATTRS, attr_names);
- if (error == GIT_ENOTFOUND) {
+ if (error == GIT_NOTFOUND) {
ca->crlf_action = GIT_CRLF_GUESS;
ca->eol = GIT_EOL_UNSET;
return 0;
}
- if (error == GIT_SUCCESS) {
+ if (error == 0) {
ca->crlf_action = check_crlf(attr_vals[2]); /* text */
if (ca->crlf_action == GIT_CRLF_GUESS)
ca->crlf_action = check_crlf(attr_vals[0]); /* clrf */
@@ -207,7 +207,7 @@ int git_filter_add__crlf_to_odb(git_vector *filters, git_repository *repo, const
int auto_crlf;
if ((error = git_repository__cvar(
- &auto_crlf, repo, GIT_CVAR_AUTO_CRLF)) < GIT_SUCCESS)
+ &auto_crlf, repo, GIT_CVAR_AUTO_CRLF)) < 0)
return error;
if (auto_crlf == GIT_AUTO_CRLF_FALSE)
diff --git a/src/delta-apply.c b/src/delta-apply.c
index d3be084e0..815ca8f16 100644
--- a/src/delta-apply.c
+++ b/src/delta-apply.c
@@ -111,7 +111,7 @@ int git__delta_apply(
if (delta != delta_end || res_sz)
goto fail;
- return GIT_SUCCESS;
+ return 0;
fail:
git__free(out->data);
diff --git a/src/delta-apply.h b/src/delta-apply.h
index e46ef9af4..66fa76d43 100644
--- a/src/delta-apply.h
+++ b/src/delta-apply.h
@@ -20,7 +20,7 @@
* @param delta the delta to execute copy/insert instructions from.
* @param delta_len total number of bytes in the delta.
* @return
- * - GIT_SUCCESS on a successful delta unpack.
+ * - 0 on a successful delta unpack.
* - GIT_ERROR if the delta is corrupt or doesn't match the base.
*/
extern int git__delta_apply(
diff --git a/src/diff.c b/src/diff.c
index 0b2f8fb50..882534f72 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -343,7 +343,7 @@ static git_diff_list *git_diff_list_alloc(
if (!match)
goto fail;
ret = git_attr_fnmatch__parse(match, &diff->pool, NULL, &pattern);
- if (ret == GIT_ENOTFOUND) {
+ if (ret == GIT_NOTFOUND) {
git__free(match);
continue;
} else if (ret < 0)
diff --git a/src/fileops.c b/src/fileops.c
index ee9d4212d..c467143e4 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -95,7 +95,7 @@ int git_futils_open_ro(const char *path)
int fd = p_open(path, O_RDONLY);
if (fd < 0) {
if (errno == ENOENT)
- fd = GIT_ENOTFOUND;
+ fd = GIT_NOTFOUND;
giterr_set(GITERR_OS, "Failed to open '%s'", path);
}
return fd;
@@ -365,7 +365,7 @@ int git_futils_find_global_file(git_buf *path, const char *filename)
if (git_path_exists(path->ptr) == false) {
git_buf_clear(path);
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
return 0;
@@ -414,7 +414,7 @@ static int win32_find_system_file(git_buf *path, const char *filename)
char *file_utf8 = NULL;
if (!root || !filename || (len = strlen(filename)) == 0)
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
/* allocate space for wchar_t path to file */
file_utf16 = git__calloc(root->len + len + 2, sizeof(wchar_t));
@@ -438,7 +438,7 @@ static int win32_find_system_file(git_buf *path, const char *filename)
/* check access */
if (_waccess(file_utf16, F_OK) < 0) {
- error = GIT_ENOTFOUND;
+ error = GIT_NOTFOUND;
goto cleanup;
}
@@ -470,6 +470,6 @@ int git_futils_find_system_file(git_buf *path, const char *filename)
#ifdef GIT_WIN32
return win32_find_system_file(path, filename);
#else
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
#endif
}
diff --git a/src/fileops.h b/src/fileops.h
index be619d620..8dd4bb61a 100644
--- a/src/fileops.h
+++ b/src/fileops.h
@@ -139,7 +139,7 @@ extern int git_futils_mmap_ro(
* @param path path to file to be opened.
* @return
* - 0 on success;
- * - GIT_ENOTFOUND if not found;
+ * - GIT_NOTFOUND if not found;
* - -1 on an unspecified OS related error.
*/
extern int git_futils_mmap_ro_file(
@@ -159,7 +159,7 @@ extern void git_futils_mmap_free(git_map *map);
* @param filename name of file to find in the home directory
* @return
* - 0 if found;
- * - GIT_ENOTFOUND if not found;
+ * - GIT_NOTFOUND if not found;
* - -1 on an unspecified OS related error.
*/
extern int git_futils_find_global_file(git_buf *path, const char *filename);
@@ -171,7 +171,7 @@ extern int git_futils_find_global_file(git_buf *path, const char *filename);
* @param filename name of file to find in the home directory
* @return
* - 0 if found;
- * - GIT_ENOTFOUND if not found;
+ * - GIT_NOTFOUND if not found;
* - -1 on an unspecified OS related error.
*/
extern int git_futils_find_system_file(git_buf *path, const char *filename);
diff --git a/src/filter.c b/src/filter.c
index 73fe83e61..8fa3eb684 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -129,7 +129,7 @@ int git_filters_apply(git_buf *dest, git_buf *source, git_vector *filters)
if (git_buf_len(source) == 0) {
git_buf_clear(dest);
- return GIT_SUCCESS;
+ return 0;
}
/* Pre-grow the destination buffer to more or less the size
@@ -160,6 +160,6 @@ int git_filters_apply(git_buf *dest, git_buf *source, git_vector *filters)
if (src != 1)
git_buf_swap(dest, source);
- return GIT_SUCCESS;
+ return 0;
}
diff --git a/src/filter.h b/src/filter.h
index 5a77f25c6..66e370aef 100644
--- a/src/filter.h
+++ b/src/filter.h
@@ -75,7 +75,7 @@ extern int git_filters_load(git_vector *filters, git_repository *repo, const cha
* @param dest Buffer to store the result of the filtering
* @param source Buffer containing the document to filter
* @param filters A non-empty vector of filters as supplied by `git_filters_load`
- * @return GIT_SUCCESS on success, an error code otherwise
+ * @return 0 on success, an error code otherwise
*/
extern int git_filters_apply(git_buf *dest, git_buf *source, git_vector *filters);
diff --git a/src/ignore.c b/src/ignore.c
index fc6194bb5..2a7060501 100644
--- a/src/ignore.c
+++ b/src/ignore.c
@@ -40,7 +40,7 @@ static int parse_ignore_file(
git__free(match->pattern);
match->pattern = NULL;
- if (error == GIT_ENOTFOUND)
+ if (error == GIT_NOTFOUND)
error = 0;
} else {
match = NULL; /* vector now "owns" the match */
diff --git a/src/index.c b/src/index.c
index f1ae9a710..03b191356 100644
--- a/src/index.c
+++ b/src/index.c
@@ -411,7 +411,7 @@ static int index_insert(git_index *index, git_index_entry *entry, int replace)
* if no entry exists add the entry at the end;
* the index is no longer sorted
*/
- if (position == GIT_ENOTFOUND)
+ if (position == GIT_NOTFOUND)
return git_vector_insert(&index->entries, entry);
/* exists, replace it */
diff --git a/src/indexer.c b/src/indexer.c
index 01bec0877..da6d5d2c8 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -205,9 +205,9 @@ static int store_delta(git_indexer_stream *idx)
}
error = packfile_unpack_compressed(&obj, idx->pack, &w, &idx->off, entry_size, type);
- if (error == GIT_ESHORTBUFFER) {
+ if (error == GIT_SHORTBUFFER) {
idx->off = entry_start;
- return GIT_ESHORTBUFFER;
+ return GIT_SHORTBUFFER;
} else if (error < 0){
return -1;
}
@@ -355,7 +355,7 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
return 0;
error = git_packfile_unpack(&obj, idx->pack, &idx->off);
- if (error == GIT_ESHORTBUFFER) {
+ if (error == GIT_SHORTBUFFER) {
idx->off = entry_start;
return 0;
}
@@ -363,7 +363,7 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
if (error < 0) {
idx->off = entry_start;
error = store_delta(idx);
- if (error == GIT_ESHORTBUFFER)
+ if (error == GIT_SHORTBUFFER)
return 0;
if (error < 0)
return error;
diff --git a/src/iterator.c b/src/iterator.c
index 819b0e22a..cb9838dbc 100644
--- a/src/iterator.c
+++ b/src/iterator.c
@@ -468,7 +468,7 @@ static int workdir_iterator__expand_dir(workdir_iterator *wi)
error = git_path_dirload_with_stat(wi->path.ptr, wi->root_len, &wf->entries);
if (error < 0 || wf->entries.length == 0) {
workdir_iterator__free_frame(wf);
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
git_vector_sort(&wf->entries);
@@ -635,7 +635,7 @@ static int workdir_iterator__update_entry(workdir_iterator *wi)
if (!is_submodule) {
int res = git_submodule_lookup(NULL, wi->repo, wi->entry.path);
is_submodule = (res == 0);
- if (res == GIT_ENOTFOUND)
+ if (res == GIT_NOTFOUND)
giterr_clear();
}
@@ -683,7 +683,7 @@ int git_iterator_for_workdir_range(
wi->root_len = wi->path.size;
if ((error = workdir_iterator__expand_dir(wi)) < 0) {
- if (error == GIT_ENOTFOUND)
+ if (error == GIT_NOTFOUND)
error = 0;
else {
git_iterator_free((git_iterator *)wi);
diff --git a/src/notes.c b/src/notes.c
index 84ad94087..afd6fc23d 100644
--- a/src/notes.c
+++ b/src/notes.c
@@ -73,7 +73,7 @@ static int find_blob(git_oid *blob, git_tree *tree, const char *target)
return 0;
}
}
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
static int note_write(git_oid *out, git_repository *repo,
@@ -96,11 +96,11 @@ static int note_write(git_oid *out, git_repository *repo,
return error;
error = find_blob(&oid, tree, target + fanout);
- if (error != GIT_ENOTFOUND) {
+ if (error != GIT_NOTFOUND) {
git_tree_free(tree);
if (!error) {
giterr_set(GITERR_REPOSITORY, "Note for '%s' exists already", target);
- error = GIT_EEXISTS;
+ error = GIT_EXISTS;
}
return error;
}
@@ -275,7 +275,7 @@ static int note_get_default_ref(const char **out, git_repository *repo)
return -1;
ret = git_config_get_string(out, cfg, "core.notesRef");
- if (ret == GIT_ENOTFOUND) {
+ if (ret == GIT_NOTFOUND) {
*out = GIT_NOTES_DEFAULT_REF;
return 0;
}
@@ -352,7 +352,7 @@ int git_note_create(
return -1;
error = git_reference_lookup(&ref, repo, notes_ref);
- if (error < 0 && error != GIT_ENOTFOUND)
+ if (error < 0 && error != GIT_NOTFOUND)
return error;
if (!error) {
diff --git a/src/object.c b/src/object.c
index deeacb27c..0c40c05c2 100644
--- a/src/object.c
+++ b/src/object.c
@@ -74,7 +74,7 @@ static int create_object(git_object **object_out, git_otype type)
object->type = type;
*object_out = object;
- return GIT_SUCCESS;
+ return 0;
}
int git_object_lookup_prefix(
@@ -87,15 +87,15 @@ int git_object_lookup_prefix(
git_object *object = NULL;
git_odb *odb = NULL;
git_odb_object *odb_obj;
- int error = GIT_SUCCESS;
+ int error = 0;
assert(repo && object_out && id);
if (len < GIT_OID_MINPREFIXLEN)
- return GIT_EAMBIGUOUS;
+ return GIT_AMBIGUOUS;
error = git_repository_odb__weakptr(&odb, repo);
- if (error < GIT_SUCCESS)
+ if (error < 0)
return error;
if (len > GIT_OID_HEXSZ)
@@ -110,7 +110,7 @@ int git_object_lookup_prefix(
if (type != GIT_OBJ_ANY && type != object->type) {
git_object_free(object);
giterr_set(GITERR_ODB, "The given type does not match the type in ODB");
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
*object_out = object;
@@ -151,7 +151,7 @@ int git_object_lookup_prefix(
if (type != GIT_OBJ_ANY && type != odb_obj->raw.type) {
git_odb_object_free(odb_obj);
giterr_set(GITERR_ODB, "The given type does not match the type on the ODB");
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
type = odb_obj->raw.type;
diff --git a/src/odb.c b/src/odb.c
index 03cd912e9..dcb36e296 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -485,7 +485,7 @@ int git_odb_exists(git_odb *db, const git_oid *id)
int git_odb_read_header(size_t *len_p, git_otype *type_p, git_odb *db, const git_oid *id)
{
unsigned int i;
- int error = GIT_ENOTFOUND;
+ int error = GIT_NOTFOUND;
git_odb_object *object;
assert(db && id);
@@ -505,7 +505,7 @@ int git_odb_read_header(size_t *len_p, git_otype *type_p, git_odb *db, const git
error = b->read_header(len_p, type_p, b, id);
}
- if (!error || error == GIT_EPASSTHROUGH)
+ if (!error || error == GIT_PASSTHROUGH)
return 0;
/*
@@ -524,7 +524,7 @@ int git_odb_read_header(size_t *len_p, git_otype *type_p, git_odb *db, const git
int git_odb_read(git_odb_object **out, git_odb *db, const git_oid *id)
{
unsigned int i;
- int error = GIT_ENOTFOUND;
+ int error = GIT_NOTFOUND;
git_rawobj raw;
assert(out && db && id);
@@ -541,11 +541,11 @@ int git_odb_read(git_odb_object **out, git_odb *db, const git_oid *id)
error = b->read(&raw.data, &raw.len, &raw.type, b, id);
}
- /* TODO: If no backends are configured, this returns GIT_ENOTFOUND but
+ /* TODO: If no backends are configured, this returns GIT_NOTFOUND but
* will never have called giterr_set().
*/
- if (error && error != GIT_EPASSTHROUGH)
+ if (error && error != GIT_PASSTHROUGH)
return error;
*out = git_cache_try_store(&db->cache, new_odb_object(id, &raw));
@@ -556,7 +556,7 @@ int git_odb_read_prefix(
git_odb_object **out, git_odb *db, const git_oid *short_id, unsigned int len)
{
unsigned int i;
- int error = GIT_ENOTFOUND;
+ int error = GIT_NOTFOUND;
git_oid found_full_oid = {{0}};
git_rawobj raw;
bool found = false;
@@ -582,7 +582,7 @@ int git_odb_read_prefix(
if (b->read != NULL) {
git_oid full_oid;
error = b->read_prefix(&full_oid, &raw.data, &raw.len, &raw.type, b, short_id, len);
- if (error == GIT_ENOTFOUND || error == GIT_EPASSTHROUGH)
+ if (error == GIT_NOTFOUND || error == GIT_PASSTHROUGH)
continue;
if (error)
@@ -623,7 +623,7 @@ int git_odb_write(
error = b->write(oid, b, data, len, type);
}
- if (!error || error == GIT_EPASSTHROUGH)
+ if (!error || error == GIT_PASSTHROUGH)
return 0;
/* if no backends were able to write the object directly, we try a streaming
@@ -662,7 +662,7 @@ int git_odb_open_wstream(
error = init_fake_wstream(stream, b, size, type);
}
- if (error == GIT_EPASSTHROUGH)
+ if (error == GIT_PASSTHROUGH)
error = 0;
return error;
@@ -683,7 +683,7 @@ int git_odb_open_rstream(git_odb_stream **stream, git_odb *db, const git_oid *oi
error = b->readstream(stream, b, oid);
}
- if (error == GIT_EPASSTHROUGH)
+ if (error == GIT_PASSTHROUGH)
error = 0;
return error;
@@ -698,12 +698,12 @@ int git_odb__error_notfound(const char *message, const git_oid *oid)
} else
giterr_set(GITERR_ODB, "Object not found - %s", message);
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
int git_odb__error_ambiguous(const char *message)
{
giterr_set(GITERR_ODB, "Ambiguous SHA1 prefix - %s", message);
- return GIT_EAMBIGUOUS;
+ return GIT_AMBIGUOUS;
}
diff --git a/src/odb.h b/src/odb.h
index 263e4c30b..2a5c76949 100644
--- a/src/odb.h
+++ b/src/odb.h
@@ -68,12 +68,12 @@ int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_otype type);
int git_odb__hashlink(git_oid *out, const char *path);
/*
- * Generate a GIT_ENOTFOUND error for the ODB.
+ * Generate a GIT_NOTFOUND error for the ODB.
*/
int git_odb__error_notfound(const char *message, const git_oid *oid);
/*
- * Generate a GIT_EAMBIGUOUS error for the ODB.
+ * Generate a GIT_AMBIGUOUS error for the ODB.
*/
int git_odb__error_ambiguous(const char *message);
diff --git a/src/odb_loose.c b/src/odb_loose.c
index 989b03ab2..c229b544e 100644
--- a/src/odb_loose.c
+++ b/src/odb_loose.c
@@ -460,7 +460,7 @@ static int locate_object(
int error = object_file_name(object_location, backend->objects_dir, oid);
if (!error && !git_path_exists(object_location->ptr))
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
return error;
}
diff --git a/src/odb_pack.c b/src/odb_pack.c
index 458f288d9..e03879ee2 100644
--- a/src/odb_pack.c
+++ b/src/odb_pack.c
@@ -141,7 +141,7 @@ static int pack_entry_find(struct git_pack_entry *e,
/* Can find the offset of an object given
* a prefix of an identifier.
- * Sets GIT_EAMBIGUOUS if short oid is ambiguous.
+ * Sets GIT_AMBIGUOUS if short oid is ambiguous.
* This method assumes that len is between
* GIT_OID_MINPREFIXLEN and GIT_OID_HEXSZ.
*/
@@ -224,7 +224,7 @@ static int packfile_load__cb(void *_data, git_buf *path)
}
error = git_packfile_check(&pack, path->ptr);
- if (error == GIT_ENOTFOUND)
+ if (error == GIT_NOTFOUND)
/* ignore missing .pack file as git does */
return 0;
else if (error < 0)
@@ -306,7 +306,7 @@ static int pack_entry_find_prefix(
if (backend->last_found) {
error = git_pack_entry_find(e, backend->last_found, short_oid, len);
- if (error == GIT_EAMBIGUOUS)
+ if (error == GIT_AMBIGUOUS)
return error;
if (!error)
found = 1;
@@ -320,7 +320,7 @@ static int pack_entry_find_prefix(
continue;
error = git_pack_entry_find(e, p, short_oid, len);
- if (error == GIT_EAMBIGUOUS)
+ if (error == GIT_AMBIGUOUS)
return error;
if (!error) {
if (++found > 1)
@@ -354,7 +354,7 @@ int pack_backend__read_header(git_rawobj *obj, git_odb_backend *backend, const g
assert(obj && backend && oid);
if (locate_packfile(&location, (struct pack_backend *)backend, oid) < 0)
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
return read_header_packed(obj, &location);
}
diff --git a/src/pack.c b/src/pack.c
index 4a6bc6ae8..66a23f295 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -28,7 +28,7 @@ int packfile_unpack_compressed(
/* Can find the offset of an object given
* a prefix of an identifier.
- * Throws GIT_EAMBIGUOUSOIDPREFIX if short oid
+ * Throws GIT_AMBIGUOUSOIDPREFIX if short oid
* is ambiguous within the pack.
* This method assumes that len is between
* GIT_OID_MINPREFIXLEN and GIT_OID_HEXSZ.
@@ -222,7 +222,7 @@ static int packfile_unpack_header1(
shift = 4;
while (c & 0x80) {
if (len <= used)
- return GIT_ESHORTBUFFER;
+ return GIT_SHORTBUFFER;
if (bitsizeof(long) <= shift) {
*usedp = 0;
@@ -260,11 +260,11 @@ int git_packfile_unpack_header(
// base = pack_window_open(p, w_curs, *curpos, &left);
base = git_mwindow_open(mwf, w_curs, *curpos, 20, &left);
if (base == NULL)
- return GIT_ESHORTBUFFER;
+ return GIT_SHORTBUFFER;
ret = packfile_unpack_header1(&used, size_p, type_p, base, left);
git_mwindow_close(w_curs);
- if (ret == GIT_ESHORTBUFFER)
+ if (ret == GIT_SHORTBUFFER)
return ret;
else if (ret < 0)
return packfile_error("header length is zero");
@@ -428,7 +428,7 @@ int packfile_unpack_compressed(
if (st == Z_BUF_ERROR && in == NULL) {
inflateEnd(&stream);
git__free(buffer);
- return GIT_ESHORTBUFFER;
+ return GIT_SHORTBUFFER;
}
*curpos += stream.next_in - in;
@@ -467,7 +467,7 @@ git_off_t get_delta_base(
base_info = pack_window_open(p, w_curs, *curpos, &left);
/* Assumption: the only reason this would fail is because the file is too small */
if (base_info == NULL)
- return GIT_ESHORTBUFFER;
+ return GIT_SHORTBUFFER;
/* pack_window_open() assured us we have [base_info, base_info + 20)
* as a range that we can look at without walking off the
* end of the mapped window. Its actually the hash size
@@ -480,7 +480,7 @@ git_off_t get_delta_base(
base_offset = c & 127;
while (c & 128) {
if (left <= used)
- return GIT_ESHORTBUFFER;
+ return GIT_SHORTBUFFER;
base_offset += 1;
if (!base_offset || MSB(base_offset, 7))
return 0; /* overflow */
diff --git a/src/path.c b/src/path.c
index 84edf6d89..ba67544de 100644
--- a/src/path.c
+++ b/src/path.c
@@ -206,7 +206,7 @@ int git_path_prettify(git_buf *path_out, const char *path, const char *base)
if (p_realpath(path, buf) == NULL) {
/* giterr_set resets the errno when dealing with a GITERR_OS kind of error */
- int error = (errno == ENOENT || errno == ENOTDIR) ? GIT_ENOTFOUND : -1;
+ int error = (errno == ENOENT || errno == ENOTDIR) ? GIT_NOTFOUND : -1;
giterr_set(GITERR_OS, "Failed to resolve path '%s'", path);
git_buf_clear(path_out);
@@ -390,7 +390,7 @@ int git_path_lstat(const char *path, struct stat *st)
int err = 0;
if (p_lstat(path, st) < 0) {
- err = (errno == ENOENT) ? GIT_ENOTFOUND : -1;
+ err = (errno == ENOENT) ? GIT_NOTFOUND : -1;
giterr_set(GITERR_OS, "Failed to stat file '%s'", path);
}
diff --git a/src/pkt.c b/src/pkt.c
index b9c87f169..895644638 100644
--- a/src/pkt.c
+++ b/src/pkt.c
@@ -208,7 +208,7 @@ int git_pkt_parse_line(
/* Not even enough for the length */
if (bufflen > 0 && bufflen < PKT_LEN_SIZE)
- return GIT_ESHORTBUFFER;
+ return GIT_SHORTBUFFER;
len = parse_len(line);
if (len < 0) {
@@ -230,7 +230,7 @@ int git_pkt_parse_line(
* enough in the buffer to satisfy this line
*/
if (bufflen > 0 && bufflen < (size_t)len)
- return GIT_ESHORTBUFFER;
+ return GIT_SHORTBUFFER;
line += PKT_LEN_SIZE;
/*
diff --git a/src/protocol.c b/src/protocol.c
index a75354121..184903388 100644
--- a/src/protocol.c
+++ b/src/protocol.c
@@ -34,7 +34,7 @@ int git_protocol_store_refs(git_protocol *p, const char *data, size_t len)
return 0;
error = git_pkt_parse_line(&pkt, ptr, &line_end, git_buf_len(buf));
- if (error == GIT_ESHORTBUFFER)
+ if (error == GIT_SHORTBUFFER)
return 0; /* Ask for more */
if (error < 0)
return p->error = -1;
diff --git a/src/refs.c b/src/refs.c
index 1ef3e13a4..88e2218d1 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -437,7 +437,7 @@ static int packed_load(git_repository *repo)
* for us here, so just return. Anything else means we need to
* refresh the packed refs.
*/
- if (result == GIT_ENOTFOUND) {
+ if (result == GIT_NOTFOUND) {
git_strmap_clear(ref_cache->packfile);
return 0;
}
@@ -917,7 +917,7 @@ static int reference_can_write(
if (exists) {
giterr_set(GITERR_REFERENCE,
"A reference with that name (%s) already exists", refname);
- return GIT_EEXISTS;
+ return GIT_EXISTS;
}
}
@@ -962,7 +962,7 @@ static int packed_lookup(git_reference *ref)
pos = git_strmap_lookup_index(packfile_refs, ref->name);
if (!git_strmap_valid_index(packfile_refs, pos)) {
giterr_set(GITERR_REFERENCE, "Reference '%s' not found", ref->name);
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
pack_ref = git_strmap_value_at(packfile_refs, pos);
@@ -984,7 +984,7 @@ static int reference_lookup(git_reference *ref)
/* only try to lookup this reference on the packfile if it
* wasn't found on the loose refs; not if there was a critical error */
- if (result == GIT_ENOTFOUND) {
+ if (result == GIT_NOTFOUND) {
giterr_clear();
result = packed_lookup(ref);
if (result == 0)
diff --git a/src/refspec.c b/src/refspec.c
index ee4d3a158..adb162df9 100644
--- a/src/refspec.c
+++ b/src/refspec.c
@@ -68,7 +68,7 @@ int git_refspec_transform(char *out, size_t outlen, const git_refspec *spec, con
baselen = strlen(spec->dst);
if (outlen <= baselen) {
giterr_set(GITERR_INVALID, "Reference name too long");
- return GIT_ESHORTBUFFER;
+ return GIT_SHORTBUFFER;
}
/*
@@ -90,7 +90,7 @@ int git_refspec_transform(char *out, size_t outlen, const git_refspec *spec, con
if (outlen <= baselen + namelen) {
giterr_set(GITERR_INVALID, "Reference name too long");
- return GIT_ESHORTBUFFER;
+ return GIT_SHORTBUFFER;
}
memcpy(out, spec->dst, baselen);
diff --git a/src/refspec.h b/src/refspec.h
index 64c0ded0c..2db504910 100644
--- a/src/refspec.h
+++ b/src/refspec.h
@@ -28,7 +28,7 @@ int git_refspec_parse(struct git_refspec *refspec, const char *str);
* @param out where to store the target name
* @param spec the refspec
* @param name the name of the reference to transform
- * @return GIT_SUCCESS or error if buffer allocation fails
+ * @return 0 or error if buffer allocation fails
*/
int git_refspec_transform_r(git_buf *out, const git_refspec *spec, const char *name);
diff --git a/src/remote.c b/src/remote.c
index dc0ff6a03..db4d0a7fd 100644
--- a/src/remote.c
+++ b/src/remote.c
@@ -135,7 +135,7 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name)
}
error = parse_remote_refspec(config, &remote->fetch, git_buf_cstr(&buf));
- if (error == GIT_ENOTFOUND)
+ if (error == GIT_NOTFOUND)
error = 0;
if (error < 0) {
@@ -150,7 +150,7 @@ int git_remote_load(git_remote **out, git_repository *repo, const char *name)
}
error = parse_remote_refspec(config, &remote->push, git_buf_cstr(&buf));
- if (error == GIT_ENOTFOUND)
+ if (error == GIT_NOTFOUND)
error = 0;
if (error < 0) {
@@ -338,7 +338,7 @@ int git_remote_update_tips(git_remote *remote, int (*cb)(const char *refname, co
assert(remote);
if (refs->length == 0)
- return GIT_SUCCESS;
+ return 0;
/* HEAD is only allowed to be the first in the list */
head = refs->contents[0];
@@ -357,10 +357,10 @@ int git_remote_update_tips(git_remote *remote, int (*cb)(const char *refname, co
goto on_error;
error = git_reference_name_to_oid(&old, remote->repo, refname.ptr);
- if (error < 0 && error != GIT_ENOTFOUND)
+ if (error < 0 && error != GIT_NOTFOUND)
goto on_error;
- if (error == GIT_ENOTFOUND)
+ if (error == GIT_NOTFOUND)
memset(&old, 0, GIT_OID_RAWSZ);
if (!git_oid_cmp(&old, &head->oid))
diff --git a/src/repository.c b/src/repository.c
index 6ce3a560f..2979b446e 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -148,7 +148,7 @@ static int load_workdir(git_repository *repo, git_buf *parent_path)
error = git_config_get_string(&worktree, config, "core.worktree");
if (!error && worktree != NULL)
repo->workdir = git__strdup(worktree);
- else if (error != GIT_ENOTFOUND)
+ else if (error != GIT_NOTFOUND)
return error;
else {
giterr_clear();
@@ -342,7 +342,7 @@ static int find_repo(
if (!git_buf_len(repo_path) && !error) {
giterr_set(GITERR_REPOSITORY,
"Could not find repository from '%s'", start_path);
- error = GIT_ENOTFOUND;
+ error = GIT_NOTFOUND;
}
return error;
@@ -403,7 +403,7 @@ int git_repository_discover(
*repository_path = '\0';
if ((error = find_repo(&path, NULL, start_path, flags, ceiling_dirs)) < 0)
- return error != GIT_ENOTFOUND ? -1 : error;
+ return error != GIT_NOTFOUND ? -1 : error;
if (size < (size_t)(path.size + 1)) {
giterr_set(GITERR_REPOSITORY,
@@ -851,7 +851,7 @@ int git_repository_head_orphan(git_repository *repo)
error = git_repository_head(&ref, repo);
git_reference_free(ref);
- if (error == GIT_ENOTFOUND)
+ if (error == GIT_NOTFOUND)
return 1;
if (error < 0)
@@ -883,7 +883,7 @@ int git_repository_is_empty(git_repository *repo)
git_reference_free(head);
git_reference_free(branch);
- if (error == GIT_ENOTFOUND)
+ if (error == GIT_NOTFOUND)
return 1;
if (error < 0)
diff --git a/src/revwalk.c b/src/revwalk.c
index d0a5120bd..67695f84b 100644
--- a/src/revwalk.c
+++ b/src/revwalk.c
@@ -316,7 +316,7 @@ static int merge_bases_many(commit_list **out, git_revwalk *walk, commit_object
if ((p->flags & flags) == flags)
continue;
- if ((error = commit_parse(walk, p)) < GIT_SUCCESS)
+ if ((error = commit_parse(walk, p)) < 0)
return error;
p->flags |= flags;
@@ -375,7 +375,7 @@ int git_merge_base(git_oid *out, git_repository *repo, git_oid *one, git_oid *tw
if (!result) {
git_revwalk_free(walk);
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
git_oid_cpy(out, &result->item->oid);
@@ -600,7 +600,7 @@ static int revwalk_next_timesort(commit_object **object_out, git_revwalk *walk)
}
}
- return GIT_EREVWALKOVER;
+ return GIT_REVWALKOVER;
}
static int revwalk_next_unsorted(commit_object **object_out, git_revwalk *walk)
@@ -618,7 +618,7 @@ static int revwalk_next_unsorted(commit_object **object_out, git_revwalk *walk)
}
}
- return GIT_EREVWALKOVER;
+ return GIT_REVWALKOVER;
}
static int revwalk_next_toposort(commit_object **object_out, git_revwalk *walk)
@@ -629,7 +629,7 @@ static int revwalk_next_toposort(commit_object **object_out, git_revwalk *walk)
for (;;) {
next = commit_list_pop(&walk->iterator_topo);
if (next == NULL)
- return GIT_EREVWALKOVER;
+ return GIT_REVWALKOVER;
if (next->in_degree > 0) {
next->topo_delay = 1;
@@ -654,7 +654,7 @@ static int revwalk_next_toposort(commit_object **object_out, git_revwalk *walk)
static int revwalk_next_reverse(commit_object **object_out, git_revwalk *walk)
{
*object_out = commit_list_pop(&walk->iterator_reverse);
- return *object_out ? 0 : GIT_EREVWALKOVER;
+ return *object_out ? 0 : GIT_REVWALKOVER;
}
@@ -670,7 +670,7 @@ static int prepare_walk(git_revwalk *walk)
* so we know that the walk is already over.
*/
if (walk->one == NULL)
- return GIT_EREVWALKOVER;
+ return GIT_REVWALKOVER;
/* first figure out what the merge bases are */
if (merge_bases_many(&bases, walk, walk->one, &walk->twos) < 0)
@@ -698,7 +698,7 @@ static int prepare_walk(git_revwalk *walk)
return -1;
}
- if (error != GIT_EREVWALKOVER)
+ if (error != GIT_REVWALKOVER)
return error;
walk->get_next = &revwalk_next_toposort;
@@ -710,7 +710,7 @@ static int prepare_walk(git_revwalk *walk)
if (commit_list_insert(next, &walk->iterator_reverse) == NULL)
return -1;
- if (error != GIT_EREVWALKOVER)
+ if (error != GIT_REVWALKOVER)
return error;
walk->get_next = &revwalk_next_reverse;
@@ -809,9 +809,9 @@ int git_revwalk_next(git_oid *oid, git_revwalk *walk)
error = walk->get_next(&next, walk);
- if (error == GIT_EREVWALKOVER) {
+ if (error == GIT_REVWALKOVER) {
git_revwalk_reset(walk);
- return GIT_EREVWALKOVER;
+ return GIT_REVWALKOVER;
}
if (!error)
diff --git a/src/signature.c b/src/signature.c
index 4d6d11c70..7d329c4c9 100644
--- a/src/signature.c
+++ b/src/signature.c
@@ -167,7 +167,7 @@ static int parse_timezone_offset(const char *buffer, int *offset_out)
if (*offset_start == '\n') {
*offset_out = 0;
- return GIT_SUCCESS;
+ return 0;
}
if (offset_start[0] != '-' && offset_start[0] != '+')
@@ -176,7 +176,7 @@ static int parse_timezone_offset(const char *buffer, int *offset_out)
if (offset_start[1] < '0' || offset_start[1] > '9')
return timezone_error("expected initial digit");
- if (git__strtol32(&dec_offset, offset_start + 1, &offset_end, 10) < GIT_SUCCESS)
+ if (git__strtol32(&dec_offset, offset_start + 1, &offset_end, 10) < 0)
return timezone_error("not a valid number");
if (offset_end - offset_start != 5)
diff --git a/src/status.c b/src/status.c
index e9ad3cfe4..6676cd38f 100644
--- a/src/status.c
+++ b/src/status.c
@@ -214,7 +214,7 @@ int git_status_file(
if (!error && !sfi.count) {
giterr_set(GITERR_INVALID,
"Attempt to get status of nonexistent file '%s'", path);
- error = GIT_ENOTFOUND;
+ error = GIT_NOTFOUND;
}
*status_flags = sfi.status;
diff --git a/src/submodule.c b/src/submodule.c
index 3c07e657d..a63043fd5 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -351,7 +351,7 @@ int git_submodule_foreach(
git_strmap_foreach_value(repo->submodules, sm, {
/* usually the following will not come into play */
if (sm->refcount > 1) {
- if (git_vector_bsearch(&seen, sm) != GIT_ENOTFOUND)
+ if (git_vector_bsearch(&seen, sm) != GIT_NOTFOUND)
continue;
if ((error = git_vector_insert(&seen, sm)) < 0)
break;
@@ -378,7 +378,7 @@ int git_submodule_lookup(
pos = git_strmap_lookup_index(repo->submodules, name);
if (!git_strmap_valid_index(repo->submodules, pos))
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
if (sm_ptr)
*sm_ptr = git_strmap_value_at(repo->submodules, pos);
diff --git a/src/tag.c b/src/tag.c
index 13481c2a6..2a9ffee5b 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -168,7 +168,7 @@ static int retrieve_tag_reference(
return -1;
error = git_reference_lookup(&tag_ref, repo, ref_name_out->ptr);
- if (error < GIT_SUCCESS)
+ if (error < 0)
return error; /* Be it not foundo or corrupted */
*tag_reference_out = tag_ref;
@@ -254,7 +254,7 @@ static int git_tag_create__internal(
}
error = retrieve_tag_reference_oid(oid, &ref_name, repo, tag_name);
- if (error < GIT_SUCCESS && error != GIT_ENOTFOUND)
+ if (error < 0 && error != GIT_NOTFOUND)
return -1;
/** Ensure the tag name doesn't conflict with an already existing
@@ -262,7 +262,7 @@ static int git_tag_create__internal(
if (error == 0 && !allow_ref_overwrite) {
git_buf_free(&ref_name);
giterr_set(GITERR_TAG, "Tag already exists");
- return GIT_EEXISTS;
+ return GIT_EXISTS;
}
if (create_tag_annotation) {
@@ -332,7 +332,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
}
error = retrieve_tag_reference_oid(oid, &ref_name, repo, tag.tag_name);
- if (error < GIT_SUCCESS && error != GIT_ENOTFOUND)
+ if (error < 0 && error != GIT_NOTFOUND)
goto on_error;
/* We don't need these objects after this */
@@ -345,7 +345,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
* reference unless overwriting has explictly been requested **/
if (error == 0 && !allow_ref_overwrite) {
giterr_set(GITERR_TAG, "Tag already exists");
- return GIT_EEXISTS;
+ return GIT_EXISTS;
}
/* write the buffer */
@@ -414,7 +414,7 @@ static int tag_list_cb(const char *tag_name, void *payload)
return 0;
filter = (tag_filter_data *)payload;
- if (!*filter->pattern || p_fnmatch(filter->pattern, tag_name + GIT_REFS_TAGS_DIR_LEN, 0) == GIT_SUCCESS)
+ if (!*filter->pattern || p_fnmatch(filter->pattern, tag_name + GIT_REFS_TAGS_DIR_LEN, 0) == 0)
return git_vector_insert(filter->taglist, git__strdup(tag_name));
return 0;
@@ -428,7 +428,7 @@ int git_tag_list_match(git_strarray *tag_names, const char *pattern, git_reposit
assert(tag_names && repo && pattern);
- if (git_vector_init(&taglist, 8, NULL) < GIT_SUCCESS)
+ if (git_vector_init(&taglist, 8, NULL) < 0)
return -1;
filter.taglist = &taglist;
diff --git a/src/transport.c b/src/transport.c
index bc4248d5b..5b2cd7ea4 100644
--- a/src/transport.c
+++ b/src/transport.c
@@ -37,7 +37,7 @@ static git_transport_cb transport_find_fn(const char *url)
}
/* still here? Check to see if the path points to a file on the local file system */
- if ((git_path_exists(url) == GIT_SUCCESS) && git_path_isdir(url))
+ if ((git_path_exists(url) == 0) && git_path_isdir(url))
return &git_transport_local;
/* It could be a SSH remote path. Check to see if there's a : */
@@ -72,7 +72,7 @@ int git_transport_new(git_transport **out, const char *url)
}
error = fn(&transport);
- if (error < GIT_SUCCESS)
+ if (error < 0)
return error;
transport->url = git__strdup(url);
@@ -80,7 +80,7 @@ int git_transport_new(git_transport **out, const char *url)
*out = transport;
- return GIT_SUCCESS;
+ return 0;
}
/* from remote.h */
diff --git a/src/transports/git.c b/src/transports/git.c
index 9a1741941..c8f50800d 100644
--- a/src/transports/git.c
+++ b/src/transports/git.c
@@ -147,7 +147,7 @@ static int store_refs(transport_git *t)
return 0;
ret = git_protocol_store_refs(&t->proto, buf->data, buf->offset);
- if (ret == GIT_ESHORTBUFFER) {
+ if (ret == GIT_SHORTBUFFER) {
gitno_consume_n(buf, buf->len);
continue;
}
@@ -279,7 +279,7 @@ static int recv_pkt(gitno_buffer *buf)
return -1;
error = git_pkt_parse_line(&pkt, ptr, &line_end, buf->offset);
- if (error == GIT_ESHORTBUFFER)
+ if (error == GIT_SHORTBUFFER)
continue;
if (error < 0)
return -1;
@@ -344,7 +344,7 @@ static int git_negotiate_fetch(git_transport *transport, git_repository *repo, c
}
}
- if (error < 0 && error != GIT_EREVWALKOVER)
+ if (error < 0 && error != GIT_REVWALKOVER)
goto on_error;
/* Tell the other end that we're done negotiating */
@@ -384,10 +384,10 @@ static int git_download_pack(git_transport *transport, git_repository *repo, git
}
error = git_pkt_parse_line(&pkt, ptr, &line_end, buf->offset);
- if (error == GIT_ESHORTBUFFER)
+ if (error == GIT_SHORTBUFFER)
break;
- if (error < GIT_SUCCESS)
+ if (error < 0)
return error;
if (pkt->type == GIT_PKT_PACK) {
diff --git a/src/transports/http.c b/src/transports/http.c
index bc4a615f1..b382f7cd7 100644
--- a/src/transports/http.c
+++ b/src/transports/http.c
@@ -354,10 +354,10 @@ static int on_body_parse_response(http_parser *parser, const char *str, size_t l
return 0;
error = git_pkt_parse_line(&pkt, ptr, &line_end, git_buf_len(buf));
- if (error == GIT_ESHORTBUFFER) {
+ if (error == GIT_SHORTBUFFER) {
return 0; /* Ask for more */
}
- if (error < GIT_SUCCESS)
+ if (error < 0)
return t->error = -1;
git_buf_consume(buf, line_end);
@@ -486,7 +486,7 @@ static int http_negotiate_fetch(git_transport *transport, git_repository *repo,
git_buf_clear(&request);
git_buf_clear(&data);
- if (ret < GIT_SUCCESS || i >= 256)
+ if (ret < 0 || i >= 256)
break;
if ((ret = parse_response(t)) < 0)
diff --git a/src/tree.c b/src/tree.c
index 5acee4a41..a5fe2b63c 100644
--- a/src/tree.c
+++ b/src/tree.c
@@ -117,7 +117,7 @@ static int tree_key_search(git_vector *entries, const char *filename)
}
/* The filename doesn't exist at all */
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
void git_tree__free(git_tree *tree)
@@ -186,7 +186,7 @@ const git_tree_entry *git_tree_entry_byname(git_tree *tree, const char *filename
assert(tree && filename);
idx = tree_key_search(&tree->entries, filename);
- if (idx == GIT_ENOTFOUND)
+ if (idx == GIT_NOTFOUND)
return NULL;
return git_vector_get(&tree->entries, idx);
@@ -518,7 +518,7 @@ int git_treebuilder_insert(git_tree_entry **entry_out, git_treebuilder *bld, con
git_oid_cpy(&entry->oid, id);
entry->attr = attributes;
- if (pos == GIT_ENOTFOUND) {
+ if (pos == GIT_NOTFOUND) {
if (git_vector_insert(&bld->entries, entry) < 0)
return -1;
}
@@ -647,7 +647,7 @@ static int tree_frompath(
{
char *slash_pos = NULL;
const git_tree_entry* entry;
- int error = GIT_SUCCESS;
+ int error = 0;
git_tree *subtree;
if (!*(treeentry_path->ptr + offset)) {
@@ -682,7 +682,7 @@ static int tree_frompath(
giterr_set(GITERR_TREE,
"No tree entry can be found from "
"the given tree and relative path '%s'.", treeentry_path->ptr);
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
@@ -724,7 +724,7 @@ static int tree_walk_post(
git_buf *path,
void *payload)
{
- int error = GIT_SUCCESS;
+ int error = 0;
unsigned int i;
for (i = 0; i < tree->entries.length; ++i) {
@@ -761,7 +761,7 @@ static int tree_walk_post(
int git_tree_walk(git_tree *tree, git_treewalk_cb callback, int mode, void *payload)
{
- int error = GIT_SUCCESS;
+ int error = 0;
git_buf root_path = GIT_BUF_INIT;
switch (mode) {
diff --git a/src/vector.c b/src/vector.c
index 6f9aacccf..6bd1e9311 100644
--- a/src/vector.c
+++ b/src/vector.c
@@ -137,7 +137,7 @@ int git_vector_bsearch3(
if (at_pos != NULL)
*at_pos = (unsigned int)pos;
- return (rval >= 0) ? (int)pos : GIT_ENOTFOUND;
+ return (rval >= 0) ? (int)pos : GIT_NOTFOUND;
}
int git_vector_search2(
@@ -152,7 +152,7 @@ int git_vector_search2(
return i;
}
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
}
static int strict_comparison(const void *a, const void *b)
@@ -172,7 +172,7 @@ int git_vector_remove(git_vector *v, unsigned int idx)
assert(v);
if (idx >= v->length || v->length == 0)
- return GIT_ENOTFOUND;
+ return GIT_NOTFOUND;
for (i = idx; i < v->length - 1; ++i)
v->contents[i] = v->contents[i + 1];