filter-branch: make report-progress more readable
The name of some variables that are used very locally in this function were overly long; they were making the lines harder to read and the longer names didn't add much more information. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Sep 21, 2015 at 15:16 UTC
71400d97b12abeba25f2e8245a9751daf8583142
1 file changed
+9
-7
git-filter-branch.sh
+9
-7
@@ -280,18 +280,20 @@ report_progress ()
280
if test -n "$progress" &&
281
test $git_filter_branch__commit_count -gt $next_sample_at
282
then
283
- now_timestamp=$(date +%s)
284
- elapsed_seconds=$(($now_timestamp - $start_timestamp))
285
- remaining_second=$(( ($commits - $git_filter_branch__commit_count) * $elapsed_seconds / $git_filter_branch__commit_count ))
286
- if test $elapsed_seconds -gt 0
283
+ count=$git_filter_branch__commit_count
284
+
285
+ now=$(date +%s)
286
+ elapsed=$(($now - $start_timestamp))
287
+ remaining=$(( ($commits - $count) * $elapsed / $count ))
288
+ if test $elapsed -gt 0
289
then
288
- next_sample_at=$(( ($elapsed_seconds + 1) * $git_filter_branch__commit_count / $elapsed_seconds ))
290
+ next_sample_at=$(( ($elapsed + 1) * $count / $elapsed ))
291
else
292
next_sample_at=$(($next_sample_at + 1))
293
fi
292
- progress=" ($elapsed_seconds seconds passed, remaining $remaining_second predicted)"
294
+ progress=" ($elapsed seconds passed, remaining $remaining predicted)"
295
fi
294
- printf "\rRewrite $commit ($git_filter_branch__commit_count/$commits)$progress "
296
+ printf "\rRewrite $commit ($count/$commits)$progress "
297
}
298
299
git_filter_branch__commit_count=0