Commit cbcaf0c0 by schu

Move blob.c to the new error handling

Signed-off-by: schu <schu-github@schulog.org>
parent 40774549
...@@ -62,7 +62,7 @@ int git_blob_create_frombuffer(git_oid *oid, git_repository *repo, const void *b ...@@ -62,7 +62,7 @@ int git_blob_create_frombuffer(git_oid *oid, git_repository *repo, const void *b
git_odb_stream *stream; git_odb_stream *stream;
if ((error = git_odb_open_wstream(&stream, repo->db, len, GIT_OBJ_BLOB)) < GIT_SUCCESS) if ((error = git_odb_open_wstream(&stream, repo->db, len, GIT_OBJ_BLOB)) < GIT_SUCCESS)
return error; return git__rethrow(error, "Failed to create blob. Can't open write stream");
stream->write(stream, buffer, len); stream->write(stream, buffer, len);
...@@ -81,7 +81,7 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat ...@@ -81,7 +81,7 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat
git_odb_stream *stream; git_odb_stream *stream;
if (repo->path_workdir == NULL) if (repo->path_workdir == NULL)
return GIT_ENOTFOUND; return git__throw(GIT_ENOTFOUND, "Failed to create blob. No workdir given");
git__joinpath(full_path, repo->path_workdir, path); git__joinpath(full_path, repo->path_workdir, path);
...@@ -106,7 +106,7 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat ...@@ -106,7 +106,7 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat
if (read_len < 0) { if (read_len < 0) {
gitfo_close(fd); gitfo_close(fd);
stream->free(stream); stream->free(stream);
return GIT_EOSERR; return git__throw(GIT_EOSERR, "Failed to create blob. Can't read full file");
} }
stream->write(stream, buffer, read_len); stream->write(stream, buffer, read_len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment