texlive[63920] Master/texmf-dist: gitver (17jul22)
commits+karl at tug.org
commits+karl at tug.org
Sun Jul 17 21:58:04 CEST 2022
Revision: 63920
http://tug.org/svn/texlive?view=revision&revision=63920
Author: karl
Date: 2022-07-17 21:58:04 +0200 (Sun, 17 Jul 2022)
Log Message:
-----------
gitver (17jul22)
Modified Paths:
--------------
trunk/Master/texmf-dist/doc/latex/gitver/ChangeLog
trunk/Master/texmf-dist/doc/latex/gitver/README.md
trunk/Master/texmf-dist/doc/latex/gitver/gitver.pdf
trunk/Master/texmf-dist/doc/latex/gitver/gitver.tex
trunk/Master/texmf-dist/tex/latex/gitver/gitver.sty
Added Paths:
-----------
trunk/Master/texmf-dist/doc/latex/gitver/latexmkrc
Modified: trunk/Master/texmf-dist/doc/latex/gitver/ChangeLog
===================================================================
--- trunk/Master/texmf-dist/doc/latex/gitver/ChangeLog 2022-07-17 17:49:31 UTC (rev 63919)
+++ trunk/Master/texmf-dist/doc/latex/gitver/ChangeLog 2022-07-17 19:58:04 UTC (rev 63920)
@@ -6,4 +6,6 @@
* Use datetime2 instead of datetime to reduce dependancy burden
and display dates in ISO format
2020-10-30 - v1.3
- * Support lualatex
\ No newline at end of file
+ * Support lualatex
+2022-07-16 - v1.4
+ * Detect running in online builders via "CLSI" environmental variable
\ No newline at end of file
Modified: trunk/Master/texmf-dist/doc/latex/gitver/README.md
===================================================================
--- trunk/Master/texmf-dist/doc/latex/gitver/README.md 2022-07-17 17:49:31 UTC (rev 63919)
+++ trunk/Master/texmf-dist/doc/latex/gitver/README.md 2022-07-17 19:58:04 UTC (rev 63920)
@@ -2,7 +2,7 @@
=========================
URL: https://github.com/charlesbaynham/gitver
-(c) Charles Baynham 2020
+(c) Charles Baynham 2022
License: LaTeX Project Public License 1.3c
Modified: trunk/Master/texmf-dist/doc/latex/gitver/gitver.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/latex/gitver/gitver.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/gitver/gitver.tex 2022-07-17 17:49:31 UTC (rev 63919)
+++ trunk/Master/texmf-dist/doc/latex/gitver/gitver.tex 2022-07-17 19:58:04 UTC (rev 63920)
@@ -18,7 +18,7 @@
\title{\textsf{gitver} -- Git version tags \\
for \LaTeX{} projects}
\author{Charles Baynham}
-\date{2020/10/30 (v\,1.3)}
+\date{2022/07/16 (v\,1.4)}
\MaintainedBy{%
This file is maintained by Charles Baynham.\\%
Bug reports can be opened at\\%
@@ -43,6 +43,10 @@
on the command line when compiling your document, or will be available in the
options of whatever GUI you're using (try Googling).
+Note that online Latex editors like Overleaf.com often do not have git installed.
+Gitver will detect these by the precense of the environmental variable "CLSI"
+and will display the version as "CLSI" instead.
+
Note that it's a good idea to tell git to ignore all the latex auxilary files,
otherwise your version will always be ``dirty''. Try the \textsf{.gitignore} file from
\url{https://www.gitignore.io/api/latex} if you don't already have
@@ -117,6 +121,7 @@
\item v1.2 - Use datetime2 instead of datetime to reduce dependancy burden
and display dates in ISO format
\item v1.3 - Support LuaLatex
+ \item v1.4 - Detect running in online builders via "CLSI" environmental variable
\end{itemize}
\end{document}
Added: trunk/Master/texmf-dist/doc/latex/gitver/latexmkrc
===================================================================
--- trunk/Master/texmf-dist/doc/latex/gitver/latexmkrc (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/gitver/latexmkrc 2022-07-17 19:58:04 UTC (rev 63920)
@@ -0,0 +1,8 @@
+# .latexmkrc
+# This file will be read by latexmk when building the documentation
+
+# Run pdflatex with shell escape (for git tagging) and ignore errors
+$pdflatex = 'pdflatex %O -interaction=nonstopmode --shell-escape %S';
+
+# Default to pdf output
+$pdf_mode = 1;
\ No newline at end of file
Modified: trunk/Master/texmf-dist/tex/latex/gitver/gitver.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/gitver/gitver.sty 2022-07-17 17:49:31 UTC (rev 63919)
+++ trunk/Master/texmf-dist/tex/latex/gitver/gitver.sty 2022-07-17 19:58:04 UTC (rev 63920)
@@ -1,6 +1,6 @@
% gitVer
%
-% (c) Charles Baynham 2020
+% (c) Charles Baynham 2022
%
% License: LaTeX Project Public License 1.3c
%
@@ -19,13 +19,32 @@
\NeedsTeXFormat{LaTeX2e}
\def\@gitVerPkgName{gitver}
\ProvidesPackage{\@gitVerPkgName}
- [2020/10/30 v1.3 Access current git version and optionally add it to document headers]
+ [2022/07/16 v1.4 Access current git version and optionally add it to document headers]
\RequirePackage{hyperref}
\RequirePackage{catchfile}
\RequirePackage{pdftexcmds}
\RequirePackage{datetime2}
+\RequirePackage{ifthen}
+\RequirePackage{xparse}
+% Define a command to get environmental variables
+% Thanks to egreg at https://tex.stackexchange.com/questions/62010/can-i-access-system-environment-variables-from-latex-for-instance-home
+\ExplSyntaxOn
+\NewDocumentCommand{\getenv}{om}
+ {
+ \sys_get_shell:nnN { kpsewhich ~ --var-value ~ #2 } { } \l_tmpa_tl %
+ \tl_trim_spaces:N \l_tmpa_tl %
+ \IfNoValueTF { #1 } %
+ {%
+ \tl_use:N \l_tmpa_tl%
+ }%
+ {%
+ \tl_set_eq:NN #1 \l_tmpa_tl%
+ }%
+ }
+\ExplSyntaxOff
+
% Support lualatex by reinstating the \write18 command
\RequirePackage{ifluatex}
\ifluatex
@@ -85,7 +104,7 @@
\def\@gitver at emptyfile{}
\ifx\gitVer\@gitver at emptyfile%
- \PackageError{\@gitVerPkgName}{Git output is empty: is this folder a git repo?}{Make sure that this directory has had "git init" called in it, and has at least one commit.}
+ \PackageWarning{\@gitVerPkgName}{Git output is empty: is this folder a git repo? Make sure that this directory has had "git init" called in it, has at least one commit, and that git is installed.}
\else
\@gitver at successtrue
\fi
@@ -93,8 +112,23 @@
\if at gitver@success
\else
- \PackageWarning{\@gitVerPkgName}{Git command failed: writing as "unknown"}%
- \def\gitVer{unknown}
+ % Look for "CLSI" environmental variable: this stands for Common Latex Service
+ % Interface, and is set to "1" in web builders like Overleaf.com
+ \getenv[\CLSI]{CLSI}
+ % Check if CLSI == 1 (see https://tex.stackexchange.com/a/306500)
+ \ifnum1=0\CLSI\relax
+ \PackageWarning{\@gitVerPkgName}{Running on a Common Latex Service %
+ Interface without Git: writing version as "CLSI"}%
+ \def\gitVer{CLSI}
+ \else
+ \PackageError{\@gitVerPkgName}{Git command failed: writing as "unknown"}{%
+ Calling git failed, and your system did not identify itself as a
+ Common Latex Service Interface (e.g. overleaf.com). Make sure that git
+ is installed and that this file is in a repository which has at least
+ one commit.
+ }%
+ \def\gitVer{unknown}
+ \fi
\fi
%
% Make a box containing the date and version
More information about the tex-live-commits
mailing list.