Skip to content
Snippets Groups Projects
Select Git revision
  • fd4406c91b2f2f2690873a72c664d0e86a13212e
  • master default protected
  • 72-improve-docs-for_optimal_setup
  • os-path-join
  • develop-GA
  • add-higher-spindown-components
  • v1.3
  • v1.2
  • v1.1.2
  • v1.1.0
  • v1.0.1
11 results

git-tag.sh

Blame
  • 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