describe: Provide a hint when origin detection fails.

* guix/scripts/describe.scm (display-checkout-info): Add call to
'display-hint' in the error case.
This commit is contained in:
Ludovic Courtès 2019-04-28 15:05:41 +02:00
parent e0f3a4feb5
commit 0663302618
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 7 additions and 1 deletions

View File

@ -18,6 +18,7 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (guix scripts describe) (define-module (guix scripts describe)
#:use-module ((guix config) #:select (%guix-version))
#:use-module ((guix ui) #:hide (display-profile-content)) #:use-module ((guix ui) #:hide (display-profile-content))
#:use-module (guix channels) #:use-module (guix channels)
#:use-module (guix scripts) #:use-module (guix scripts)
@ -114,7 +115,12 @@ within a Git checkout."
(lambda () (lambda ()
(repository-discover (dirname program))) (repository-discover (dirname program)))
(lambda (key err) (lambda (key err)
(leave (G_ "failed to determine origin~%"))))) (report-error (G_ "failed to determine origin~%"))
(display-hint (format #f (G_ "Perhaps this
@command{guix} command was not obtained with @command{guix pull}? Its version
string is ~a.~%")
%guix-version))
(exit 1))))
(repository (repository-open directory)) (repository (repository-open directory))
(head (repository-head repository)) (head (repository-head repository))
(commit (oid->string (reference-target head)))) (commit (oid->string (reference-target head))))