summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2020-03-18 21:18:16 +0000
committerKarl Berry <karl@freefriends.org>2020-03-18 21:18:16 +0000
commit86be8db65c7c2ee47997df4a161daacfcc2996b4 (patch)
tree26634afff5bbef030d2cf66ff2b17b7335d4bfa9 /Master
parent5a4a14d69dd71bcfbdb513984e35464f000a8c53 (diff)
latexgit (18mar20)
git-svn-id: svn://tug.org/texlive/trunk@54391 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/latexgit/latexgit.pdfbin427656 -> 435404 bytes
-rw-r--r--Master/texmf-dist/source/latex/latexgit/latexgit.dtx174
-rw-r--r--Master/texmf-dist/tex/latex/latexgit/latexgit.sty154
3 files changed, 180 insertions, 148 deletions
diff --git a/Master/texmf-dist/doc/latex/latexgit/latexgit.pdf b/Master/texmf-dist/doc/latex/latexgit/latexgit.pdf
index 5ddb54d5672..a6dd138f0cd 100644
--- a/Master/texmf-dist/doc/latex/latexgit/latexgit.pdf
+++ b/Master/texmf-dist/doc/latex/latexgit/latexgit.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/latexgit/latexgit.dtx b/Master/texmf-dist/source/latex/latexgit/latexgit.dtx
index df840b5e1f7..100d1d16a8d 100644
--- a/Master/texmf-dist/source/latex/latexgit/latexgit.dtx
+++ b/Master/texmf-dist/source/latex/latexgit/latexgit.dtx
@@ -58,6 +58,7 @@ Licensed under GPL v3.
\usepackage{enumitem}
\usepackage{verbatim}
\usepackage{amssymb}
+\usepackage{xstring}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
@@ -112,6 +113,7 @@ Licensed under GPL v3.
%\gitchanges
%
%\DoNotIndex{\def,\edef,\expandafter,\global,\let,\newcommand,\relax,\catcode}
+%\DoNotIndex{\%,\&} % this does not work currently due to a known bug
%\DoNotIndex{\begingroup,\endgroup}
%\expandafter\DoNotIndex\expandafter{\string\^}
%\DoNotIndex{\hbox,\ifdim,\setbox,\wd}
@@ -121,6 +123,7 @@ Licensed under GPL v3.
%\DoNotIndex{\space,\unskip}
%\DoNotIndex{\LaTeX,\pgfkeys,\changes}
%\DoNotIndex{\formatdate,\formattime}
+%\DoNotIndex{\StrSubstitute}
%\DoNotIndex{\git@@revision,\git@@thisdate,\git@@thishash,\git@@thismsg,\git@@parent}
%
%\begin{abstract}
@@ -188,6 +191,8 @@ Licensed under GPL v3.
% Use the git repository in directory \verb$DIR$ (or its first parent
% directory that is a git repository). \latexgit{} will \bashcmd{cd} to this
% directory before executing the actual \git{} command.
+% \item[file=FILE]
+% Get the information for the last commit modifying \verb$FILE$.
% \item[formatDate]
% Format dates using \textsf{datetime}'s \cs{formatdate}.
% \item[formatTime]
@@ -235,7 +240,7 @@ Licensed under GPL v3.
% \end{comment}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{latexgit}[2016/08/24]
+\ProvidesPackage{latexgit}[2020/03/18]
\RequirePackage{pgfkeys}
\RequirePackage{datetime}
@@ -271,6 +276,7 @@ Licensed under GPL v3.
/git/.is family, /git,
default/.style={
directory=.,
+ file=,
formatDate=false,
formatInterDateTime=\space{}at\space{},
formatTime=false,
@@ -279,6 +285,7 @@ Licensed under GPL v3.
shortHash=true,
},
directory/.estore in=\git@opt@Directory,
+ file/.estore in=\git@opt@File,
formatDate/.is if=git@opt@FormatDate,
formatInterDateTime/.estore in=\git@opt@FormatInterDateTime,
formatTime/.is if=git@opt@FormatTime,
@@ -312,12 +319,26 @@ Licensed under GPL v3.
% \end{macrocode}
%\end{macro}
%
+%In what follows, \verb$%$ may be used in calls to \git{}. Therefore we use
+%\verb$&$ as comment character.
+% \begin{macrocode}
+\catcode`\&=14\catcode`\%=11
+% \end{macrocode}
+%
+%\begin{macro}{\git@space}
+% For internal use, when a space is required after a \texttt{csname} in a
+% call to \cs{git@command}.
+% \begin{macrocode}
+\def\git@space{ }
+% \end{macrocode}
+%\end{macro}
+%
%\begin{macro}{\gitcommithash}
% Get a commit hash.
% \gitoptions{directory,revision,shortHash}
%
% \begin{macrocode}
-\newcommand{\gitcommithash}[1][]{%
+\newcommand{\gitcommithash}[1][]{&
\git@commithash[#1]\git@result}
% \end{macrocode}
%\end{macro}
@@ -325,15 +346,15 @@ Licensed under GPL v3.
%\begin{macro}{\git@commithash}
% Like \cs{gitcommithash}, but does not return the output.
% \begin{macrocode}
-\newcommand{\git@commithash}[1][]{%
- \pgfkeys{/git,default,#1}%
- \ifgit@opt@ShortHash%
- \git@command{git log -n 1 --oneline \git@opt@Revision
- | cut -d' ' -f1}%
- \else%
- \git@command{git log -n 1 \git@opt@Revision
- | head -1 | cut -d' ' -f2}%
- \fi%
+\newcommand{\git@commithash}[1][]{&
+ \pgfkeys{/git,default,#1}&
+ \ifgit@opt@ShortHash&
+ \git@command{git log -n 1 --format=%h
+ \git@opt@Revision\git@space -- \git@opt@File}&
+ \else&
+ \git@command{git log -n 1 --format=%H
+ \git@opt@Revision\git@space -- \git@opt@File}&
+ \fi&
}
% \end{macrocode}
%\end{macro}
@@ -343,7 +364,7 @@ Licensed under GPL v3.
% \gitoptions{directory,revision}
%
% \begin{macrocode}
-\newcommand{\gitcommitmsg}[1][]{%
+\newcommand{\gitcommitmsg}[1][]{&
\git@commitmsg[#1]\git@result}
% \end{macrocode}
%\end{macro}
@@ -351,10 +372,10 @@ Licensed under GPL v3.
%\begin{macro}{\git@commitmsg}
% Like \cs{gitcommitmsg}, but does not return the output.
% \begin{macrocode}
-\newcommand{\git@commitmsg}[1][]{%
- \pgfkeys{/git,default,#1}%
- \git@command{git log -n 1 --oneline \git@opt@Revision
- | cut -d' ' -f2-}%
+\newcommand{\git@commitmsg}[1][]{&
+ \pgfkeys{/git,default,#1}&
+ \git@command{git log -n 1 --format=%B
+ \git@opt@Revision\git@space -- \git@opt@File}&
}
% \end{macrocode}
%\end{macro}
@@ -363,8 +384,8 @@ Licensed under GPL v3.
% Format a commit date in ISO format using \textsf{datetime}'s
% \cs{formatdate}.
% \begin{macrocode}
-\def\git@formatCommitDate#1-#2-#3 #4:#5:#6 +#7\relax{%
- \formatdate{#3}{#2}{#1}%
+\def\git@formatCommitDate#1-#2-#3 #4:#5:#6 +#7\relax{&
+ \formatdate{#3}{#2}{#1}&
}
% \end{macrocode}
%\end{macro}
@@ -373,11 +394,11 @@ Licensed under GPL v3.
% Format a commit time using \textsf{datetime}'s \cs{formattime}.
% \gitoptions{showTimeZone}
% \begin{macrocode}
-\def\git@formatCommitTime#1-#2-#3 #4:#5:#6 +#7\relax{%
- \formattime{#4}{#5}{#6}%
- \ifgit@opt@ShowTimeZone%
- \space(+#7\unskip)%
- \fi%
+\def\git@formatCommitTime#1-#2-#3 #4:#5:#6 +#7\relax{&
+ \formattime{#4}{#5}{#6}&
+ \ifgit@opt@ShowTimeZone&
+ \space(+#7\unskip)&
+ \fi&
}
% \end{macrocode}
%\end{macro}
@@ -389,19 +410,19 @@ Licensed under GPL v3.
% \gitoptions{directory,formatDate,formatTime,revision,showTimeZone}
%
% \begin{macrocode}
-\newcommand{\gitcommitdate}[1][]{%
- \git@commitdate[#1]%
- \ifgit@opt@FormatDate%
- \expandafter\git@formatCommitDate\git@rawresult\relax%
- \ifgit@opt@FormatTime%
- \git@opt@FormatInterDateTime%
- \expandafter\git@formatCommitTime\git@rawresult\relax%
+\newcommand{\gitcommitdate}[1][]{&
+ \git@commitdate[#1]&
+ \ifgit@opt@FormatDate&
+ \expandafter\git@formatCommitDate\git@rawresult\relax&
+ \ifgit@opt@FormatTime&
+ \git@opt@FormatInterDateTime&
+ \expandafter\git@formatCommitTime\git@rawresult\relax&
\fi
- \else\ifgit@opt@FormatTime%
- \expandafter\git@formatCommitTime\git@rawresult\relax%
+ \else\ifgit@opt@FormatTime&
+ \expandafter\git@formatCommitTime\git@rawresult\relax&
\else
- \git@result%
- \fi\fi%
+ \git@result&
+ \fi\fi&
}
% \end{macrocode}
%\end{macro}
@@ -409,10 +430,10 @@ Licensed under GPL v3.
%\begin{macro}{\git@commitdate}
% Like \cs{gitcommitdate}, but does not return the output.
% \begin{macrocode}
-\newcommand{\git@commitdate}[1][]{%
- \pgfkeys{/git,default,#1}%
- \git@command{git log -n 1 --date=iso \git@opt@Revision
- | grep Date | head -1 | cut -d' ' -f2-}%
+\newcommand{\git@commitdate}[1][]{&
+ \pgfkeys{/git,default,#1}&
+ \git@command{git log -n 1 --format=%ai
+ \git@opt@Revision\git@space -- \git@opt@File}&
}
% \end{macrocode}
%\end{macro}
@@ -422,7 +443,7 @@ Licensed under GPL v3.
% \gitoptions{directory,revision}
%
% \begin{macrocode}
-\newcommand{\gitcommitauthor}[1][]{%
+\newcommand{\gitcommitauthor}[1][]{&
\git@commitauthor[#1]\git@result}
% \end{macrocode}
%\end{macro}
@@ -430,10 +451,10 @@ Licensed under GPL v3.
%\begin{macro}{\git@commitauthor}
% Like \cs{gitcommitauthor}, but does not return the output.
% \begin{macrocode}
-\newcommand{\git@commitauthor}[1][]{%
- \pgfkeys{/git,default,#1}%
- \git@command{git log -n 1 \git@opt@Revision
- | grep Author | head -1 | cut -d' ' -f2-}%
+\newcommand{\git@commitauthor}[1][]{&
+ \pgfkeys{/git,default,#1}&
+ \git@command{git log -n 1 --format='%an <%ae>'
+ \git@opt@Revision\git@space -- \git@opt@File}&
}
% \end{macrocode}
%\end{macro}
@@ -443,7 +464,7 @@ Licensed under GPL v3.
% \gitoptions{directory,revision}
%
% \begin{macrocode}
-\newcommand{\gitcommitauthorname}[1][]{%
+\newcommand{\gitcommitauthorname}[1][]{&
\git@commitauthorname[#1]\git@result}
% \end{macrocode}
%\end{macro}
@@ -451,10 +472,10 @@ Licensed under GPL v3.
%\begin{macro}{\git@commitauthorname}
% Like \cs{gitcommitauthorname}, but does not return the output.
% \begin{macrocode}
-\newcommand{\git@commitauthorname}[1][]{%
- \pgfkeys{/git,default,#1}%
- \git@command{git log -n 1 \git@opt@Revision
- | grep Author | head -1 | cut -d' ' -f2- | cut -d'<' -f1}%
+\newcommand{\git@commitauthorname}[1][]{&
+ \pgfkeys{/git,default,#1}&
+ \git@command{git log -n 1 --format=%an
+ \git@opt@Revision\git@space -- \git@opt@File}&
}
% \end{macrocode}
%\end{macro}
@@ -464,7 +485,7 @@ Licensed under GPL v3.
% \gitoptions{directory,revision}
%
% \begin{macrocode}
-\newcommand{\gitcommitauthoremail}[1][]{%
+\newcommand{\gitcommitauthoremail}[1][]{&
\git@commitauthoremail[#1]\git@result}
% \end{macrocode}
%\end{macro}
@@ -472,11 +493,10 @@ Licensed under GPL v3.
%\begin{macro}{\git@commitauthoremail}
% Like \cs{gitcommitauthoremail}, but does not return the output.
% \begin{macrocode}
-\newcommand{\git@commitauthoremail}[1][]{%
- \pgfkeys{/git,default,#1}%
- \git@command{git log -n 1 \git@opt@Revision
- | grep Author | head -1 | cut -d' ' -f2-
- | cut -d'<' -f2 | cut -d'>' -f1}%
+\newcommand{\git@commitauthoremail}[1][]{&
+ \pgfkeys{/git,default,#1}&
+ \git@command{git log -n 1 --format=%ae
+ \git@opt@Revision\git@space -- \git@opt@File}&
}
% \end{macrocode}
%\end{macro}
@@ -484,10 +504,11 @@ Licensed under GPL v3.
%\begin{macro}{\git@commitparent}
% Get the hash of the first parent.
% \begin{macrocode}
-\newcommand{\git@commitparent}[1][]{%
- \pgfkeys{/git,default,#1}%
- \git@command{git log -n 1 --pretty=raw \git@opt@Revision
- | grep parent | head -1 | cut -d' ' -f2}%
+\newcommand{\git@commitparent}[1][]{&
+ \pgfkeys{/git,default,#1}&
+ \git@command{git log -n 1 --format=%p
+ \git@opt@Revision\git@space -- \git@opt@File
+ | cut -d' ' -f2}&
}
% \end{macrocode}
%\end{macro}
@@ -496,7 +517,7 @@ Licensed under GPL v3.
% Record the full \git{} commit history (following first parents using
% \cs{git@commitparent}) using \cs{changes}.
% \begin{macrocode}
-\newcommand{\gitchanges}[1][]{%
+\newcommand{\gitchanges}[1][]{&
\git@changes[#1]{HEAD}
}
% \end{macrocode}
@@ -505,26 +526,31 @@ Licensed under GPL v3.
%\begin{macro}{\git@changes}
% Like \cs{gitchanges}, but accepts an extra argument for the revision.
% \begin{macrocode}
-\newcommand{\git@changes}[2][]{%
- \edef\git@@revision{#2}%
- \git@commithash[revision=\git@@revision]%
- \edef\git@@thishash{\git@rawresult}%
- \git@command{git log -n 1 --date=iso \git@@revision
- | grep Date | head -1 | cut -d' ' -f4}%
- \edef\git@@thisdate{\git@rawresult}%
- \git@commitmsg[revision=\git@@revision]%
- \edef\git@@thismsg{\git@rawresult}%
- \changes{\git@@thisdate\unskip: \git@@thishash}\git@@thisdate\git@@thismsg%
- \git@commitparent[revision=\git@@revision]%
- \let\git@@parent\git@rawresult%
+\newcommand{\git@changes}[2][]{&
+ \edef\git@@revision{#2}&
+ \git@commithash[revision=\git@@revision]&
+ \edef\git@@thishash{\git@rawresult}&
+ \git@command{git log -n 1 --format=%ad --date=short \git@opt@Revision}&
+ \edef\git@@thisdate{\git@rawresult}&
+ \git@commitmsg[revision=\git@@revision]&
+ & TODO: this removes '=' characters because they break \changes, but the real
+ & solution would be to put something back that restores these characters.
+ \StrSubstitute[0]{\git@rawresult}{=}{}[\git@@thismsg]&
+ \changes{\git@@thisdate\unskip: \git@@thishash}{\git@@thisdate}{\git@@thismsg}&
+ \git@commitparent[revision=\git@@revision]&
+ \let\git@@parent\git@rawresult&
\setbox0=\hbox{\git@@parent\unskip}\ifdim\wd0=0pt
- \else%
- \git@changes{\git@@parent}%
- \fi%
+ \else&
+ \git@changes{\git@@parent}&
+ \fi&
}
% \end{macrocode}
%\end{macro}
%
+%Reset the catcodes for \verb$%$ and \verb$&$:
+% \begin{macrocode}
+\catcode`\&=4\catcode`\%=14
+% \end{macrocode}
%
% \begin{comment}
%</package>
diff --git a/Master/texmf-dist/tex/latex/latexgit/latexgit.sty b/Master/texmf-dist/tex/latex/latexgit/latexgit.sty
index e6fd11b02fb..f89079ab67e 100644
--- a/Master/texmf-dist/tex/latex/latexgit/latexgit.sty
+++ b/Master/texmf-dist/tex/latex/latexgit/latexgit.sty
@@ -8,7 +8,7 @@
%% latexgit
%% Author: Camil Staps <info@camilstaps.nl>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{latexgit}[2016/08/24]
+\ProvidesPackage{latexgit}[2020/03/18]
\RequirePackage{pgfkeys}
\RequirePackage{datetime}
@@ -22,6 +22,7 @@
/git/.is family, /git,
default/.style={
directory=.,
+ file=,
formatDate=false,
formatInterDateTime=\space{}at\space{},
formatTime=false,
@@ -30,6 +31,7 @@
shortHash=true,
},
directory/.estore in=\git@opt@Directory,
+ file/.estore in=\git@opt@File,
formatDate/.is if=git@opt@FormatDate,
formatInterDateTime/.estore in=\git@opt@FormatInterDateTime,
formatTime/.is if=git@opt@FormatTime,
@@ -54,100 +56,104 @@
\endgroup%
\fi%
}
-\newcommand{\gitcommithash}[1][]{%
+\catcode`\&=14\catcode`\%=11
+\def\git@space{ }
+\newcommand{\gitcommithash}[1][]{&
\git@commithash[#1]\git@result}
-\newcommand{\git@commithash}[1][]{%
- \pgfkeys{/git,default,#1}%
- \ifgit@opt@ShortHash%
- \git@command{git log -n 1 --oneline \git@opt@Revision
- | cut -d' ' -f1}%
- \else%
- \git@command{git log -n 1 \git@opt@Revision
- | head -1 | cut -d' ' -f2}%
- \fi%
+\newcommand{\git@commithash}[1][]{&
+ \pgfkeys{/git,default,#1}&
+ \ifgit@opt@ShortHash&
+ \git@command{git log -n 1 --format=%h
+ \git@opt@Revision\git@space -- \git@opt@File}&
+ \else&
+ \git@command{git log -n 1 --format=%H
+ \git@opt@Revision\git@space -- \git@opt@File}&
+ \fi&
}
-\newcommand{\gitcommitmsg}[1][]{%
+\newcommand{\gitcommitmsg}[1][]{&
\git@commitmsg[#1]\git@result}
-\newcommand{\git@commitmsg}[1][]{%
- \pgfkeys{/git,default,#1}%
- \git@command{git log -n 1 --oneline \git@opt@Revision
- | cut -d' ' -f2-}%
+\newcommand{\git@commitmsg}[1][]{&
+ \pgfkeys{/git,default,#1}&
+ \git@command{git log -n 1 --format=%B
+ \git@opt@Revision\git@space -- \git@opt@File}&
}
-\def\git@formatCommitDate#1-#2-#3 #4:#5:#6 +#7\relax{%
- \formatdate{#3}{#2}{#1}%
+\def\git@formatCommitDate#1-#2-#3 #4:#5:#6 +#7\relax{&
+ \formatdate{#3}{#2}{#1}&
}
-\def\git@formatCommitTime#1-#2-#3 #4:#5:#6 +#7\relax{%
- \formattime{#4}{#5}{#6}%
- \ifgit@opt@ShowTimeZone%
- \space(+#7\unskip)%
- \fi%
+\def\git@formatCommitTime#1-#2-#3 #4:#5:#6 +#7\relax{&
+ \formattime{#4}{#5}{#6}&
+ \ifgit@opt@ShowTimeZone&
+ \space(+#7\unskip)&
+ \fi&
}
-\newcommand{\gitcommitdate}[1][]{%
- \git@commitdate[#1]%
- \ifgit@opt@FormatDate%
- \expandafter\git@formatCommitDate\git@rawresult\relax%
- \ifgit@opt@FormatTime%
- \git@opt@FormatInterDateTime%
- \expandafter\git@formatCommitTime\git@rawresult\relax%
+\newcommand{\gitcommitdate}[1][]{&
+ \git@commitdate[#1]&
+ \ifgit@opt@FormatDate&
+ \expandafter\git@formatCommitDate\git@rawresult\relax&
+ \ifgit@opt@FormatTime&
+ \git@opt@FormatInterDateTime&
+ \expandafter\git@formatCommitTime\git@rawresult\relax&
\fi
- \else\ifgit@opt@FormatTime%
- \expandafter\git@formatCommitTime\git@rawresult\relax%
+ \else\ifgit@opt@FormatTime&
+ \expandafter\git@formatCommitTime\git@rawresult\relax&
\else
- \git@result%
- \fi\fi%
+ \git@result&
+ \fi\fi&
}
-\newcommand{\git@commitdate}[1][]{%
- \pgfkeys{/git,default,#1}%
- \git@command{git log -n 1 --date=iso \git@opt@Revision
- | grep Date | head -1 | cut -d' ' -f2-}%
+\newcommand{\git@commitdate}[1][]{&
+ \pgfkeys{/git,default,#1}&
+ \git@command{git log -n 1 --format=%ai
+ \git@opt@Revision\git@space -- \git@opt@File}&
}
-\newcommand{\gitcommitauthor}[1][]{%
+\newcommand{\gitcommitauthor}[1][]{&
\git@commitauthor[#1]\git@result}
-\newcommand{\git@commitauthor}[1][]{%
- \pgfkeys{/git,default,#1}%
- \git@command{git log -n 1 \git@opt@Revision
- | grep Author | head -1 | cut -d' ' -f2-}%
+\newcommand{\git@commitauthor}[1][]{&
+ \pgfkeys{/git,default,#1}&
+ \git@command{git log -n 1 --format='%an <%ae>'
+ \git@opt@Revision\git@space -- \git@opt@File}&
}
-\newcommand{\gitcommitauthorname}[1][]{%
+\newcommand{\gitcommitauthorname}[1][]{&
\git@commitauthorname[#1]\git@result}
-\newcommand{\git@commitauthorname}[1][]{%
- \pgfkeys{/git,default,#1}%
- \git@command{git log -n 1 \git@opt@Revision
- | grep Author | head -1 | cut -d' ' -f2- | cut -d'<' -f1}%
+\newcommand{\git@commitauthorname}[1][]{&
+ \pgfkeys{/git,default,#1}&
+ \git@command{git log -n 1 --format=%an
+ \git@opt@Revision\git@space -- \git@opt@File}&
}
-\newcommand{\gitcommitauthoremail}[1][]{%
+\newcommand{\gitcommitauthoremail}[1][]{&
\git@commitauthoremail[#1]\git@result}
-\newcommand{\git@commitauthoremail}[1][]{%
- \pgfkeys{/git,default,#1}%
- \git@command{git log -n 1 \git@opt@Revision
- | grep Author | head -1 | cut -d' ' -f2-
- | cut -d'<' -f2 | cut -d'>' -f1}%
+\newcommand{\git@commitauthoremail}[1][]{&
+ \pgfkeys{/git,default,#1}&
+ \git@command{git log -n 1 --format=%ae
+ \git@opt@Revision\git@space -- \git@opt@File}&
}
-\newcommand{\git@commitparent}[1][]{%
- \pgfkeys{/git,default,#1}%
- \git@command{git log -n 1 --pretty=raw \git@opt@Revision
- | grep parent | head -1 | cut -d' ' -f2}%
+\newcommand{\git@commitparent}[1][]{&
+ \pgfkeys{/git,default,#1}&
+ \git@command{git log -n 1 --format=%p
+ \git@opt@Revision\git@space -- \git@opt@File
+ | cut -d' ' -f2}&
}
-\newcommand{\gitchanges}[1][]{%
+\newcommand{\gitchanges}[1][]{&
\git@changes[#1]{HEAD}
}
-\newcommand{\git@changes}[2][]{%
- \edef\git@@revision{#2}%
- \git@commithash[revision=\git@@revision]%
- \edef\git@@thishash{\git@rawresult}%
- \git@command{git log -n 1 --date=iso \git@@revision
- | grep Date | head -1 | cut -d' ' -f4}%
- \edef\git@@thisdate{\git@rawresult}%
- \git@commitmsg[revision=\git@@revision]%
- \edef\git@@thismsg{\git@rawresult}%
- \changes{\git@@thisdate\unskip: \git@@thishash}\git@@thisdate\git@@thismsg%
- \git@commitparent[revision=\git@@revision]%
- \let\git@@parent\git@rawresult%
+\newcommand{\git@changes}[2][]{&
+ \edef\git@@revision{#2}&
+ \git@commithash[revision=\git@@revision]&
+ \edef\git@@thishash{\git@rawresult}&
+ \git@command{git log -n 1 --format=%ad --date=short \git@opt@Revision}&
+ \edef\git@@thisdate{\git@rawresult}&
+ \git@commitmsg[revision=\git@@revision]&
+ & TODO: this removes '=' characters because they break \changes, but the real
+ & solution would be to put something back that restores these characters.
+ \StrSubstitute[0]{\git@rawresult}{=}{}[\git@@thismsg]&
+ \changes{\git@@thisdate\unskip: \git@@thishash}{\git@@thisdate}{\git@@thismsg}&
+ \git@commitparent[revision=\git@@revision]&
+ \let\git@@parent\git@rawresult&
\setbox0=\hbox{\git@@parent\unskip}\ifdim\wd0=0pt
- \else%
- \git@changes{\git@@parent}%
- \fi%
+ \else&
+ \git@changes{\git@@parent}&
+ \fi&
}
+\catcode`\&=4\catcode`\%=14
%% Copyright (c) 2016 Camil Staps <info@camilstaps.nl>
%% Licensed under GPL v3.
%%