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
48273490
Commit
48273490
authored
Apr 22, 2023
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shallow: use GIT_ASSERT (not assert)
parent
6cec01b4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
11 deletions
+13
-11
src/libgit2/grafts.c
+7
-6
src/libgit2/repository.c
+6
-5
No files found.
src/libgit2/grafts.c
View file @
48273490
...
...
@@ -75,7 +75,8 @@ void git_grafts_clear(git_grafts *grafts)
{
git_commit_graft
*
graft
;
assert
(
grafts
);
if
(
!
grafts
)
return
;
git_oidmap_foreach_value
(
grafts
->
commits
,
graft
,
{
git__free
(
graft
->
parents
.
ptr
);
...
...
@@ -90,7 +91,7 @@ int git_grafts_refresh(git_grafts *grafts)
git_str
contents
=
GIT_STR_INIT
;
int
error
,
updated
=
0
;
assert
(
grafts
);
GIT_ASSERT_ARG
(
grafts
);
if
(
!
grafts
->
path
)
return
0
;
...
...
@@ -168,7 +169,7 @@ int git_grafts_add(git_grafts *grafts, const git_oid *oid, git_array_oid_t paren
int
error
;
size_t
i
;
assert
(
grafts
&&
oid
);
GIT_ASSERT_ARG
(
grafts
&&
oid
);
graft
=
git__calloc
(
1
,
sizeof
(
*
graft
));
GIT_ERROR_CHECK_ALLOC
(
graft
);
...
...
@@ -200,7 +201,7 @@ int git_grafts_remove(git_grafts *grafts, const git_oid *oid)
git_commit_graft
*
graft
;
int
error
;
assert
(
grafts
&&
oid
);
GIT_ASSERT_ARG
(
grafts
&&
oid
);
if
((
graft
=
git_oidmap_get
(
grafts
->
commits
,
oid
))
==
NULL
)
return
GIT_ENOTFOUND
;
...
...
@@ -216,7 +217,7 @@ int git_grafts_remove(git_grafts *grafts, const git_oid *oid)
int
git_grafts_get
(
git_commit_graft
**
out
,
git_grafts
*
grafts
,
const
git_oid
*
oid
)
{
assert
(
out
&&
grafts
&&
oid
);
GIT_ASSERT_ARG
(
out
&&
grafts
&&
oid
);
if
((
*
out
=
git_oidmap_get
(
grafts
->
commits
,
oid
))
==
NULL
)
return
GIT_ENOTFOUND
;
return
0
;
...
...
@@ -228,7 +229,7 @@ int git_grafts_get_oids(git_array_oid_t *out, git_grafts *grafts)
size_t
i
=
0
;
int
error
;
assert
(
out
&&
grafts
);
GIT_ASSERT_ARG
(
out
&&
grafts
);
while
((
error
=
git_oidmap_iterate
(
NULL
,
grafts
->
commits
,
&
i
,
&
oid
))
==
0
)
{
git_oid
*
cpy
=
git_array_alloc
(
*
out
);
...
...
src/libgit2/repository.c
View file @
48273490
...
...
@@ -1613,14 +1613,16 @@ int git_repository_set_index(git_repository *repo, git_index *index)
int
git_repository_grafts__weakptr
(
git_grafts
**
out
,
git_repository
*
repo
)
{
assert
(
out
&&
repo
&&
repo
->
grafts
);
GIT_ASSERT_ARG
(
out
&&
repo
);
GIT_ASSERT
(
repo
->
grafts
);
*
out
=
repo
->
grafts
;
return
0
;
}
int
git_repository_shallow_grafts__weakptr
(
git_grafts
**
out
,
git_repository
*
repo
)
{
assert
(
out
&&
repo
&&
repo
->
shallow_grafts
);
GIT_ASSERT_ARG
(
out
&&
repo
);
GIT_ASSERT
(
repo
->
shallow_grafts
);
*
out
=
repo
->
shallow_grafts
;
return
0
;
}
...
...
@@ -3672,7 +3674,7 @@ int git_repository__shallow_roots_write(git_repository *repo, git_array_oid_t ro
git_oid
*
oid
;
int
filebuf_hash
,
error
=
0
;
assert
(
repo
);
GIT_ASSERT_ARG
(
repo
);
filebuf_hash
=
git_filebuf_hash_flags
(
git_oid_algorithm
(
GIT_OID_SHA1
));
GIT_ASSERT
(
filebuf_hash
);
...
...
@@ -3695,9 +3697,8 @@ int git_repository__shallow_roots_write(git_repository *repo, git_array_oid_t ro
goto
on_error
;
}
if
(
git_array_size
(
roots
)
==
0
)
{
if
(
git_array_size
(
roots
)
==
0
)
remove
(
path
.
ptr
);
}
on_error:
git_str_dispose
(
&
path
);
...
...
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