unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* nicer “guix describe” commit display
@ 2020-03-08 17:18 Ricardo Wurmus
  2020-03-08 22:27 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Ricardo Wurmus @ 2020-03-08 17:18 UTC (permalink / raw)
  To: guix-devel

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: nicer “guix describe” commit display
  2020-03-08 17:18 nicer “guix describe” commit display Ricardo Wurmus
@ 2020-03-08 22:27 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2020-03-08 22:27 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Hi!

Ricardo Wurmus <rekado@elephly.net> skribis:

> in the past we discussed printing more readable commits with “guix
> describe”.  This patch would do that:
>
> 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:~%"))
>
> 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.

I think it’s fine to use this feature.  However, I’d use it only for the
'human format, and perhaps also in addition to the actual commit ID,
which is always useful.

Actually, would it be nicer to display the git-describe string as part
of the ‘guix --version’?

Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-03-08 22:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-08 17:18 nicer “guix describe” commit display Ricardo Wurmus
2020-03-08 22:27 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).