diff options
| author | Russell Belfer <rb@github.com> | 2012-05-04 16:46:46 -0700 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2012-05-04 16:46:46 -0700 |
| commit | 282283acc65bab9de231a2b3dc489eb171d5f1cf (patch) | |
| tree | 402e4a5699e5d2182b542e0eb2468f564951094f /src/odb.c | |
| parent | 3ec1fa5e1c0ee0e151a44267fa6496ecdf604eb9 (diff) | |
| download | libgit2-282283acc65bab9de231a2b3dc489eb171d5f1cf.tar.gz | |
Fix valgrind issues
There are three changes here:
- correctly propogate error code from failed object lookups
- make zlib inflate use our allocators
- add OID to notfound error in ODB lookups
Diffstat (limited to 'src/odb.c')
| -rw-r--r-- | src/odb.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -589,7 +589,7 @@ int git_odb_read_prefix( } if (found == 0) - return git_odb__error_notfound("no match for prefix"); + return git_odb__error_notfound("no match for prefix", short_id); if (found > 1) return git_odb__error_ambiguous("multiple matches for prefix"); @@ -684,9 +684,15 @@ int git_odb_open_rstream(git_odb_stream **stream, git_odb *db, const git_oid *oi return error; } -int git_odb__error_notfound(const char *message) +int git_odb__error_notfound(const char *message, const git_oid *oid) { - giterr_set(GITERR_ODB, "Object not found - %s", message); + if (oid != NULL) { + char oid_str[GIT_OID_HEXSZ + 1]; + git_oid_tostr(oid_str, sizeof(oid_str), oid); + giterr_set(GITERR_ODB, "Object not found - %s (%s)", message, oid_str); + } else + giterr_set(GITERR_ODB, "Object not found - %s", message); + return GIT_ENOTFOUND; } |
