Skip to content

Commit 904b67e

Browse files
author
Vicent Martí
committed
errors: Rename error codes
1 parent e172cf0 commit 904b67e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+171
-170
lines changed

examples/diff.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ int resolve_to_tree(git_repository *repo, const char *identifier, git_tree **tre
3636
}
3737

3838
if (obj == NULL)
39-
return GIT_NOTFOUND;
39+
return GIT_ENOTFOUND;
4040

4141
switch (git_object_type(obj)) {
4242
case GIT_OBJ_TREE:
@@ -47,7 +47,7 @@ int resolve_to_tree(git_repository *repo, const char *identifier, git_tree **tre
4747
git_object_free(obj);
4848
break;
4949
default:
50-
err = GIT_NOTFOUND;
50+
err = GIT_ENOTFOUND;
5151
}
5252

5353
return err;

include/git2/branch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ GIT_EXTERN(int) git_branch_create(
6363
* @param branch_type Type of the considered branch. This should
6464
* be valued with either GIT_BRANCH_LOCAL or GIT_BRANCH_REMOTE.
6565
*
66-
* @return 0 on success, GIT_NOTFOUND if the branch
66+
* @return 0 on success, GIT_ENOTFOUND if the branch
6767
* doesn't exist or an error code.
6868
*/
6969
GIT_EXTERN(int) git_branch_delete(
@@ -108,7 +108,7 @@ GIT_EXTERN(int) git_branch_list(
108108
*
109109
* @param force Overwrite existing branch.
110110
*
111-
* @return 0 on success, GIT_NOTFOUND if the branch
111+
* @return 0 on success, GIT_ENOTFOUND if the branch
112112
* doesn't exist or an error code.
113113
*/
114114
GIT_EXTERN(int) git_branch_move(

include/git2/errors.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,13 @@ enum {
5858
enum {
5959
GIT_OK = 0,
6060
GIT_ERROR = -1,
61-
GIT_NOTFOUND = -3,
62-
GIT_EXISTS = -23,
63-
GIT_AMBIGUOUS = -29,
61+
GIT_ENOTFOUND = -3,
62+
GIT_EEXISTS = -4,
63+
GIT_EAMBIGUOUS = -5,
64+
GIT_EBUFS = -6,
65+
6466
GIT_PASSTHROUGH = -30,
65-
GIT_SHORTBUFFER = -32,
66-
GIT_REVWALKOVER = -33,
67+
GIT_REVWALKOVER = -31,
6768
};
6869

6970
typedef struct {

include/git2/odb.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ GIT_EXTERN(void) git_odb_free(git_odb *db);
109109
* @param id identity of the object to read.
110110
* @return
111111
* - 0 if the object was read;
112-
* - GIT_NOTFOUND if the object is not in the database.
112+
* - GIT_ENOTFOUND if the object is not in the database.
113113
*/
114114
GIT_EXTERN(int) git_odb_read(git_odb_object **out, git_odb *db, const git_oid *id);
115115

@@ -136,8 +136,8 @@ GIT_EXTERN(int) git_odb_read(git_odb_object **out, git_odb *db, const git_oid *i
136136
* @param short_id a prefix of the id of the object to read.
137137
* @param len the length of the prefix
138138
* @return 0 if the object was read;
139-
* GIT_NOTFOUND if the object is not in the database.
140-
* GIT_AMBIGUOUS if the prefix is ambiguous (several objects match the prefix)
139+
* GIT_ENOTFOUND if the object is not in the database.
140+
* GIT_EAMBIGUOUS if the prefix is ambiguous (several objects match the prefix)
141141
*/
142142
GIT_EXTERN(int) git_odb_read_prefix(git_odb_object **out, git_odb *db, const git_oid *short_id, unsigned int len);
143143

@@ -157,7 +157,7 @@ GIT_EXTERN(int) git_odb_read_prefix(git_odb_object **out, git_odb *db, const git
157157
* @param id identity of the object to read.
158158
* @return
159159
* - 0 if the object was read;
160-
* - GIT_NOTFOUND if the object is not in the database.
160+
* - GIT_ENOTFOUND if the object is not in the database.
161161
*/
162162
GIT_EXTERN(int) git_odb_read_header(size_t *len_p, git_otype *type_p, git_odb *db, const git_oid *id);
163163

include/git2/refspec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ GIT_EXTERN(int) git_refspec_src_matches(const git_refspec *refspec, const char *
5151
* @param outlen the size ouf the `out` buffer
5252
* @param spec the refspec
5353
* @param name the name of the reference to transform
54-
* @return 0, GIT_SHORTBUFFER or another error
54+
* @return 0, GIT_EBUFS or another error
5555
*/
5656
GIT_EXTERN(int) git_refspec_transform(char *out, size_t outlen, const git_refspec *spec, const char *name);
5757

include/git2/status.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ GIT_EXTERN(int) git_status_foreach_ext(
131131
* @param status_flags the status value
132132
* @param repo a repository object
133133
* @param path the file to retrieve status for, rooted at the repo's workdir
134-
* @return GIT_EINVALIDPATH when `path` points at a folder, GIT_NOTFOUND when
134+
* @return GIT_EINVALIDPATH when `path` points at a folder, GIT_ENOTFOUND when
135135
* the file doesn't exist in any of HEAD, the index or the worktree,
136136
* 0 otherwise
137137
*/

include/git2/submodule.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ GIT_EXTERN(int) git_submodule_foreach(
8585
*
8686
* Given either the submodule name or path (they are ususally the same),
8787
* this returns a structure describing the submodule. If the submodule
88-
* does not exist, this will return GIT_NOTFOUND and set the submodule
88+
* does not exist, this will return GIT_ENOTFOUND and set the submodule
8989
* pointer to NULL.
9090
*
9191
* @param submodule Pointer to submodule description object pointer..
9292
* @param repo The repository.
9393
* @param name The name of the submodule. Trailing slashes will be ignored.
94-
* @return 0 on success, GIT_NOTFOUND if submodule does not exist, -1 on error
94+
* @return 0 on success, GIT_ENOTFOUND if submodule does not exist, -1 on error
9595
*/
9696
GIT_EXTERN(int) git_submodule_lookup(
9797
git_submodule **submodule,

include/git2/tag.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ GIT_EXTERN(const char *) git_tag_message(git_tag *tag);
143143
* @param oid Pointer where to store the OID of the
144144
* newly created tag. If the tag already exists, this parameter
145145
* will be the oid of the existing tag, and the function will
146-
* return a GIT_EXISTS error code.
146+
* return a GIT_EEXISTS error code.
147147
*
148148
* @param repo Repository where to store the tag
149149
*
@@ -199,7 +199,7 @@ GIT_EXTERN(int) git_tag_create_frombuffer(
199199
* @param oid Pointer where to store the OID of the provided
200200
* target object. If the tag already exists, this parameter
201201
* will be filled with the oid of the existing pointed object
202-
* and the function will return a GIT_EXISTS error code.
202+
* and the function will return a GIT_EEXISTS error code.
203203
*
204204
* @param repo Repository where to store the lightweight tag
205205
*

include/git2/tree.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ GIT_EXTERN(int) git_treebuilder_write(git_oid *oid, git_repository *repo, git_tr
278278
* @param subtree Pointer where to store the subtree
279279
* @param root A previously loaded tree which will be the root of the relative path
280280
* @param subtree_path Path to the contained subtree
281-
* @return 0 on success; GIT_NOTFOUND if the path does not lead to a subtree
281+
* @return 0 on success; GIT_ENOTFOUND if the path does not lead to a subtree
282282
*/
283283
GIT_EXTERN(int) git_tree_get_subtree(git_tree **subtree, git_tree *root, const char *subtree_path);
284284

src/attr.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,13 @@ static int load_attr_file(
245245
struct stat st;
246246

247247
if (p_stat(filename, &st) < 0)
248-
return GIT_NOTFOUND;
248+
return GIT_ENOTFOUND;
249249

250250
if (sig != NULL &&
251251
(git_time_t)st.st_mtime == sig->seconds &&
252252
(git_off_t)st.st_size == sig->size &&
253253
(unsigned int)st.st_ino == sig->ino)
254-
return GIT_NOTFOUND;
254+
return GIT_ENOTFOUND;
255255

256256
error = git_futils_readbuffer_updated(&content, filename, NULL, NULL);
257257
if (error < 0)
@@ -286,7 +286,7 @@ static int load_attr_blob_from_index(
286286
entry = git_index_get(index, error);
287287

288288
if (old_oid && git_oid_cmp(old_oid, &entry->oid) == 0)
289-
return GIT_NOTFOUND;
289+
return GIT_ENOTFOUND;
290290

291291
if ((error = git_blob_lookup(blob, repo, &entry->oid)) < 0)
292292
return error;
@@ -396,7 +396,7 @@ int git_attr_cache__push_file(
396396

397397
if (error) {
398398
/* not finding a file is not an error for this function */
399-
if (error == GIT_NOTFOUND) {
399+
if (error == GIT_ENOTFOUND) {
400400
giterr_clear();
401401
error = 0;
402402
}
@@ -550,7 +550,7 @@ static int collect_attr_files(
550550
error = git_futils_find_system_file(&dir, GIT_ATTR_FILE_SYSTEM);
551551
if (!error)
552552
error = push_attr_file(repo, files, NULL, dir.ptr);
553-
else if (error == GIT_NOTFOUND)
553+
else if (error == GIT_ENOTFOUND)
554554
error = 0;
555555
}
556556

@@ -577,11 +577,11 @@ int git_attr_cache__init(git_repository *repo)
577577
return -1;
578578

579579
ret = git_config_get_string(&cache->cfg_attr_file, cfg, GIT_ATTR_CONFIG);
580-
if (ret < 0 && ret != GIT_NOTFOUND)
580+
if (ret < 0 && ret != GIT_ENOTFOUND)
581581
return ret;
582582

583583
ret = git_config_get_string(&cache->cfg_excl_file, cfg, GIT_IGNORE_CONFIG);
584-
if (ret < 0 && ret != GIT_NOTFOUND)
584+
if (ret < 0 && ret != GIT_ENOTFOUND)
585585
return ret;
586586

587587
giterr_clear();

0 commit comments

Comments
 (0)