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
a8b1d515
Commit
a8b1d515
authored
Aug 02, 2018
by
Etienne Samson
Committed by
Patrick Steinhardt
Jun 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
repo: graft shallow roots on open
parent
3c17f229
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
src/repository.c
+24
-0
No files found.
src/repository.c
View file @
a8b1d515
...
@@ -654,6 +654,27 @@ cleanup:
...
@@ -654,6 +654,27 @@ cleanup:
return
error
;
return
error
;
}
}
static
int
load_shallow
(
git_repository
*
repo
)
{
int
error
=
0
;
git_array_oid_t
roots
=
GIT_ARRAY_INIT
;
git_array_oid_t
parents
=
GIT_ARRAY_INIT
;
size_t
i
;
git_oid
*
graft_oid
;
/* Graft shallow roots */
if
((
error
=
git_repository__shallow_roots
(
&
roots
,
repo
))
<
0
)
{
return
error
;
}
git_array_foreach
(
roots
,
i
,
graft_oid
)
{
if
((
error
=
git__graft_register
(
repo
->
grafts
,
graft_oid
,
parents
))
<
0
)
{
return
error
;
}
}
return
0
;
}
int
git_repository_open_bare
(
int
git_repository_open_bare
(
git_repository
**
repo_ptr
,
git_repository
**
repo_ptr
,
const
char
*
bare_path
)
const
char
*
bare_path
)
...
@@ -946,6 +967,9 @@ int git_repository_open_ext(
...
@@ -946,6 +967,9 @@ int git_repository_open_ext(
if
((
error
=
load_grafts
(
repo
))
<
0
)
if
((
error
=
load_grafts
(
repo
))
<
0
)
goto
cleanup
;
goto
cleanup
;
if
((
error
=
load_shallow
(
repo
))
<
0
)
goto
cleanup
;
if
((
flags
&
GIT_REPOSITORY_OPEN_BARE
)
!=
0
)
if
((
flags
&
GIT_REPOSITORY_OPEN_BARE
)
!=
0
)
repo
->
is_bare
=
1
;
repo
->
is_bare
=
1
;
else
{
else
{
...
...
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