Select Git revision
Forked from
Gregory Ashton / PyFstat
408 commits behind the upstream repository.
-
Gregory Ashton authoredGregory Ashton authored
git-tag.sh 599 B
#!/bin/bash
FILE="$1"
if [ "x$FILE" = x ]; then
echo "usage: $0 <file.tex>" >&2
exit 1
fi
TMPFILE="$FILE.tmp"
gitLOG=`git log -1 --pretty="format:%% generated by $0
\\newcommand{\\commitDATE}{%ai}
\\newcommand{\\commitID}{commitID: %H}
\\newcommand{\\commitIDshort}{commitID: %h}
"`
echo "$gitLOG" > $TMPFILE
diffcmd="git diff -- .";
diff=`$diffcmd`;
if test -n "$diff"; then
echo "\\newcommand{\\commitSTATUS}{UNCLEAN}" >> $TMPFILE
else
echo "\\newcommand{\\commitSTATUS}{CLEAN}" >> $TMPFILE
fi
if cmp -s $TMPFILE $FILE; then
rm -f $TMPFILE
else
mv -f $TMPFILE $FILE
fi