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
b5abb881
Commit
b5abb881
authored
Mar 15, 2011
by
Vicent Marti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not segfault when listing unpacked references
parent
d40d30cb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
1 deletions
+21
-1
src/refs.c
+2
-1
tests/t10-refs.c
+19
-0
No files found.
src/refs.c
View file @
b5abb881
...
...
@@ -560,7 +560,8 @@ static int _dirent_loose_listall(void *_data, char *full_path)
return
gitfo_dirent
(
full_path
,
GIT_PATH_MAX
,
_dirent_loose_listall
,
_data
);
/* do not add twice a reference that exists already in the packfile */
if
(
git_hashtable_lookup
(
data
->
repo
->
references
.
packfile
,
file_path
)
!=
NULL
)
if
((
data
->
list_flags
&
GIT_REF_PACKED
)
!=
0
&&
git_hashtable_lookup
(
data
->
repo
->
references
.
packfile
,
file_path
)
!=
NULL
)
return
GIT_SUCCESS
;
if
((
data
->
list_flags
&
loose_guess_rtype
(
full_path
))
==
0
)
...
...
tests/t10-refs.c
View file @
b5abb881
...
...
@@ -717,6 +717,12 @@ BEGIN_TEST(list0, "try to list all the references in our test repo")
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
must_pass
(
git_reference_listall
(
&
ref_list
,
repo
,
GIT_REF_LISTALL
));
/*{
unsigned short i;
for (i = 0; i < ref_list.count; ++i)
printf("# %s\n", ref_list.strings[i]);
}*/
/* We have exactly 7 refs in total if we include the packed ones:
* there is a reference that exists both in the packfile and as
* loose, but we only list it once */
...
...
@@ -726,6 +732,18 @@ BEGIN_TEST(list0, "try to list all the references in our test repo")
git_repository_free
(
repo
);
END_TEST
BEGIN_TEST
(
list1
,
"try to list only the symbolic references"
)
git_repository
*
repo
;
git_strarray
ref_list
;
must_pass
(
git_repository_open
(
&
repo
,
REPOSITORY_FOLDER
));
must_pass
(
git_reference_listall
(
&
ref_list
,
repo
,
GIT_REF_SYMBOLIC
));
must_be_true
(
ref_list
.
count
==
0
);
/* no symrefs in the test repo */
git_strarray_free
(
&
ref_list
);
git_repository_free
(
repo
);
END_TEST
BEGIN_SUITE
(
refs
)
ADD_TEST
(
readtag0
);
...
...
@@ -758,4 +776,5 @@ BEGIN_SUITE(refs)
ADD_TEST
(
delete0
);
ADD_TEST
(
list0
);
ADD_TEST
(
list1
);
END_SUITE
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