summaryrefslogtreecommitdiff
path: root/progress.c
diff options
context:
space:
mode:
authorLars Schneider <larsxschneider@gmail.com>2017-12-04 22:07:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-12-04 22:22:18 (GMT)
commit9c5951cacf5cf2a4828480176921ca0307d22746 (patch)
tree2e39e6d5fb120a9bd0b8f2044a63ddfc40ec6ecd /progress.c
parentee85e41af3f87afedd9fba63617e74713449240c (diff)
downloadgit-9c5951cacf5cf2a4828480176921ca0307d22746.zip
git-9c5951cacf5cf2a4828480176921ca0307d22746.tar.gz
git-9c5951cacf5cf2a4828480176921ca0307d22746.tar.bz2
progress: drop delay-threshold code
Since 180a9f2268 (provide a facility for "delayed" progress reporting, 2007-04-20), the progress code has allowed callers to skip showing progress if they have reached a percentage-threshold of the total work before the delay period passes. But since 8aade107dd (progress: simplify "delayed" progress API, 2017-08-19), that parameter is not available to outside callers (we always passed zero after that commit, though that was corrected in the previous commit to "100%"). Let's drop the threshold code, which never triggers in any meaningful way. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'progress.c')
-rw-r--r--progress.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/progress.c b/progress.c
index b774cb1..5f87f45 100644
--- a/progress.c
+++ b/progress.c
@@ -34,7 +34,6 @@ struct progress {
unsigned total;
unsigned last_percent;
unsigned delay;
- unsigned delayed_percent_threshold;
struct throughput *throughput;
uint64_t start_ns;
};
@@ -83,20 +82,8 @@ static int display(struct progress *progress, unsigned n, const char *done)
{
const char *eol, *tp;
- if (progress->delay) {
- if (!progress_update || --progress->delay)
- return 0;
- if (progress->total) {
- unsigned percent = n * 100 / progress->total;
- if (percent > progress->delayed_percent_threshold) {
- /* inhibit this progress report entirely */
- clear_progress_signal();
- progress->delay = -1;
- progress->total = 0;
- return 0;
- }
- }
- }
+ if (progress->delay && (!progress_update || --progress->delay))
+ return 0;
progress->last_value = n;
tp = (progress->throughput) ? progress->throughput->display.buf : "";
@@ -206,7 +193,7 @@ int display_progress(struct progress *progress, unsigned n)
}
static struct progress *start_progress_delay(const char *title, unsigned total,
- unsigned percent_threshold, unsigned delay)
+ unsigned delay)
{
struct progress *progress = malloc(sizeof(*progress));
if (!progress) {
@@ -219,7 +206,6 @@ static struct progress *start_progress_delay(const char *title, unsigned total,
progress->total = total;
progress->last_value = -1;
progress->last_percent = -1;
- progress->delayed_percent_threshold = percent_threshold;
progress->delay = delay;
progress->throughput = NULL;
progress->start_ns = getnanotime();
@@ -229,12 +215,12 @@ static struct progress *start_progress_delay(const char *title, unsigned total,
struct progress *start_delayed_progress(const char *title, unsigned total)
{
- return start_progress_delay(title, total, 100, 2);
+ return start_progress_delay(title, total, 2);
}
struct progress *start_progress(const char *title, unsigned total)
{
- return start_progress_delay(title, total, 0, 0);
+ return start_progress_delay(title, total, 0);
}
void stop_progress(struct progress **p_progress)