Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
a7561e0e
Unverified
Commit
a7561e0e
authored
Feb 27, 2023
by
Edward Thomson
Committed by
GitHub
Feb 27, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6512 from libgit2/ethomson/odb_loose
parents
c0dc97be
59bb933c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
0 deletions
+77
-0
src/libgit2/odb_loose.c
+34
-0
tests/libgit2/odb/backend/loose.c
+43
-0
No files found.
src/libgit2/odb_loose.c
View file @
a7561e0e
...
...
@@ -1204,3 +1204,37 @@ int git_odb__backend_loose(
*
backend_out
=
(
git_odb_backend
*
)
backend
;
return
0
;
}
#ifdef GIT_EXPERIMENTAL_SHA256
int
git_odb_backend_loose
(
git_odb_backend
**
backend_out
,
const
char
*
objects_dir
,
git_odb_backend_loose_options
*
opts
)
{
return
git_odb__backend_loose
(
backend_out
,
objects_dir
,
opts
);
}
#else
int
git_odb_backend_loose
(
git_odb_backend
**
backend_out
,
const
char
*
objects_dir
,
int
compression_level
,
int
do_fsync
,
unsigned
int
dir_mode
,
unsigned
int
file_mode
)
{
git_odb_backend_loose_flag_t
flags
=
0
;
git_odb_backend_loose_options
opts
=
GIT_ODB_BACKEND_LOOSE_OPTIONS_INIT
;
if
(
do_fsync
)
flags
|=
GIT_ODB_BACKEND_LOOSE_FSYNC
;
opts
.
flags
=
flags
;
opts
.
compression_level
=
compression_level
;
opts
.
dir_mode
=
dir_mode
;
opts
.
file_mode
=
file_mode
;
opts
.
oid_type
=
GIT_OID_DEFAULT
;
return
git_odb__backend_loose
(
backend_out
,
objects_dir
,
&
opts
);
}
#endif
tests/libgit2/odb/backend/loose.c
0 → 100644
View file @
a7561e0e
#include "clar_libgit2.h"
#include "repository.h"
#include "odb.h"
#include "backend_helpers.h"
#include "git2/sys/mempack.h"
static
git_repository
*
_repo
;
static
git_odb
*
_odb
;
void
test_odb_backend_loose__initialize
(
void
)
{
git_odb_backend
*
backend
;
cl_fixture_sandbox
(
"testrepo.git"
);
#ifdef GIT_EXPERIMENTAL_SHA256
cl_git_pass
(
git_odb_backend_loose
(
&
backend
,
"testrepo.git/objects"
,
NULL
));
#else
cl_git_pass
(
git_odb_backend_loose
(
&
backend
,
"testrepo.git/objects"
,
0
,
0
,
0
,
0
));
#endif
cl_git_pass
(
git_odb__new
(
&
_odb
,
NULL
));
cl_git_pass
(
git_odb_add_backend
(
_odb
,
backend
,
10
));
cl_git_pass
(
git_repository_wrap_odb
(
&
_repo
,
_odb
));
}
void
test_odb_backend_loose__cleanup
(
void
)
{
git_odb_free
(
_odb
);
git_repository_free
(
_repo
);
cl_fixture_cleanup
(
"testrepo.git"
);
}
void
test_odb_backend_loose__read
(
void
)
{
git_oid
oid
;
git_odb_object
*
obj
;
cl_git_pass
(
git_oid__fromstr
(
&
oid
,
"1385f264afb75a56a5bec74243be9b367ba4ca08"
,
GIT_OID_SHA1
));
cl_git_pass
(
git_odb_read
(
&
obj
,
_odb
,
&
oid
));
git_odb_object_free
(
obj
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment