diff options
author | Russell Belfer <rb@github.com> | 2014-04-29 03:47:39 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2014-05-02 20:21:33 +0400 |
commit | 225aab5d6a611076b22f00ae5a28184d92b5259c (patch) | |
tree | 1ec844253f1a3809ebf27465554366011dfdda7a /tests | |
parent | cd424ad5518c7cfbba10a764d7bc097377ec3995 (diff) |
Don't use trace if GIT_TRACE not defined
Diffstat (limited to 'tests')
-rw-r--r-- | tests/diff/workdir.c | 8 | ||||
-rw-r--r-- | tests/status/worktree.c | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tests/diff/workdir.c b/tests/diff/workdir.c index a225ebc89..0fd41d3e0 100644 --- a/tests/diff/workdir.c +++ b/tests/diff/workdir.c @@ -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)); diff --git a/tests/status/worktree.c b/tests/status/worktree.c index 0b94fb1a0..c1d6be982 100644 --- a/tests/status/worktree.c +++ b/tests/status/worktree.c @@ -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 } /** |