Open joel-coffman opened 4 years ago
Example implementation using this package:
diff --git a/assessments/graded-reviews/relational-design/charlie.tex b/assessments/graded-reviews/relational-design/charlie.tex
index 43a64a5..b224c7d 100644
--- a/assessments/graded-reviews/relational-design/charlie.tex
+++ b/assessments/graded-reviews/relational-design/charlie.tex
@@ -21,6 +21,7 @@
]{geometry}
\usepackage[acronym]{glossaries}
\usepackage{graphicx}
+\usepackage{latexgit}
\usepackage{ltablex}
\usepackage{microtype}
\usepackage{minted}
@@ -79,7 +80,6 @@
% load course information
\input{../../../course}
-\input{.version}
% document-specific glossary entries
@@ -94,6 +94,14 @@
\dashuline{#1}%
}
+\makeatletter
+\pgfkeys{/git,default}%
+\git@command{git describe --abbrev=12 --always --dirty=+}%
+\edef\version{%
+ \git@result%
+}
+\makeatother
+
\let\oldversion=\version\relax
\renewcommand*{\version}[1][\currfilebase\ (revision~\oldversion)]{%
\def\initial##1{%
Integrating directly with the graded review (GR) package would simplify this code. (Note: The redefinition of \version
at the end of the patch is due to #5.)
The LaTeXgit package supports fetching information from Git and typesetting it. This package could be used instead of creating the version identifier in the Makefile and writing it to a separate file.