mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-05 17:12:51 +00:00
odb: Let users decide compression level for the loose ODB
This commit is contained in:
parent
72bdfdbc7c
commit
8af4d074cc
@ -93,7 +93,7 @@ typedef enum {
|
|||||||
} git_odb_streammode;
|
} 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_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
|
GIT_END_DECL
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ static int add_default_backends(git_odb *db, const char *objects_dir, int as_alt
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
/* add the loose object backend */
|
/* 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)
|
if (error < GIT_SUCCESS)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
@ -807,7 +807,11 @@ static void loose_backend__free(git_odb_backend *_backend)
|
|||||||
free(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;
|
loose_backend *backend;
|
||||||
|
|
||||||
@ -821,8 +825,11 @@ int git_odb_backend_loose(git_odb_backend **backend_out, const char *objects_dir
|
|||||||
return GIT_ENOMEM;
|
return GIT_ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
backend->object_zlib_level = Z_BEST_SPEED;
|
if (compression_level < 0)
|
||||||
backend->fsync_object_files = 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.read = &loose_backend__read;
|
||||||
backend->parent.write = &loose_backend__write;
|
backend->parent.write = &loose_backend__write;
|
||||||
|
Loading…
Reference in New Issue
Block a user