guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

nicer “guix describe” commit display


From: Ricardo Wurmus
Subject: nicer “guix describe” commit display
Date: Sun, 08 Mar 2020 18:18:03 +0100
User-agent: mu4e 1.2.0; emacs 26.3

Hi Guix,

in the past we discussed printing more readable commits with “guix
describe”.  This patch would do that:

--8<---------------cut here---------------start------------->8---
diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
index f13f221da9..c5fcef1bcd 100644
--- a/guix/scripts/describe.scm
+++ b/guix/scripts/describe.scm
@@ -26,6 +26,7 @@
   #:use-module (guix describe)
   #:use-module (guix profiles)
   #:use-module (git)
+  #:use-module (git describe)
   #:use-module (json)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-37)
@@ -127,7 +128,8 @@ string is ~a.~%")
                          (exit 1))))
          (repository (repository-open directory))
          (head       (repository-head repository))
-         (commit     (oid->string (reference-target head))))
+         (commit-ref (commit-lookup repository (reference-target head)))
+         (commit     (describe-format (describe-commit commit-ref))))
     (match fmt
       ('human
        (format #t (G_ "Git checkout:~%"))
--8<---------------cut here---------------end--------------->8---

It does, however, depend on the most recent released version of
guile-git, which introduced (git describe).  It would fail with any
previous version.

It is also not clear if the output would actually be better for use in
channel files.

--
Ricardo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]