summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-09-14 19:25:22 +0000
committerKarl Berry <karl@freefriends.org>2024-09-14 19:25:22 +0000
commit6f6bc183a396c556d86e8136f53acc5657382e22 (patch)
treec4a5111d8e006693ff1827e46bc4cb772e028780 /Master
parent7d6647d88a7d9b0011e6e2710e98f4560109ae44 (diff)
gitinfo-lua (14sep24)
git-svn-id: svn://tug.org/texlive/trunk@72284 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/lualatex/gitinfo-lua/gitinfo-lua.pdfbin122453 -> 124467 bytes
-rw-r--r--Master/texmf-dist/doc/lualatex/gitinfo-lua/gitinfo-lua.tex4
-rw-r--r--Master/texmf-dist/scripts/gitinfo-lua/gitinfo-lua.lua19
-rw-r--r--Master/texmf-dist/tex/lualatex/gitinfo-lua/gitinfo-lua.sty11
4 files changed, 29 insertions, 5 deletions
diff --git a/Master/texmf-dist/doc/lualatex/gitinfo-lua/gitinfo-lua.pdf b/Master/texmf-dist/doc/lualatex/gitinfo-lua/gitinfo-lua.pdf
index c3d56523153..886799591ba 100644
--- a/Master/texmf-dist/doc/lualatex/gitinfo-lua/gitinfo-lua.pdf
+++ b/Master/texmf-dist/doc/lualatex/gitinfo-lua/gitinfo-lua.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/lualatex/gitinfo-lua/gitinfo-lua.tex b/Master/texmf-dist/doc/lualatex/gitinfo-lua/gitinfo-lua.tex
index a865389e0cb..4fe3cf498df 100644
--- a/Master/texmf-dist/doc/lualatex/gitinfo-lua/gitinfo-lua.tex
+++ b/Master/texmf-dist/doc/lualatex/gitinfo-lua/gitinfo-lua.tex
@@ -157,6 +157,9 @@ $lualatex = "lualatex --lua=gitinfo-lua-init.lua %O %S";
When the version is dirty it will be post fixed with \texttt{-<commit count>-<short ref>}.
For example, when this paragraph was written, the version was displaying 0.0.1-14-gcc2bc30.\\
+ \DescribeMacro{\ifgitdirty} To test whether there are any pending changes in the local Git repository, use the \cmd{\ifgitdirty}\marg{true code}\marg{false code} macro.
+ For this macro to work properly, be sure to add a \texttt{.gitignore}\footnote{A proper example of a \texttt{.gitignore} file for \LaTeX: \url{https://raw.githubusercontent.com/github/gitignore/main/TeX.gitignore}} file and include all \TeX\ based generated files.\\
+
The \DescribeMacro{\gitdate}\cmd{\gitdate} macro gets the most recent date from the git log.
Meaning, the last `short date' variant is picked from the last commit.
This short date is formatted ISO based and is already suitable for use in packages like \texttt{isodate} for more advanced date formatting.\\
@@ -201,7 +204,6 @@ $lualatex = "lualatex --lua=gitinfo-lua-init.lua %O %S";
For this section the git project of this document is used due to the fact that there are references to revisions.
The test project's revisions change for every user, since they get recreated every time \texttt{test-scenario.sh} is executed (see section~\ref{sec:project}).\\
- \clearpage
\noindent
\DescribeMacro{\gitcommit}\oarg{format}\marg{csname}\marg{revision}\\
For displaying commit data \cmd{\gitcommit} can be used.
diff --git a/Master/texmf-dist/scripts/gitinfo-lua/gitinfo-lua.lua b/Master/texmf-dist/scripts/gitinfo-lua/gitinfo-lua.lua
index 8c346ec3bed..1c4b7b1dcb4 100644
--- a/Master/texmf-dist/scripts/gitinfo-lua/gitinfo-lua.lua
+++ b/Master/texmf-dist/scripts/gitinfo-lua/gitinfo-lua.lua
@@ -23,8 +23,8 @@ end
local module = {
name = 'gitinfo-lua',
info = {
- version = '1.1.0', --TAGVERSION
- date = '2024/04/11', --TAGDATE
+ version = '1.2.0', --TAGVERSION
+ date = '2024/09/14', --TAGDATE
comment = "Git info Lua — Git integration with LaTeX",
author = "Erik Nijenhuis",
license = "free"
@@ -109,10 +109,23 @@ function api:write_version()
end
end
+function api:is_dirty()
+ local files_changed, _ = self.cmd:exec('status --porcelain=1', true)
+ return files_changed and #files_changed > 0
+end
+
+function api:write_is_dirty()
+ if self:is_dirty() then
+ tex.write('1')
+ else
+ tex.write('0')
+ end
+end
+
-- todo: prevent output to stderr
-- todo: add write variant
-- experimental
-function api:is_dirty()
+function api:is_tag()
local ok, _ = self.cmd:exec('describe --tags --exact-match')
return ok == nil
end
diff --git a/Master/texmf-dist/tex/lualatex/gitinfo-lua/gitinfo-lua.sty b/Master/texmf-dist/tex/lualatex/gitinfo-lua/gitinfo-lua.sty
index 779f246ed4e..f1ee5575a7d 100644
--- a/Master/texmf-dist/tex/lualatex/gitinfo-lua/gitinfo-lua.sty
+++ b/Master/texmf-dist/tex/lualatex/gitinfo-lua/gitinfo-lua.sty
@@ -16,7 +16,7 @@
% This work consists of the files gitinfo-lua.sty gitinfo-lua.pdf
% gitinfo-lua-cmd.lua, gitinfo-lua-recorder.lua and gitinfo-lua.lua
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{gitinfo-lua}[2024/04/11 1.1.0 Xerdi's Git Package]
+\ProvidesPackage{gitinfo-lua}[2024/09/14 1.2.0 Xerdi's Git Package]
\directlua{git = require('gitinfo-lua')}
@@ -53,6 +53,15 @@
\newcommand*\gitdate{\directlua{git:cs_last_commit('git@single@arg', 'cs')}}
\newcommand*\gitdirectory[1]{\directlua{git:dir('#1')}}
\newcommand*\gitunsetdirectory{\directlua{git:dir(nil)}}
+\newcommand*\ifgitdirty[2]{%
+ \def\@dirtytrue{1}%
+ \edef\@dirty{\directlua{git:write_is_dirty()}}%
+ \ifx\@dirty\@dirtytrue
+ #1%
+ \else
+ #2%
+ \fi
+}
\newcommand\git@format@author[2]{%
#1