Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • develop-GA
  • timeFstatmap
  • add-higher-spindown-components
  • develop-DK
  • adds-header-to-grid-search
  • v1.2
  • v1.1.2
  • v1.1.0
  • v1.0.1
10 results

git-tag.sh

Blame
  • Forked from Gregory Ashton / PyFstat
    408 commits behind the upstream repository.
    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