summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-07-17 19:58:04 +0000
committerKarl Berry <karl@freefriends.org>2022-07-17 19:58:04 +0000
commite0553ff4e53f7d6417fc5f90bb661f38826d2395 (patch)
tree4a7247d4ad726984fc525b370990eb950f18bc10 /Master/texmf-dist
parente247fd87d43c1d36e8f7a4fcb861a293279e1756 (diff)
gitver (17jul22)
git-svn-id: svn://tug.org/texlive/trunk@63920 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/latex/gitver/ChangeLog4
-rw-r--r--Master/texmf-dist/doc/latex/gitver/README.md2
-rw-r--r--Master/texmf-dist/doc/latex/gitver/gitver.pdfbin128530 -> 134559 bytes
-rw-r--r--Master/texmf-dist/doc/latex/gitver/gitver.tex7
-rw-r--r--Master/texmf-dist/doc/latex/gitver/latexmkrc8
-rw-r--r--Master/texmf-dist/tex/latex/gitver/gitver.sty44
6 files changed, 57 insertions, 8 deletions
diff --git a/Master/texmf-dist/doc/latex/gitver/ChangeLog b/Master/texmf-dist/doc/latex/gitver/ChangeLog
index 4b3da3083c5..d49c9a0ced0 100644
--- a/Master/texmf-dist/doc/latex/gitver/ChangeLog
+++ b/Master/texmf-dist/doc/latex/gitver/ChangeLog
@@ -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
diff --git a/Master/texmf-dist/doc/latex/gitver/README.md b/Master/texmf-dist/doc/latex/gitver/README.md
index 6edb662f9f5..b4eb37e8365 100644
--- a/Master/texmf-dist/doc/latex/gitver/README.md
+++ b/Master/texmf-dist/doc/latex/gitver/README.md
@@ -2,7 +2,7 @@ Git Version (version 1.3)
=========================
URL: https://github.com/charlesbaynham/gitver
-(c) Charles Baynham 2020
+(c) Charles Baynham 2022
License: LaTeX Project Public License 1.3c
diff --git a/Master/texmf-dist/doc/latex/gitver/gitver.pdf b/Master/texmf-dist/doc/latex/gitver/gitver.pdf
index e73e6bcfc48..a2ee4b8e2b5 100644
--- a/Master/texmf-dist/doc/latex/gitver/gitver.pdf
+++ b/Master/texmf-dist/doc/latex/gitver/gitver.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/gitver/gitver.tex b/Master/texmf-dist/doc/latex/gitver/gitver.tex
index f6ecf2654c8..a5b68af99e4 100644
--- a/Master/texmf-dist/doc/latex/gitver/gitver.tex
+++ b/Master/texmf-dist/doc/latex/gitver/gitver.tex
@@ -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 @@ running in ``shell escape'' mode. This can be enabled by passing \textsf{--shell
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 @@ the option |nopdfinfo|.
\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}
diff --git a/Master/texmf-dist/doc/latex/gitver/latexmkrc b/Master/texmf-dist/doc/latex/gitver/latexmkrc
new file mode 100644
index 00000000000..a22b23ddadd
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/gitver/latexmkrc
@@ -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
diff --git a/Master/texmf-dist/tex/latex/gitver/gitver.sty b/Master/texmf-dist/tex/latex/gitver/gitver.sty
index 4a06cd05a39..c2649c3d976 100644
--- a/Master/texmf-dist/tex/latex/gitver/gitver.sty
+++ b/Master/texmf-dist/tex/latex/gitver/gitver.sty
@@ -1,6 +1,6 @@
% gitVer
%
-% (c) Charles Baynham 2020
+% (c) Charles Baynham 2022
%
% License: LaTeX Project Public License 1.3c
%
@@ -19,12 +19,31 @@
\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}
@@ -85,7 +104,7 @@
\def\@gitver@emptyfile{}
\ifx\gitVer\@gitver@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@successtrue
\fi
@@ -93,8 +112,23 @@
\if@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