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
225aab5d
Commit
225aab5d
authored
Apr 28, 2014
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't use trace if GIT_TRACE not defined
parent
cd424ad5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
tests/diff/workdir.c
+8
-0
tests/status/worktree.c
+6
-0
No files found.
tests/diff/workdir.c
View file @
225aab5d
...
...
@@ -5,6 +5,7 @@
static
git_repository
*
g_repo
=
NULL
;
#ifdef GIT_TRACE
static
struct
{
size_t
stat_calls
;
size_t
oid_calcs
;
...
...
@@ -27,17 +28,22 @@ static void add_stats(git_trace_level_t level, const char *msg)
else
if
(
!
strncmp
(
"oid_calculation"
,
msg
,
(
assign
-
msg
)))
g_diff_perf
.
oid_calcs
+=
atoi
(
assign
+
1
);
}
#endif
void
test_diff_workdir__initialize
(
void
)
{
#ifdef GIT_TRACE
memset
(
&
g_diff_perf
,
0
,
sizeof
(
g_diff_perf
));
cl_git_pass
(
git_trace_set
(
GIT_TRACE_TRACE
,
add_stats
));
#endif
}
void
test_diff_workdir__cleanup
(
void
)
{
cl_git_sandbox_cleanup
();
#ifdef GIT_TRACE
cl_git_pass
(
git_trace_set
(
0
,
NULL
));
#endif
}
void
test_diff_workdir__to_index
(
void
)
...
...
@@ -1547,7 +1553,9 @@ static void basic_diff_status(git_diff **out, const git_diff_options *opts)
{
diff_expects
exp
;
#ifdef GIT_TRACE
memset
(
&
g_diff_perf
,
0
,
sizeof
(
g_diff_perf
));
#endif
cl_git_pass
(
git_diff_index_to_workdir
(
out
,
g_repo
,
NULL
,
opts
));
...
...
tests/status/worktree.c
View file @
225aab5d
...
...
@@ -7,6 +7,7 @@
#include "path.h"
#include <git2/trace.h>
#ifdef GIT_TRACE
static
struct
{
size_t
stat_calls
;
size_t
oid_calcs
;
...
...
@@ -29,11 +30,14 @@ static void add_stats(git_trace_level_t level, const char *msg)
else
if
(
!
strncmp
(
"oid_calculation"
,
msg
,
(
assign
-
msg
)))
g_diff_perf
.
oid_calcs
+=
atoi
(
assign
+
1
);
}
#endif
void
test_status_worktree__initialize
(
void
)
{
#ifdef GIT_TRACE
memset
(
&
g_diff_perf
,
0
,
sizeof
(
g_diff_perf
));
cl_git_pass
(
git_trace_set
(
GIT_TRACE_TRACE
,
add_stats
));
#endif
}
/**
...
...
@@ -45,7 +49,9 @@ void test_status_worktree__initialize(void)
void
test_status_worktree__cleanup
(
void
)
{
cl_git_sandbox_cleanup
();
#ifdef GIT_TRACE
cl_git_pass
(
git_trace_set
(
0
,
NULL
));
#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