Skip to content

Instantly share code, notes, and snippets.

@manoelcampos
Last active April 21, 2017 20:56
Show Gist options
  • Save manoelcampos/b10e6738cfc84658b3616c69b975a62a to your computer and use it in GitHub Desktop.
Save manoelcampos/b10e6738cfc84658b3616c69b975a62a to your computer and use it in GitHub Desktop.
A script to make it easy the utilization of the git latexdiff, a tool to generate a PDF comparing changes in a latex project across two different commits (https://gitlab.com/git-latexdiff/git-latexdiff). Run it without parameters to see the usage.
#!/bin/bash
clear
git latexdiff --version > /dev/null
RET=$?
if [ $RET -ne 0 ]; then
echo -e "\nInstall git-latexdiff using: git clone https://gitlab.com/git-latexdiff/git-latexdiff\n";
exit $RET;
fi
echo -e "git-latexdiff from https://gitlab.com/git-latexdiff/git-latexdiff\n"
if [ "$#" -eq 0 ]; then
echo -e "Usage:" >&2
echo -e "\tCompare HEAD with previous commit: $0 old_commid_id" >&2
echo -e "\tCompare two specific commits: $0 old_commid_id new_commit_id\n" >&2
exit -1
elif [ "$#" -eq 1 ]; then
OLD_COMMIT_ID=$1
NEW_COMMIT_ID="HEAD"
else
OLD_COMMIT_ID=$1
NEW_COMMIT_ID=$2
fi
#get id of the last commit
#PREVIOUS_COMMIT_ID=`git log --skip 1 -n 1 --oneline --no-abbrev-commit | awk '{print $1}'`
echo -e "Comparing commit $NEW_COMMIT_ID with the $OLD_COMMIT_ID\n"
echo "Starting git-latexdiff"
echo "Please be patient..."
git latexdiff $OLD_COMMIT_ID $NEW_COMMIT_ID --no-cleanup --main cloudsim-plus-ccgrid.tex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment