From 1c74c9a11b152aaacc57be967a7def6d7a28ceee Mon Sep 17 00:00:00 2001 From: Jireh Loreaux Date: Mon, 6 Apr 2020 21:43:33 -0500 Subject: [PATCH] add support for gitinfo2 --- git-latexdiff | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/git-latexdiff b/git-latexdiff index 00c3d6f..9a6e2f2 100755 --- a/git-latexdiff +++ b/git-latexdiff @@ -234,6 +234,62 @@ verbose_say () { fi } +gitinfo () { + local CURPWD=$(pwd) + echo "$git_dir" + echo "$CURPWD" + local OLDFIRSTTAG=$(git describe --tags $old 2>/dev/null) + local OLDRELTAG=$(git describe --tags --long --match '[0-9]*.*' $old 2>/dev/null) + + local NEWFIRSTTAG=$(git describe --tags $new 2>/dev/null) + local NEWRELTAG=$(git describe --tags --long --match '[0-9]*.*' $new 2>/dev/null) + + local FIRSTTAGDELIM=$([ ! -z "$OLDFIRSTTAG" ] && echo ", new:") + local RELTAGDELIM=$([ ! -z "$OLDRELTAG" ] && echo ", new:") + + # Hoover up the metadata + git --no-pager log -1 --date=short \ + --pretty=format:"\usepackage[% + shash={old: %h, + lhash={old: %H, + authname={old: %an, + authemail={old: %ae, + authsdate={old: %ad, + authidate={old: %ai, + authudate={old: %at, + commname={old: %an, + commemail={old: %ae, + commsdate={old: %ad, + commidate={old: %ai, + commudate={old: %at, + refnames={ + firsttagdescribe={$OLDFIRSTTAG$FIRSTTAGDELIM + reltag={$OLDRELTAG$RELTAGDELIM +" $old > "$CURPWD"/old.gin + + git --no-pager log -1 --date=short \ + --pretty=format:" +new: %h}, +new: %H}, +new: %an}, +new: %ae}, +new: %ad}, +new: %ai}, +new: %at}, +new: %an}, +new: %ae}, +new: %ad}, +new: %ai}, +new: %at}, +}, +$NEWFIRSTTAG}, +$NEWRELTAG} + ]{gitexinfo}" $new > "$CURPWD"/new.gin + + cd "$CURPWD" + paste -d '\0' old.gin new.gin > .git/gitHeadInfo.gin +} + old= new= main= @@ -667,6 +723,12 @@ cd .. verbose_done +# pull git commit information into a gitinfo2 style text file +cd new +mkdir .git +gitinfo +cd .. + for dir in old new do verbose "Running preparation command $prepare_cmd in $dir/$git_prefix"