mirror of
https://github.com/git/git.git
synced 2024-11-23 18:05:29 +08:00
74900a6b35
Fix a bug that's been with us ever since98a1364740
(trace2: log progress time and throughput, 2020-05-12), when the stop_progress_msg() API was used we didn't log a "region_leave" for the "region_enter" we start in "start_progress_delay()". The only user of the "stop_progress_msg()" function is "index-pack". Let's add a previously failing test to check that we have the same number of "region_enter" and "region_leave" events, with "-v" we'll log progress even in the test environment. In addition to that we've had a submarine bug here introduced with9d81ecb52b
(progress: add sparse mode to force 100% complete message, 2019-03-21). The "start_sparse_progress()" API would only do the right thing if the progress was ended with "stop_progress()", not "stop_progress_msg()". The only user of that API uses "stop_progress()", but let's still fix that along with the trace2 issue by making "stop_progress()" a trivial wrapper for "stop_progress_msg()". We can also drop the "if (progress)" test from "finish_if_sparse()". It's now a helper for the small "stop_progress_msg()" function. We'll already have returned from it if "progress" is "NULL". Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
28 lines
852 B
C
28 lines
852 B
C
#ifndef PROGRESS_H
|
|
#define PROGRESS_H
|
|
#include "gettext.h"
|
|
|
|
struct progress;
|
|
|
|
#ifdef GIT_TEST_PROGRESS_ONLY
|
|
|
|
extern int progress_testing;
|
|
extern uint64_t progress_test_ns;
|
|
void progress_test_force_update(void);
|
|
|
|
#endif
|
|
|
|
void display_throughput(struct progress *progress, uint64_t total);
|
|
void display_progress(struct progress *progress, uint64_t n);
|
|
struct progress *start_progress(const char *title, uint64_t total);
|
|
struct progress *start_sparse_progress(const char *title, uint64_t total);
|
|
struct progress *start_delayed_progress(const char *title, uint64_t total);
|
|
struct progress *start_delayed_sparse_progress(const char *title,
|
|
uint64_t total);
|
|
void stop_progress_msg(struct progress **p_progress, const char *msg);
|
|
static inline void stop_progress(struct progress **p_progress)
|
|
{
|
|
stop_progress_msg(p_progress, _("done"));
|
|
}
|
|
#endif
|