summaryrefslogtreecommitdiff
path: root/guix/git.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-03-23 21:45:21 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-03-23 21:45:21 -0400
commit839bb4616f13171a23ad7937bf57d0a01d61d42a (patch)
tree01de78a5ce973b9fb7ac0f9216d64f736f8e163d /guix/git.scm
parent0357bbbcd850f9220078a62da3c30358b8983765 (diff)
parentef71e3290916583973724316e815cee840c1b6d8 (diff)
Merge remote-tracking branch 'origin/master' into staging.
With resolved conflicts in: gnu/packages/ibus.scm gnu/packages/image.scm gnu/packages/lisp.scm gnu/packages/virtualization.scm
Diffstat (limited to 'guix/git.scm')
-rw-r--r--guix/git.scm28
1 files changed, 15 insertions, 13 deletions
diff --git a/guix/git.scm b/guix/git.scm
index 95630a5e69..be20cde019 100644
--- a/guix/git.scm
+++ b/guix/git.scm
@@ -4,6 +4,7 @@
;;; Copyright © 2021 Kyle Meyer <kyle@kyleam.com>
;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2023 Tobias Geerinckx-Rice <me@tobias.gr>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -22,8 +23,6 @@
(define-module (guix git)
#:use-module (git)
- #:use-module (git object)
- #:use-module (git submodule)
#:use-module (guix i18n)
#:use-module (guix base32)
#:use-module (guix cache)
@@ -141,11 +140,6 @@ the 'SSL_CERT_FILE' and 'SSL_CERT_DIR' environment variables."
(define total
(indexer-progress-total-objects progress))
- (define hundredth
- (match (quotient (indexer-progress-total-objects progress) 100)
- (0 1)
- (x x)))
-
(define-values (done label)
(if (< (indexer-progress-received-objects progress) total)
(values (indexer-progress-received-objects progress)
@@ -156,14 +150,22 @@ the 'SSL_CERT_FILE' and 'SSL_CERT_DIR' environment variables."
(define %
(* 100. (/ done total)))
- (when (and (< % 100) (zero? (modulo done hundredth)))
+ ;; TODO: Both should be handled & exposed by the PROGRESS-BAR API instead.
+ (define width
+ (max (- (current-terminal-columns)
+ (string-length label) 7)
+ 3))
+
+ (define grain
+ (match (quotient total (max 100 (* 8 width))) ; assume 1/8 glyph resolution
+ (0 1)
+ (x x)))
+
+ (when (and (< % 100) (zero? (modulo done grain)))
(erase-current-line (current-error-port))
- (let ((width (max (- (current-terminal-columns)
- (string-length label) 7)
- 3)))
- (format (current-error-port) "~a ~3,d% ~a"
+ (format (current-error-port) "~a ~3,d% ~a"
label (inexact->exact (round %))
- (progress-bar % width)))
+ (progress-bar % width))
(force-output (current-error-port)))
(when (= % 100.)