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
161d8a12
Commit
161d8a12
authored
May 05, 2023
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sha256: wrap_odb supports SHA256
parent
f1ef8ebe
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
7 deletions
+41
-7
include/git2/repository.h
+11
-1
src/libgit2/repository.c
+21
-3
src/libgit2/repository.h
+5
-0
tests/libgit2/odb/backend/loose.c
+1
-1
tests/libgit2/odb/backend/mempack.c
+1
-1
tests/libgit2/refs/iterator.c
+2
-1
No files found.
include/git2/repository.h
View file @
161d8a12
...
...
@@ -56,9 +56,19 @@ GIT_EXTERN(int) git_repository_open_from_worktree(git_repository **out, git_work
*
* @param out pointer to the repo
* @param odb the object database to wrap
* @param oid_type the oid type of the object database
* @return 0 or an error code
*/
GIT_EXTERN
(
int
)
git_repository_wrap_odb
(
git_repository
**
out
,
git_odb
*
odb
);
#ifdef GIT_EXPERIMENTAL_SHA256
GIT_EXTERN
(
int
)
git_repository_wrap_odb
(
git_repository
**
out
,
git_odb
*
odb
,
git_oid_t
oid_type
);
#else
GIT_EXTERN
(
int
)
git_repository_wrap_odb
(
git_repository
**
out
,
git_odb
*
odb
);
#endif
/**
* Look for a git repository and copy its path in the given buffer.
...
...
src/libgit2/repository.c
View file @
161d8a12
...
...
@@ -1145,21 +1145,39 @@ out:
return
err
;
}
int
git_repository_wrap_odb
(
git_repository
**
repo_out
,
git_odb
*
odb
)
int
git_repository__wrap_odb
(
git_repository
**
out
,
git_odb
*
odb
,
git_oid_t
oid_type
)
{
git_repository
*
repo
;
repo
=
repository_alloc
();
GIT_ERROR_CHECK_ALLOC
(
repo
);
repo
->
oid_type
=
GIT_OID_DEFAULT
;
repo
->
oid_type
=
oid_type
;
git_repository_set_odb
(
repo
,
odb
);
*
repo_
out
=
repo
;
*
out
=
repo
;
return
0
;
}
#ifdef GIT_EXPERIMENTAL_SHA256
int
git_repository_wrap_odb
(
git_repository
**
out
,
git_odb
*
odb
,
git_oid_t
oid_type
)
{
return
git_repository__wrap_odb
(
out
,
odb
,
oid_type
);
}
#else
int
git_repository_wrap_odb
(
git_repository
**
out
,
git_odb
*
odb
)
{
return
git_repository__wrap_odb
(
out
,
odb
,
GIT_OID_DEFAULT
);
}
#endif
int
git_repository_discover
(
git_buf
*
out
,
const
char
*
start_path
,
...
...
src/libgit2/repository.h
View file @
161d8a12
...
...
@@ -190,6 +190,11 @@ int git_repository_odb__weakptr(git_odb **out, git_repository *repo);
int
git_repository_refdb__weakptr
(
git_refdb
**
out
,
git_repository
*
repo
);
int
git_repository_index__weakptr
(
git_index
**
out
,
git_repository
*
repo
);
int
git_repository__wrap_odb
(
git_repository
**
out
,
git_odb
*
odb
,
git_oid_t
oid_type
);
/*
* Configuration map cache
*
...
...
tests/libgit2/odb/backend/loose.c
View file @
161d8a12
...
...
@@ -21,7 +21,7 @@ void test_odb_backend_loose__initialize(void)
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
));
cl_git_pass
(
git_repository_
_wrap_odb
(
&
_repo
,
_odb
,
GIT_OID_SHA1
));
}
void
test_odb_backend_loose__cleanup
(
void
)
...
...
tests/libgit2/odb/backend/mempack.c
View file @
161d8a12
...
...
@@ -16,7 +16,7 @@ void test_odb_backend_mempack__initialize(void)
cl_git_pass
(
git_mempack_new
(
&
backend
));
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
));
cl_git_pass
(
git_repository_
_wrap_odb
(
&
_repo
,
_odb
,
GIT_OID_SHA1
));
}
void
test_odb_backend_mempack__cleanup
(
void
)
...
...
tests/libgit2/refs/iterator.c
View file @
161d8a12
...
...
@@ -2,6 +2,7 @@
#include "refs.h"
#include "vector.h"
#include "odb.h"
#include "repository.h"
static
git_repository
*
repo
;
...
...
@@ -128,7 +129,7 @@ void test_refs_iterator__empty(void)
git_repository
*
empty
;
cl_git_pass
(
git_odb__new
(
&
odb
,
NULL
));
cl_git_pass
(
git_repository_
wrap_odb
(
&
empty
,
odb
));
cl_git_pass
(
git_repository_
_wrap_odb
(
&
empty
,
odb
,
GIT_OID_SHA1
));
cl_git_pass
(
git_reference_iterator_new
(
&
iter
,
empty
));
cl_assert_equal_i
(
GIT_ITEROVER
,
git_reference_next
(
&
ref
,
iter
));
...
...
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