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
70341b09
Commit
70341b09
authored
Sep 14, 2012
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #937 from nulltoken/fix/issue_936
refs: prevent locked refs from being enumerated
parents
b200a813
c2948c77
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
0 deletions
+19
-0
src/refs.c
+4
-0
tests-clar/refs/list.c
+15
-0
No files found.
src/refs.c
View file @
70341b09
...
...
@@ -494,6 +494,10 @@ static int _dirent_loose_listall(void *_data, git_buf *full_path)
return
0
;
/* we are filtering out this reference */
}
/* Locked references aren't returned */
if
(
!
git__suffixcmp
(
file_path
,
GIT_FILELOCK_EXTENSION
))
return
0
;
if
(
data
->
callback
(
file_path
,
data
->
callback_payload
))
data
->
callback_error
=
GIT_EUSER
;
...
...
tests-clar/refs/list.c
View file @
70341b09
...
...
@@ -51,3 +51,18 @@ void test_refs_list__symbolic_only(void)
git_strarray_free
(
&
ref_list
);
}
void
test_refs_list__do_not_retrieve_references_which_name_end_with_a_lock_extension
(
void
)
{
git_strarray
ref_list
;
/* Create a fake locked reference */
cl_git_mkfile
(
"./testrepo/.git/refs/heads/hanwen.lock"
,
"144344043ba4d4a405da03de3844aa829ae8be0e
\n
"
);
cl_git_pass
(
git_reference_list
(
&
ref_list
,
g_repo
,
GIT_REF_LISTALL
));
cl_assert_equal_i
((
int
)
ref_list
.
count
,
10
);
git_strarray_free
(
&
ref_list
);
}
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