From 6eb3a7b847e716cc912c1273d6d03bc960e4cdc1 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 9 Nov 2015 22:44:07 +0000 Subject: gitinfo2 (9nov15) git-svn-id: svn://tug.org/texlive/trunk@38807 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/gitinfo2/gitexinfo.sty | 27 ++++++++++++++-------- Master/texmf-dist/tex/latex/gitinfo2/gitinfo2.sty | 20 +++++++++++++--- 2 files changed, 34 insertions(+), 13 deletions(-) (limited to 'Master/texmf-dist/tex/latex/gitinfo2') diff --git a/Master/texmf-dist/tex/latex/gitinfo2/gitexinfo.sty b/Master/texmf-dist/tex/latex/gitinfo2/gitexinfo.sty index 813fec35b57..78ecb9ea294 100644 --- a/Master/texmf-dist/tex/latex/gitinfo2/gitexinfo.sty +++ b/Master/texmf-dist/tex/latex/gitinfo2/gitexinfo.sty @@ -18,10 +18,7 @@ % and gitPseudoHeadInfo.gin % ----------------------------------------------------- \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{gitexinfo}[2014/10/03 v2.0.4 Auxiliary package for gitinfo2] -\RequirePackage{kvoptions} -\RequirePackage{xstring} -\RequirePackage{etoolbox} +\ProvidesPackage{gitexinfo}[2015/11/08 v2.0.5 Auxiliary package for gitinfo2] \SetupKeyvalOptions{family=gitinfo,prefix=gitInf@} \DeclareStringOption{shash} \DeclareStringOption{lhash} @@ -73,12 +70,22 @@ }% }% \expandafter\docsvlist\expandafter{#1}% - \StrDel{#1}{)}[\bcut]% - \StrDel{\bcut}{(HEAD}[\bcut]% - \StrCount{\bcut}{, }[\xcut]% - \StrCut[\xcut]{\bcut}{, }{\bcut}{\xcut}% - \IfEq{\xcut}{}{}{% - \renewcommand{\gitBranch}{\xcut}% + \StrDel{#1}{(}[\bcut]% + \StrDel{\bcut}{)}[\bcut]% + \IfSubStr{\bcut}{->}{% git version 2+? + \StrBetween{\bcut,}{HEAD -> }{,}[\bcut]% yes - no problem + }{% + \StrCount{\bcut}{, }[\xcut]% + \IfEq{\xcut}{0}{% detached head? + }{% no + \StrCut[\xcut]{\bcut}{, }{\lcut}{\bcut}% git vv < 2 - take last token + }% (not always accurate) + } + \IfEq{\bcut}{}{}{% + \IfEq{\bcut}{HEAD}{% detached head? + }{% no - we have the branch name + \renewcommand{\gitBranch}{\bcut}% + }% }% }% \newcommand{\git@taglist}[1]{% diff --git a/Master/texmf-dist/tex/latex/gitinfo2/gitinfo2.sty b/Master/texmf-dist/tex/latex/gitinfo2/gitinfo2.sty index c50777ff67f..bfe37398131 100644 --- a/Master/texmf-dist/tex/latex/gitinfo2/gitinfo2.sty +++ b/Master/texmf-dist/tex/latex/gitinfo2/gitinfo2.sty @@ -18,8 +18,9 @@ % and gitPseudoHeadInfo.gin % ----------------------------------------------------- \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{gitinfo2}[2014/10/03 v2.0.4 git revision information] +\ProvidesPackage{gitinfo2}[2015/11/08 v2.0.5 git revision information] \RequirePackage{etoolbox} +\RequirePackage{xstring} \RequirePackage{kvoptions} \RequirePackage{eso-pic} \SetupKeyvalOptions{family=gitinfo,prefix=gitInf@} @@ -63,7 +64,11 @@ \newcommand{\gitRoff}{} \newcommand{\gitDescribe}{(None)} \newcommand{\gitMarkPref}{[git]} -\newcommand{\gitMarkFormat}{\color{gray}\small\sffamily} +\@ifpackageloaded{xcolor}{% + \newcommand{\gitMarkFormat}{\color{gray}\small\sffamily}% +}{% + \newcommand{\gitMarkFormat}{\small\sffamily}% +} \newcommand{\gitMark}{} \newcommand{\gitWrapEmail}[1]{#1} % private values @@ -106,7 +111,7 @@ \else \edef\GI@repo@prefix{../\GI@repo@prefix}% \IfFileExists{\GI@githeadinfo@file}{% - \PackageWarningNoLine{gitinfo2}{% + \PackageInfo{gitinfo2}{% gitinfo2 found : \GI@githeadinfo@file \MessageBreak }% \GI@export@macro\GI@githeadinfo@file @@ -187,6 +192,15 @@ % --------------------------------------------------------------------- % Datetime integration % - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +\@ifpackageloaded{datetime2}{% + \IfEq{\gitAuthorDate}{\gitInf@missing}{% + \DTMsavedate{gitdate}{\THEDAY-\THEMONTH-\THEYEAR} + }{% + \StrCut{\gitAuthorDate}{-}{\gitInf@year}{\gitInf@md} + \StrCut{\gitInf@md}{-}{\gitInf@month}{\gitInf@day} + \DTMsavenoparsedate{gitdate}{\gitInf@year}{\gitInf@month}{\gitInf@day}{-1} + } +}{}% \@ifpackageloaded{datetime}{% \IfEq{\gitAuthorDate}{\gitInf@missing}{% \newdate{gitdate}{\THEDAY}{\THEMONTH}{\THEYEAR} -- cgit v1.2.3