|
15 | 15 | \newcommand\githeadminute{0} |
16 | 16 | \newcommand\githeadsecond{0} |
17 | 17 | \newcommand\githeadtzsign{+} |
18 | | -\newcommand\githeadtzhour{0} |
19 | | -\newcommand\githeadtzminute{0} |
| 18 | +\newcommand\githeadtzhour{00} |
| 19 | +\newcommand\githeadtzminute{00} |
20 | 20 |
|
21 | | -% semi-private setting |
| 21 | +% semi-private settings |
22 | 22 | \newcommand\GI@max@depth{8} |
23 | 23 | \newcommand\GI@gih@name{git-info.gih} |
24 | 24 |
|
| 25 | +% private values |
| 26 | +\newif\ifGI@is@a@repo@ |
| 27 | + |
25 | 28 | % private constants |
26 | 29 | \newcommand\GI@repo@prefix{} |
27 | 30 | \newcommand\GI@head@file{\GI@repo@prefix/.git/HEAD} |
|
51 | 54 | % finding the .git directory |
52 | 55 |
|
53 | 56 | \newcommand\GI@check@repo@prefix{% |
| 57 | + \GI@is@a@repo@true |
54 | 58 | \IfFileExists{./\GI@head@file}{% |
55 | 59 | \edef\GI@repo@prefix{./}% |
56 | 60 | }{% |
|
74 | 78 |
|
75 | 79 | \newcommand\GI@not@a@git@repo{% |
76 | 80 | \endgroup |
77 | | - \PackageError{git-info}{% |
78 | | -Current directory is not a git repository}{% |
79 | | -Check the manual for details.}% |
| 81 | + \PackageWarning{git-info}{% |
| 82 | +Current directory is not a git repository.\MessageBreak |
| 83 | +No information about current HEAD is available.\MessageBreak |
| 84 | +\protect\githead* commands are set to dummy values\@gobble} |
| 85 | + \GI@is@a@repo@false |
80 | 86 | \endinput} |
81 | 87 |
|
| 88 | +% getting all informations about HEAD |
| 89 | + |
| 90 | +\newcommand\GI@get@head@all{% |
| 91 | + \begingroup |
| 92 | + \GI@get@head@path |
| 93 | + \GI@get@branch |
| 94 | + \GI@get@head@hash |
| 95 | + \GI@get@head@infos |
| 96 | + \GI@get@gen@datetime{head}% |
| 97 | + \edef\@tempa{\endgroup |
| 98 | +\GI@set@export\githeadauthor{\githeadauthor}% |
| 99 | +\GI@set@export\githeadmail{\githeadmail}% |
| 100 | +\GI@set@export\githeadcommit{\githeadcommit}% |
| 101 | +\GI@set@export\githeadbranch{\githeadbranch}% |
| 102 | +\GI@set@export\githeadyear{\githeadyear}% |
| 103 | +\GI@set@export\githeadmonth{\githeadmonth}% |
| 104 | +\GI@set@export\githeadday{\githeadday}% |
| 105 | +\GI@set@export\githeadhour{\githeadhour}% |
| 106 | +\GI@set@export\githeadminute{\githeadminute}% |
| 107 | +\GI@set@export\githeadsecond{\githeadsecond}% |
| 108 | +\GI@set@export\githeadtzsign{\githeadtzsign}% |
| 109 | +\GI@set@export\githeadtzhour{\githeadtzhour}% |
| 110 | +\GI@set@export\githeadtzminute{\githeadtzminute}}% |
| 111 | + \@tempa} |
| 112 | + |
82 | 113 | % finding the path to head |
83 | 114 |
|
84 | 115 | \newcommand\GI@get@head@path{% |
|
247 | 278 |
|
248 | 279 | % main |
249 | 280 |
|
250 | | -\newcommand\gitgetinfos{% |
251 | | - \begingroup |
252 | | - \GI@check@repo@prefix |
253 | | - \GI@get@head@path |
254 | | - \GI@get@branch |
255 | | - \GI@get@head@hash |
256 | | - \GI@get@head@infos |
257 | | - \GI@get@gen@datetime{head}% |
258 | | - \edef\@tempa{\endgroup |
259 | | -\GI@set@export\githeadauthor{\githeadauthor}% |
260 | | -\GI@set@export\githeadmail{\githeadmail}% |
261 | | -\GI@set@export\githeadcommit{\githeadcommit}% |
262 | | -\GI@set@export\githeadbranch{\githeadbranch}% |
263 | | -\GI@set@export\githeadyear{\githeadyear}% |
264 | | -\GI@set@export\githeadmonth{\githeadmonth}% |
265 | | -\GI@set@export\githeadday{\githeadday}% |
266 | | -\GI@set@export\githeadhour{\githeadhour}% |
267 | | -\GI@set@export\githeadminute{\githeadminute}% |
268 | | -\GI@set@export\githeadsecond{\githeadsecond}% |
269 | | -\GI@set@export\githeadtzsign{\githeadtzsign}% |
270 | | -\GI@set@export\githeadtzhour{\githeadtzhour}% |
271 | | -\GI@set@export\githeadtzminute{\githeadtzminute}}% |
272 | | - \@tempa} |
| 281 | +\GI@check@repo@prefix |
| 282 | +\ifGI@is@a@repo@ |
| 283 | + \GI@get@head@all |
| 284 | +\fi |
273 | 285 |
|
274 | | -\gitgetinfos |
|
0 commit comments