Subject: bug#50377: closed (Re: bug#50377: [PATCH 0/2] Support 'git describe' style commit IDs in transformations)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 08 Sep 2021 16:09:02 +0000

Your bug report

#50377: [PATCH 0/2] Support 'git describe' style commit IDs in transformations

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
50377: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=50377
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#50377: [PATCH 0/2] Support 'git describe' style commit IDs in transformations
From: Marius Bakke <[email-masked]>
To: Ludovic Courtès <[email-masked]>
Cc: [email-masked]
Date: Wed, 08 Sep 2021 18:08:14 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Ludovic Courtès <[email-masked]> skriver:

> Marius Bakke <[email-masked]> skribis:
>
>> +      (version (cond ((and (string-contains commit "-g")
>> +                           (match (string-split commit #\-)
>> +                             ((version ... revision g+commit)
>> +                              (and (> (string-length g+commit) 4)
>> +                                   (string-every char-set:digit revision)
>> +                                   (string-every char-set:hex-digit
>> +                                                 (string-drop g+commit 1))))
>> +                             (_ #f)))
>> +                      ;; This looks like a 'git describe' style ID.  Drop
>> +                      ;; the 'v' prefix if applicable.
>> +                      (if (and (string-prefix? "v" commit)
>> +                               (char-set-contains? char-set:digit
>> +                                                   (string-take
>> +                                                    (string-drop commit 1)
>> +                                                    1)))
>> +                          (string-drop commit 1)
>> +                          commit))
>> +                     ((and (> (string-length commit) 1)
>> +                           (string-prefix? "v" commit)
>> +                           (char-set-contains? char-set:digit
>> +                                               (string-ref commit 1)))
>> +                      (string-drop commit 1))       ;looks like a tag like "v1.0"
>> +                     (else
>> +                      (string-append "git."
>> +                                     (if (< (string-length commit) 7)
>> +                                         commit
>> +                                         (string-take commit 7))))))
>
> For clarity, I’d extract this as a ‘commit->version-string’ procedure.
>
> Like Xinglu writes, it’d be great to add a sentence in the manual about
> these IDs.

Thanks for the feedback!  Looking at this again, I realized tags would
not be used as version either which seemed like an oversight.  So I
fixed(?) that too and vastly simplified this patch.  :-)

Also adjusted the test to more thoroughly excercise the new
commit->version-string procedure with the different arguments, and
updated the documentation.

Pushed in:
  1dc3825e99 git: 'resolve-reference' handles 'git describe'-style commit IDs.
  16ef7b4938 transformations: Git tags and 'git describe' style IDs are used as version.

Thanks,
Marius

Subject: [PATCH 0/2] Support 'git describe' style commit IDs in transformations
From: Marius Bakke <[email-masked]>
To: [email-masked]
Date: Sat, 4 Sep 2021 20:08:45 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

The first patch makes it possible to pass a 'git describe' style commit
identifier to --with-commit.  The second patch arranges so that it is
used as the package version, sans any leading 'v', if applicable.

Marius Bakke (2):
  git: 'resolve-reference' handles 'git describe'-style commit IDs.
  transformations: 'git describe' style commit IDs are used as version.

 guix/git.scm              | 37 ++++++++++++++++++++-----------------
 guix/transformations.scm  | 34 +++++++++++++++++++++++++---------
 tests/transformations.scm | 19 +++++++++++++++++++
 3 files changed, 64 insertions(+), 26 deletions(-)

-- 
2.31.1