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
0362ecd6
Unverified
Commit
0362ecd6
authored
Feb 14, 2023
by
Edward Thomson
Committed by
GitHub
Feb 14, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6423 from cavaquinho/fix/6422-revwalk_push_glob-dangling-ref
#6422: handle dangling symbolic refs gracefully
parents
3b43c9d3
b57221e8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletions
+22
-1
src/libgit2/revwalk.c
+5
-1
tests/libgit2/revwalk/basic.c
+17
-0
No files found.
src/libgit2/revwalk.c
View file @
0362ecd6
...
...
@@ -121,8 +121,12 @@ int git_revwalk__push_ref(git_revwalk *walk, const char *refname, const git_revw
{
git_oid
oid
;
if
(
git_reference_name_to_id
(
&
oid
,
walk
->
repo
,
refname
)
<
0
)
int
error
=
git_reference_name_to_id
(
&
oid
,
walk
->
repo
,
refname
);
if
(
opts
->
from_glob
&&
(
error
==
GIT_ENOTFOUND
||
error
==
GIT_EINVALIDSPEC
||
error
==
GIT_EPEEL
))
{
return
0
;
}
else
if
(
error
<
0
)
{
return
-
1
;
}
return
git_revwalk__push_commit
(
walk
,
&
oid
,
opts
);
}
...
...
tests/libgit2/revwalk/basic.c
View file @
0362ecd6
...
...
@@ -180,6 +180,23 @@ void test_revwalk_basic__glob_heads_with_invalid(void)
cl_assert_equal_i
(
20
,
i
);
}
void
test_revwalk_basic__glob_invalid_symbolic_ref
(
void
)
{
int
i
;
git_oid
oid
;
revwalk_basic_setup_walk
(
"testrepo"
);
cl_git_mkfile
(
"testrepo/.git/refs/heads/broken-sym-ref"
,
"ref: refs/heads/does-not-exist"
);
cl_git_pass
(
git_revwalk_push_glob
(
_walk
,
"heads"
));
for
(
i
=
0
;
!
git_revwalk_next
(
&
oid
,
_walk
);
++
i
)
/* walking */
;
/* git log --branches --oneline | wc -l => 16 */
cl_assert_equal_i
(
20
,
i
);
}
void
test_revwalk_basic__push_head
(
void
)
{
int
i
=
0
;
...
...
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