[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Read git tags using Scheme
From: |
Noeck |
Subject: |
Read git tags using Scheme |
Date: |
Fri, 17 Apr 2020 00:40:44 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 |
Hi,
I am using the function below which is adapted from
http://lilypondblog.org/2014/01/why-use-version-control-for-engraving-scores/#more-2151
While it works and the .ly files compile successfully, the function
issues a warning (?) I’d like to get rid of.
1) If the document is in a git directory, this is printed:
Parsing...git: /…path/to…/lilypond-2.20.0-1/lilypond/usr/lib/libz.so.1:
no version information available (required by git)
Where does it come from and why is it issued?
Doing `git --version` in bash does not issue it.
2) If the document is not in a git repository another log line is added:
fatal: not a git repository (or any of the parent directories): .git
Which I understand but I’d like to hide it anyways because I want to use
the same file no matter if it is used with git or not.
Any ideas how to achieve this?
Cheers,
Joram
%%%% code
\version "2.20.0"
#(use-modules (ice-9 popen))
#(use-modules (ice-9 rdelim))
#(define (strsystem_internal cmd)
(let* ((port (open-input-pipe cmd))
(str (read-line port)))
(close-pipe port)
str))
#(define gitshort (let* ((res (strsystem_internal
"git describe --long --dirty='+' | sed 's/-/./' | sed -r
's/-g[0-9a-f]+//g'")))
(if (string? res) res "")))
% if (string? ... is my clumsy way to ensure it returns a string
\markup { "Version" \gitshort }
- Read git tags using Scheme,
Noeck <=