Introduce GITERR_INDEXER
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
diff --git a/include/git2/errors.h b/include/git2/errors.h
index 0406c16..8563438 100644
--- a/include/git2/errors.h
+++ b/include/git2/errors.h
@@ -62,6 +62,7 @@ typedef enum {
GITERR_NET,
GITERR_TAG,
GITERR_TREE,
+ GITERR_INDEXER,
} git_error_class;
/**
diff --git a/src/indexer.c b/src/indexer.c
index 0baa194..ace09af 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -110,12 +110,12 @@ static int parse_header(struct git_pack_header *hdr, struct git_pack_file *pack)
}
if (hdr->hdr_signature != ntohl(PACK_SIGNATURE)) {
- giterr_set(GITERR_INVALID, "Wrong pack signature");
+ giterr_set(GITERR_INDEXER, "Wrong pack signature");
return -1;
}
if (!pack_version_ok(hdr->hdr_version)) {
- giterr_set(GITERR_INVALID, "Wrong pack version");
+ giterr_set(GITERR_INDEXER, "Wrong pack version");
return -1;
}
@@ -248,7 +248,7 @@ static int hash_and_save(git_indexer_stream *idx, git_rawobj *obj, git_off_t ent
/* FIXME: Parse the object instead of hashing it */
if (git_odb__hashobj(&oid, obj) < 0) {
- giterr_set(GITERR_INVALID, "Failed to hash object");
+ giterr_set(GITERR_INDEXER, "Failed to hash object");
return -1;
}
@@ -583,7 +583,7 @@ int git_indexer_new(git_indexer **out, const char *packname)
assert(out && packname);
if (git_path_root(packname) < 0) {
- giterr_set(GITERR_INVALID, "Path is not absolute");
+ giterr_set(GITERR_INDEXER, "Path is not absolute");
return -1;
}
@@ -815,7 +815,7 @@ int git_indexer_run(git_indexer *idx, git_indexer_stats *stats)
/* FIXME: Parse the object instead of hashing it */
error = git_odb__hashobj(&oid, &obj);
if (error < 0) {
- giterr_set(GITERR_INVALID, "Failed to hash object");
+ giterr_set(GITERR_INDEXER, "Failed to hash object");
goto cleanup;
}