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
def644e4
Commit
def644e4
authored
Jan 01, 2017
by
lhchavez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test
parent
db535d0a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
tests/pack/indexer.c
+40
-0
No files found.
tests/pack/indexer.c
View file @
def644e4
...
...
@@ -125,3 +125,43 @@ void test_pack_indexer__fix_thin(void)
git_indexer_free
(
idx
);
}
}
static
int
find_tmp_file_recurs
(
void
*
opaque
,
git_buf
*
path
)
{
int
error
=
0
;
git_buf
*
first_tmp_file
=
opaque
;
struct
stat
st
;
if
((
error
=
p_lstat_posixly
(
path
->
ptr
,
&
st
))
<
0
)
return
error
;
if
(
S_ISDIR
(
st
.
st_mode
))
return
git_path_direach
(
path
,
0
,
find_tmp_file_recurs
,
opaque
);
/* This is the template that's used in git_futils_mktmp. */
if
(
strstr
(
git_buf_cstr
(
path
),
"_git2_"
)
!=
NULL
)
return
git_buf_sets
(
first_tmp_file
,
git_buf_cstr
(
path
));
return
0
;
}
void
test_pack_indexer__no_tmp_files
(
void
)
{
git_indexer
*
idx
=
NULL
;
git_buf
path
=
GIT_BUF_INIT
;
git_buf
first_tmp_file
=
GIT_BUF_INIT
;
/* Precondition: there are no temporary files. */
cl_git_pass
(
git_buf_sets
(
&
path
,
clar_sandbox_path
()));
cl_git_pass
(
find_tmp_file_recurs
(
&
first_tmp_file
,
&
path
));
if
(
git_buf_is_allocated
(
&
first_tmp_file
))
{
cl_warning
(
"Found a temporary file before running the test"
);
cl_skip
();
}
cl_git_pass
(
git_indexer_new
(
&
idx
,
"."
,
0
,
NULL
,
NULL
,
NULL
));
git_indexer_free
(
idx
);
cl_git_pass
(
find_tmp_file_recurs
(
&
first_tmp_file
,
&
path
));
cl_check
(
!
git_buf_is_allocated
(
&
first_tmp_file
));
}
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