|
8 | 8 | \newcommand\githeadmail{GITHEADMAIL} |
9 | 9 | \newcommand\githeadcommit{GITHEADCOMMIT} |
10 | 10 | \newcommand\githeadbranch{GITHEADBRANCH} |
11 | | -\newcommand\githeadyear{1970} |
12 | | -\newcommand\githeadmonth{1} |
13 | | -\newcommand\githeadday{1} |
14 | | -\newcommand\githeadhour{0} |
15 | | -\newcommand\githeadminute{0} |
16 | | -\newcommand\githeadsecond{0} |
17 | | -\newcommand\githeadtzsign{+} |
18 | | -\newcommand\githeadtzhour{0} |
19 | | -\newcommand\githeadtzminute{0} |
| 11 | +\newcommand\GI@head@datetime{{1970}{01}{01}{00}{00}{00}{+}{00}{00}} |
20 | 12 |
|
21 | 13 | % semi-private settings |
22 | 14 | \newcommand\GI@max@depth{8} |
|
99 | 91 | \GI@set@export\githeadbranch{\githeadbranch}% |
100 | 92 | \GI@set@export\githeadauthor{\githeadauthor}% |
101 | 93 | \GI@set@export\githeadmail{\githeadmail}% |
102 | | -\GI@set@export\githeaddatetime{\githeaddatetime}}% |
| 94 | +\GI@set@export\GI@head@datetime{\GI@head@datetime}}% |
103 | 95 | \@tempa} |
104 | 96 |
|
105 | 97 | % finding the path to head |
|
233 | 225 | \GI@extract@year |
234 | 226 | \GI@extract@month@day |
235 | 227 | \edef\GI@datetime{% |
236 | | -\GI@year-\GI@two@d{\the\GI@month}-\GI@two@d\GI@day |
237 | | -T\GI@two@d\GI@hour:\GI@two@d\GI@min:\GI@two@d\GI@sec |
238 | | -\GI@tzsign\GI@two@d\GI@tzhour\GI@two@d\GI@tzmin}% |
| 228 | +{\GI@year}{\GI@two@d{\the\GI@month}}{\GI@two@d\GI@day}% |
| 229 | +{\GI@two@d\GI@hour}{\GI@two@d\GI@min}{\GI@two@d\GI@sec}% |
| 230 | +{\GI@tzsign}{\GI@two@d\GI@tzhour}{\GI@two@d\GI@tzmin}}% |
239 | 231 | \edef\@tempa{\endgroup |
240 | | -\GI@set@export@name{git#1datetime}{\GI@datetime}} |
| 232 | +\GI@set@export@name{GI@#1@datetime}{\GI@datetime}} |
241 | 233 | \@tempa} |
242 | 234 |
|
243 | 235 | \newcommand\GI@parse@timezone[5]{% |
|
248 | 240 | \newcommand\GI@two@d[1]{% |
249 | 241 | \ifnum#1<10 0\number#1\else \number#1\fi} |
250 | 242 |
|
| 243 | +% displaying date - internal macros |
| 244 | + |
| 245 | +\newcommand\GI@dt@date [9] {#1-#2-#3} |
| 246 | +\newcommand\GI@dt@time [9] {#4:#5:#6} |
| 247 | +\newcommand\GI@dt@timezone[9] {#7#8:#9} |
| 248 | +\newcommand\GI@dt@datetime[9] {#1-#2-#3T#4:#5:#6#7#8:#9} |
| 249 | + |
| 250 | +\newcommand\GI@dt@year [9] {#1} |
| 251 | +\newcommand\GI@dt@month [9] {#2} |
| 252 | +\newcommand\GI@dt@day [9] {#3} |
| 253 | +\newcommand\GI@dt@hour [9] {#4} |
| 254 | +\newcommand\GI@dt@min [9] {#5} |
| 255 | +\newcommand\GI@dt@sec [9] {#6} |
| 256 | +\newcommand\GI@dt@tzsign[9] {#7} |
| 257 | +\newcommand\GI@dt@tzhour[9] {#8} |
| 258 | +\newcommand\GI@dt@tzmin [9] {#9} |
| 259 | + |
| 260 | +\newcommand\GI@dt@today[9]{% |
| 261 | + \@ifundefined{today}{% |
| 262 | +\PackageError{git-info}{% |
| 263 | + \noexpand\today undefined! Did you load babel?}{% |
| 264 | + You cannot use \noexpand\gitXXXtoday macros if |
| 265 | + \noexpand\today is undefined.\MessageBreak |
| 266 | + This macro is usually defined by the babel package.}% |
| 267 | +}{% |
| 268 | +\begingroup |
| 269 | +\year#1 \month#2 \day#3 |
| 270 | +\today |
| 271 | +\endgroup}} |
| 272 | + |
| 273 | +% displaying date - defining user macros |
| 274 | + |
| 275 | +\newcommand\GI@def@dt@macro[2]{% |
| 276 | + \begingroup |
| 277 | + \edef\@tempa{\endgroup |
| 278 | +\noexpand\newcommand |
| 279 | +\expandafter\noexpand\csname git#1#2\endcsname{% |
| 280 | + \noexpand\expandafter |
| 281 | + \expandafter\noexpand\csname GI@dt@#2\endcsname |
| 282 | + \expandafter\noexpand\csname GI@#1@datetime\endcsname}}% |
| 283 | + \@tempa} |
| 284 | + |
| 285 | +\newcommand\GI@def@dt@collection[1]{% |
| 286 | + \GI@def@dt@macro{#1}{today}% |
| 287 | + \GI@def@dt@macro{#1}{datetime}% |
| 288 | + \GI@def@dt@macro{#1}{date}% |
| 289 | + \GI@def@dt@macro{#1}{time}% |
| 290 | + \GI@def@dt@macro{#1}{timezone}% |
| 291 | + \GI@def@dt@macro{#1}{year}% |
| 292 | + \GI@def@dt@macro{#1}{month}% |
| 293 | + \GI@def@dt@macro{#1}{day}% |
| 294 | + \GI@def@dt@macro{#1}{hour}% |
| 295 | + \GI@def@dt@macro{#1}{min}% |
| 296 | + \GI@def@dt@macro{#1}{sec}% |
| 297 | + \GI@def@dt@macro{#1}{tzsign}% |
| 298 | + \GI@def@dt@macro{#1}{tzhour}% |
| 299 | + \GI@def@dt@macro{#1}{tzmin}} |
| 300 | + |
| 301 | +\GI@def@dt@collection{head} |
| 302 | + |
251 | 303 | % main |
252 | 304 |
|
253 | 305 | \GI@check@repo@prefix |
|
0 commit comments