summaryrefslogtreecommitdiff
path: root/progress.c
diff options
context:
space:
mode:
authorDerrick Stolee <dstolee@microsoft.com>2020-05-15 16:09:28 (GMT)
committerJunio C Hamano <gitster@pobox.com>2020-05-15 16:41:30 (GMT)
commit3af029c484fc72f546078966af538db55933e83d (patch)
tree1d529ad61afc44e3b578b7a6c13a487867044186 /progress.c
parent98a136474082cdc7228d7e0e45672c5274fab701 (diff)
downloadgit-3af029c484fc72f546078966af538db55933e83d.zip
git-3af029c484fc72f546078966af538db55933e83d.tar.gz
git-3af029c484fc72f546078966af538db55933e83d.tar.bz2
progress: call trace2_region_leave() only after calling _enter()
A user of progress API calls start_progress() conditionally and depends on the display_progress() and stop_progress() functions to become no-op when start_progress() hasn't been called. As we added a call to trace2_region_enter() to start_progress(), the calls to other trace2 API calls from the progress API functions must make sure that these trace2 calls are skipped when start_progress() hasn't been called on the progress struct. Specifically, do not call trace2_region_leave() from stop_progress() when we haven't called start_progress(), which would have called the matching trace2_region_enter(). Signed-off-by: Derrick Stolee <dstolee@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'progress.c')
-rw-r--r--progress.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/progress.c b/progress.c
index 6d2dcff..3eda914 100644
--- a/progress.c
+++ b/progress.c
@@ -329,13 +329,9 @@ void stop_progress(struct progress **p_progress)
trace2_data_intmax("progress", the_repository,
"total_bytes",
(*p_progress)->throughput->curr_total);
- }
- trace2_region_leave("progress",
- p_progress && *p_progress
- ? (*p_progress)->title
- : NULL,
- the_repository);
+ trace2_region_leave("progress", (*p_progress)->title, the_repository);
+ }
stop_progress_msg(p_progress, _("done"));
}