summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--progress.c21
-rw-r--r--progress.h6
-rwxr-xr-xt/t5316-pack-delta-depth.sh6
3 files changed, 13 insertions, 20 deletions
diff --git a/progress.c b/progress.c
index 6cc7f902f5..0cdd875d37 100644
--- a/progress.c
+++ b/progress.c
@@ -311,8 +311,7 @@ struct progress *start_delayed_sparse_progress(const char *title,
static void finish_if_sparse(struct progress *progress)
{
- if (progress &&
- progress->sparse &&
+ if (progress->sparse &&
progress->last_value != progress->total)
display_progress(progress, progress->total);
}
@@ -347,22 +346,6 @@ static void log_trace2(struct progress *progress)
trace2_region_leave("progress", progress->title, the_repository);
}
-void stop_progress(struct progress **p_progress)
-{
- struct progress *progress;
-
- if (!p_progress)
- BUG("don't provide NULL to stop_progress");
- progress = *p_progress;
-
- finish_if_sparse(progress);
-
- if (progress)
- log_trace2(*p_progress);
-
- stop_progress_msg(p_progress, _("done"));
-}
-
void stop_progress_msg(struct progress **p_progress, const char *msg)
{
struct progress *progress;
@@ -375,8 +358,10 @@ void stop_progress_msg(struct progress **p_progress, const char *msg)
return;
*p_progress = NULL;
+ finish_if_sparse(progress);
if (progress->last_value != -1)
force_last_update(progress, msg);
+ log_trace2(progress);
clear_progress_signal();
strbuf_release(&progress->counters_sb);
diff --git a/progress.h b/progress.h
index 4f6806904a..3a945637c8 100644
--- a/progress.h
+++ b/progress.h
@@ -1,5 +1,6 @@
#ifndef PROGRESS_H
#define PROGRESS_H
+#include "gettext.h"
struct progress;
@@ -19,5 +20,8 @@ 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);
-void stop_progress(struct progress **p_progress);
+static inline void stop_progress(struct progress **p_progress)
+{
+ stop_progress_msg(p_progress, _("done"));
+}
#endif
diff --git a/t/t5316-pack-delta-depth.sh b/t/t5316-pack-delta-depth.sh
index 759169d074..bbe2e69c75 100755
--- a/t/t5316-pack-delta-depth.sh
+++ b/t/t5316-pack-delta-depth.sh
@@ -61,7 +61,11 @@ test_expect_success 'create series of packs' '
echo $cur
echo "$(git rev-parse :file) file"
} | git pack-objects --stdout >tmp &&
- git index-pack --stdin --fix-thin <tmp || return 1
+ GIT_TRACE2_EVENT=$PWD/trace \
+ git index-pack -v --stdin --fix-thin <tmp || return 1 &&
+ grep -c region_enter.*progress trace >enter &&
+ grep -c region_leave.*progress trace >leave &&
+ test_cmp enter leave &&
prev=$cur
done
'