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
6855502c
Commit
6855502c
authored
Dec 15, 2023
by
Kevin Saul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
repo: use empty grafts when directory not found for in-memory repo
parent
b4e84a76
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
src/libgit2/repository.c
+24
-2
No files found.
src/libgit2/repository.c
View file @
6855502c
...
@@ -865,8 +865,30 @@ static int load_grafts(git_repository *repo)
...
@@ -865,8 +865,30 @@ static int load_grafts(git_repository *repo)
git_str
path
=
GIT_STR_INIT
;
git_str
path
=
GIT_STR_INIT
;
int
error
;
int
error
;
if
((
error
=
git_repository__item_path
(
&
path
,
repo
,
GIT_REPOSITORY_ITEM_INFO
))
<
0
||
/* refresh if they've both been opened previously */
(
error
=
git_str_joinpath
(
&
path
,
path
.
ptr
,
"grafts"
))
<
0
||
if
(
repo
->
grafts
&&
repo
->
shallow_grafts
)
{
if
((
error
=
git_grafts_refresh
(
repo
->
grafts
))
<
0
||
(
error
=
git_grafts_refresh
(
repo
->
shallow_grafts
))
<
0
)
return
error
;
}
/* resolve info path, which may not be found for inmemory repository */
if
((
error
=
git_repository__item_path
(
&
path
,
repo
,
GIT_REPOSITORY_ITEM_INFO
))
<
0
)
{
if
(
error
!=
GIT_ENOTFOUND
)
return
error
;
/* create empty/inmemory grafts for inmemory repository */
if
(
!
repo
->
grafts
&&
(
error
=
git_grafts_new
(
&
repo
->
grafts
,
repo
->
oid_type
))
<
0
)
return
error
;
if
(
!
repo
->
shallow_grafts
&&
(
error
=
git_grafts_new
(
&
repo
->
shallow_grafts
,
repo
->
oid_type
))
<
0
)
return
error
;
return
0
;
}
/* load grafts from disk */
if
((
error
=
git_str_joinpath
(
&
path
,
path
.
ptr
,
"grafts"
))
<
0
||
(
error
=
git_grafts_open_or_refresh
(
&
repo
->
grafts
,
path
.
ptr
,
repo
->
oid_type
))
<
0
)
(
error
=
git_grafts_open_or_refresh
(
&
repo
->
grafts
,
path
.
ptr
,
repo
->
oid_type
))
<
0
)
goto
error
;
goto
error
;
...
...
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