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
55f6f21b
Commit
55f6f21b
authored
Nov 29, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deploy versioned git_odb_backend structure
parent
ca901e7b
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
2 deletions
+20
-2
src/odb.c
+15
-0
src/odb_loose.c
+1
-0
src/odb_pack.c
+2
-0
tests-clar/odb/sorting.c
+2
-2
No files found.
src/odb.c
View file @
55f6f21b
...
...
@@ -363,12 +363,27 @@ int git_odb_new(git_odb **out)
return
0
;
}
static
bool
backend_has_valid_version
(
git_odb_backend
*
backend
)
{
if
(
!
backend
)
return
true
;
if
(
backend
->
version
>
0
&&
backend
->
version
<=
GIT_ODB_BACKEND_VERSION
)
return
true
;
giterr_set
(
GITERR_INVALID
,
"Invalid version %d on git_odb_backend"
,
backend
->
version
);
return
false
;
}
static
int
add_backend_internal
(
git_odb
*
odb
,
git_odb_backend
*
backend
,
int
priority
,
int
is_alternate
)
{
backend_internal
*
internal
;
assert
(
odb
&&
backend
);
if
(
!
backend_has_valid_version
(
backend
))
return
-
1
;
/* Check if the backend is already owned by another ODB */
assert
(
!
backend
->
odb
||
backend
->
odb
==
odb
);
...
...
src/odb_loose.c
View file @
55f6f21b
...
...
@@ -915,6 +915,7 @@ int git_odb_backend_loose(
backend
=
git__calloc
(
1
,
sizeof
(
loose_backend
));
GITERR_CHECK_ALLOC
(
backend
);
backend
->
parent
.
version
=
GIT_ODB_BACKEND_VERSION
;
backend
->
objects_dir
=
git__strdup
(
objects_dir
);
GITERR_CHECK_ALLOC
(
backend
->
objects_dir
);
...
...
src/odb_pack.c
View file @
55f6f21b
...
...
@@ -570,6 +570,7 @@ int git_odb_backend_one_pack(git_odb_backend **backend_out, const char *idx)
backend
=
git__calloc
(
1
,
sizeof
(
struct
pack_backend
));
GITERR_CHECK_ALLOC
(
backend
);
backend
->
parent
.
version
=
GIT_ODB_BACKEND_VERSION
;
if
(
git_vector_init
(
&
backend
->
packs
,
1
,
NULL
)
<
0
)
goto
on_error
;
...
...
@@ -602,6 +603,7 @@ int git_odb_backend_pack(git_odb_backend **backend_out, const char *objects_dir)
backend
=
git__calloc
(
1
,
sizeof
(
struct
pack_backend
));
GITERR_CHECK_ALLOC
(
backend
);
backend
->
parent
.
version
=
GIT_ODB_BACKEND_VERSION
;
if
(
git_vector_init
(
&
backend
->
packs
,
8
,
packfile_sort__cb
)
<
0
||
git_buf_joinpath
(
&
path
,
objects_dir
,
"pack"
)
<
0
)
...
...
tests-clar/odb/sorting.c
View file @
55f6f21b
...
...
@@ -11,11 +11,11 @@ static git_odb_backend *new_backend(int position)
{
fake_backend
*
b
;
b
=
git__
malloc
(
sizeof
(
fake_backend
));
b
=
git__
calloc
(
1
,
sizeof
(
fake_backend
));
if
(
b
==
NULL
)
return
NULL
;
memset
(
b
,
0x0
,
sizeof
(
fake_backend
))
;
b
->
base
.
version
=
GIT_ODB_BACKEND_VERSION
;
b
->
position
=
position
;
return
(
git_odb_backend
*
)
b
;
}
...
...
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