Commit 8af4d074 by Vicent Marti

odb: Let users decide compression level for the loose ODB

parent 72bdfdbc
......@@ -93,7 +93,7 @@ typedef enum {
} git_odb_streammode;
GIT_EXTERN(int) git_odb_backend_pack(git_odb_backend **backend_out, const char *objects_dir);
GIT_EXTERN(int) git_odb_backend_loose(git_odb_backend **backend_out, const char *objects_dir);
GIT_EXTERN(int) git_odb_backend_loose(git_odb_backend **backend_out, const char *objects_dir, int compression_level, int do_fsync);
GIT_END_DECL
......
......@@ -321,7 +321,7 @@ static int add_default_backends(git_odb *db, const char *objects_dir, int as_alt
int error;
/* add the loose object backend */
error = git_odb_backend_loose(&loose, objects_dir);
error = git_odb_backend_loose(&loose, objects_dir, -1, 0);
if (error < GIT_SUCCESS)
return error;
......
......@@ -807,7 +807,11 @@ static void loose_backend__free(git_odb_backend *_backend)
free(backend);
}
int git_odb_backend_loose(git_odb_backend **backend_out, const char *objects_dir)
int git_odb_backend_loose(
git_odb_backend **backend_out,
const char *objects_dir,
int compression_level,
int do_fsync)
{
loose_backend *backend;
......@@ -821,8 +825,11 @@ int git_odb_backend_loose(git_odb_backend **backend_out, const char *objects_dir
return GIT_ENOMEM;
}
backend->object_zlib_level = Z_BEST_SPEED;
backend->fsync_object_files = 0;
if (compression_level < 0)
compression_level = Z_BEST_SPEED;
backend->object_zlib_level = compression_level;
backend->fsync_object_files = do_fsync;
backend->parent.read = &loose_backend__read;
backend->parent.write = &loose_backend__write;
......
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