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
35f186b6
Commit
35f186b6
authored
Aug 08, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2506 from libgit2/rb/ignore-pipes-etc
Don't report status on named pipes
parents
8f759ac0
f18234fa
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
9 deletions
+42
-9
src/path.c
+10
-9
tests/repo/iterator.c
+32
-0
No files found.
src/path.c
View file @
35f186b6
...
@@ -1110,28 +1110,29 @@ int git_path_dirload_with_stat(
...
@@ -1110,28 +1110,29 @@ int git_path_dirload_with_stat(
if
((
error
=
git_buf_joinpath
(
&
full
,
full
.
ptr
,
ps
->
path
))
<
0
||
if
((
error
=
git_buf_joinpath
(
&
full
,
full
.
ptr
,
ps
->
path
))
<
0
||
(
error
=
git_path_lstat
(
full
.
ptr
,
&
ps
->
st
))
<
0
)
{
(
error
=
git_path_lstat
(
full
.
ptr
,
&
ps
->
st
))
<
0
)
{
if
(
error
==
GIT_ENOTFOUND
)
{
if
(
error
==
GIT_ENOTFOUND
)
{
giterr_clear
();
/* file was removed between readdir and lstat */
error
=
0
;
git_vector_remove
(
contents
,
i
--
);
git_vector_remove
(
contents
,
i
--
);
continue
;
}
else
{
}
/* Treat the file as unreadable if we get any other error */
/* Treat the file as unreadable if we get any other error */
if
(
error
!=
0
)
{
giterr_clear
();
error
=
0
;
memset
(
&
ps
->
st
,
0
,
sizeof
(
ps
->
st
));
memset
(
&
ps
->
st
,
0
,
sizeof
(
ps
->
st
));
ps
->
st
.
st_mode
=
GIT_FILEMODE_UNREADABLE
;
ps
->
st
.
st_mode
=
GIT_FILEMODE_UNREADABLE
;
continue
;
}
}
break
;
giterr_clear
();
error
=
0
;
continue
;
}
}
if
(
S_ISDIR
(
ps
->
st
.
st_mode
))
{
if
(
S_ISDIR
(
ps
->
st
.
st_mode
))
{
ps
->
path
[
ps
->
path_len
++
]
=
'/'
;
ps
->
path
[
ps
->
path_len
++
]
=
'/'
;
ps
->
path
[
ps
->
path_len
]
=
'\0'
;
ps
->
path
[
ps
->
path_len
]
=
'\0'
;
}
}
else
if
(
!
S_ISREG
(
ps
->
st
.
st_mode
)
&&
!
S_ISLNK
(
ps
->
st
.
st_mode
))
{
/* skip everything but dirs, plain files, and symlinks */
git_vector_remove
(
contents
,
i
--
);
}
}
}
/* sort now that directory suffix is added */
/* sort now that directory suffix is added */
...
...
tests/repo/iterator.c
View file @
35f186b6
...
@@ -960,3 +960,35 @@ void test_repo_iterator__fs_preserves_error(void)
...
@@ -960,3 +960,35 @@ void test_repo_iterator__fs_preserves_error(void)
git_iterator_free
(
i
);
git_iterator_free
(
i
);
}
}
void
test_repo_iterator__skips_fifos_and_such
(
void
)
{
#ifndef GIT_WIN32
git_iterator
*
i
;
const
git_index_entry
*
e
;
g_repo
=
cl_git_sandbox_init
(
"empty_standard_repo"
);
cl_must_pass
(
p_mkdir
(
"empty_standard_repo/dir"
,
0777
));
cl_git_mkfile
(
"empty_standard_repo/file"
,
"not me"
);
cl_assert
(
!
mkfifo
(
"empty_standard_repo/fifo"
,
0777
));
cl_assert
(
!
access
(
"empty_standard_repo/fifo"
,
F_OK
));
cl_git_pass
(
git_iterator_for_filesystem
(
&
i
,
"empty_standard_repo"
,
GIT_ITERATOR_INCLUDE_TREES
|
GIT_ITERATOR_DONT_AUTOEXPAND
,
NULL
,
NULL
));
cl_git_pass
(
git_iterator_advance
(
&
e
,
i
));
/* .git */
cl_assert
(
S_ISDIR
(
e
->
mode
));
cl_git_pass
(
git_iterator_advance
(
&
e
,
i
));
/* dir */
cl_assert
(
S_ISDIR
(
e
->
mode
));
/* skips fifo */
cl_git_pass
(
git_iterator_advance
(
&
e
,
i
));
/* file */
cl_assert
(
S_ISREG
(
e
->
mode
));
cl_assert_equal_i
(
GIT_ITEROVER
,
git_iterator_advance
(
&
e
,
i
));
git_iterator_free
(
i
);
#endif
}
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