Commit 0d16ef29 authored by Dominik Kaaser's avatar Dominik Kaaser
Browse files

add check if file .git/HEAD exists

parent 63dacc9e
Loading
Loading
Loading
Loading
+14 −10
Changes for thesis/thesis.cls: 14 added lines, 10 removed lines.
Original line number Diff line number Diff line
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{thesis}[2022/09/30 Dominik's thesis class]
\ProvidesClass{thesis}[2022/12/07 Dominik's thesis class]

\newif\ifproposal\proposalfalse
\DeclareOption{proposal}{%
@@ -14,7 +14,7 @@
\PassOptionsToClass{openright,chapterprefix=true}{scrbook}%
\fi

\LoadClass[numbers=noenddot,paper=a4,fontsize=11pt,american,headsepline=0.4pt:130mm]{scrbook}
\LoadClass[numbers=noenddot,paper=a4,fontsize=11pt,USenglish,headsepline=0.5pt:130mm]{scrbook}
\ifproposal
\def\dedication#1{}
\def\frontmatter{}
@@ -97,14 +97,18 @@ Germany
\ifproposal
\else
\usepackage{xstring}
\usepackage{catchfile}

\CatchFileDef{\headfull}{../.git/HEAD}{}
\StrGobbleRight{\headfull}{1}[\head]
\StrBehind[2]{\head}{/}[\branch]
\IfFileExists{../.git/HEAD}{%
\usepackage{catchfile}%
\CatchFileDef{\headfull}{../.git/HEAD}{}%
\StrGobbleRight{\headfull}{1}[\head]%
\StrBehind[2]{\head}{/}[\branch]%
\IfFileExists{../.git/refs/heads/\branch}{%
    \CatchFileDef{\commit}{../.git/refs/heads/\branch}{}}{%
    \newcommand{\commit}{unknown}}
    \newcommand{\commit}{unknown}}%
}{%
    \newcommand{\branch}{unknown}%
    \newcommand{\commit}{unknown}%
}
\fi
% Define location field
\def\location#1{\gdef\@location{#1}}
@@ -115,7 +119,7 @@ Germany
\long\def\@dcm@s#1{\@ifnextchar\and{}{\@ifnextchar\@dcm@end{\@gobble}{\@dcm@s}}}

\long\def\supervisors#1{%
\publishers{\large\raggedright Proposal submitted to the Institute for Data Engineering\newline at the Hamburg University of Technology.
\publishers{\large\raggedright submitted to the Institute for Data Engineering\newline at the Hamburg University of Technology.

\vspace{2cm}

@@ -138,7 +142,7 @@ Germany
}%
\else
\def\supervisors#1{%
\publishers{\large\raggedright Thesis submitted to the Institute for Data Engineering\newline at the Hamburg University of Technology.
\publishers{\large\raggedright submitted to the Institute for Data Engineering\newline at the Hamburg University of Technology.

\vspace{2cm}
\raggedleft