diff options
| author | Edward Thomson <ethomson@github.com> | 2016-03-04 01:18:30 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@github.com> | 2016-03-07 10:20:01 -0500 |
| commit | e10144ae57e50798e43515cb469722a4e825c23c (patch) | |
| tree | 7c47bd1660b6323551c23c9e84bc360c6c33d68b /src/pack.c | |
| parent | 785d8c48ea8725691da3c50e7dae8751523d4c30 (diff) | |
| download | libgit2-e10144ae57e50798e43515cb469722a4e825c23c.tar.gz | |
odb: improved not found error messages
When looking up an abbreviated oid, show the actual (abbreviated) oid
the caller passed instead of a full (but ambiguously truncated) oid.
Diffstat (limited to 'src/pack.c')
| -rw-r--r-- | src/pack.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/pack.c b/src/pack.c index 52c652178..e8bde71f3 100644 --- a/src/pack.c +++ b/src/pack.c @@ -1018,7 +1018,7 @@ static int packfile_open(struct git_pack_file *p) unsigned char *idx_sha1; if (p->index_version == -1 && pack_index_open(p) < 0) - return git_odb__error_notfound("failed to open packfile", NULL); + return git_odb__error_notfound("failed to open packfile", NULL, 0); /* if mwf opened by another thread, return now */ if (git_mutex_lock(&p->lock) < 0) @@ -1099,7 +1099,7 @@ int git_packfile__name(char **out, const char *path) path_len = strlen(path); if (path_len < strlen(".idx")) - return git_odb__error_notfound("invalid packfile path", NULL); + return git_odb__error_notfound("invalid packfile path", NULL, 0); if (git_buf_printf(&buf, "%.*s.pack", (int)(path_len - strlen(".idx")), path) < 0) return -1; @@ -1117,7 +1117,7 @@ int git_packfile_alloc(struct git_pack_file **pack_out, const char *path) *pack_out = NULL; if (path_len < strlen(".idx")) - return git_odb__error_notfound("invalid packfile path", NULL); + return git_odb__error_notfound("invalid packfile path", NULL, 0); GITERR_CHECK_ALLOC_ADD(&alloc_len, sizeof(*p), path_len); GITERR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2); @@ -1143,7 +1143,7 @@ int git_packfile_alloc(struct git_pack_file **pack_out, const char *path) if (p_stat(p->pack_name, &st) < 0 || !S_ISREG(st.st_mode)) { git__free(p); - return git_odb__error_notfound("packfile not found", NULL); + return git_odb__error_notfound("packfile not found", NULL, 0); } /* ok, it looks sane as far as we can check without @@ -1344,7 +1344,7 @@ static int pack_entry_find_offset( } if (!found) - return git_odb__error_notfound("failed to find offset for pack entry", short_oid); + return git_odb__error_notfound("failed to find offset for pack entry", short_oid, len); if (found > 1) return git_odb__error_ambiguous("found multiple offsets for pack entry"); |
