Browse Source

Use standalone version of latexdiff if possible

That is, when `latexdiff-so` can be found, use it instead of `latexdiff`
Fixes #27.

The latexdiff manual recommends the standalone version:
> Because latexdiff uses internal functions of Algorithm:Diff whose
> calling format or availability can change without notice, the
> preferred method is now to use the standalone version.

I also added `set -o pipefail` for better erroring.
master
karldw 8 years ago
parent
commit
1f0940661c
No known key found for this signature in database GPG Key ID: EF344F2366801B4F
  1. 28
      git-latexdiff

28
git-latexdiff

@ -14,8 +14,8 @@
#
# The script internally checks out the full tree for the specified
# revisions, calls latexpand to flatten the document and then calls
# latexdiff, hence this works if the document is split into multiple
# .tex files.
# latexdiff-so (if available, otherwise latexdiff). Therefore,
# this works if the document is split into multiple .tex files.
#
# Try "git latexdiff -h" for more information.
#
@ -39,6 +39,7 @@
# Ideally, these scripts should be merged.
set -o errexit
set -o pipefail
set -o noclobber
# Used when symlinking files from the working tree: symlink .* files
# too.
@ -484,6 +485,17 @@ case "$ext" in
*) ;;
esac
# Set LATEXDIFF_EXEC to either latexdiff or latexdiff-so. Prefer
# latexdiff-so if available.
if command -v latexdiff-so >/dev/null 2>&1; then
LATEXDIFF_EXEC=latexdiff-so
elif command -v latexdiff >/dev/null 2>&1; then
LATEXDIFF_EXEC=latexdiff
else
die "latexdiff-so and latexdiff couldn't be found. Check your PATH."
fi
verbose_done "$LATEXDIFF_EXEC"
verbose "Creating temporary directories"
git_prefix=$(git rev-parse --show-prefix)
@ -633,9 +645,9 @@ if test "$flatten" = 1; then
|| die "latexpand failed for new version"
verbose_done
verbose "Running latexdiff ${latexdiffopt[*]} old-${mainbase}-fl.tex new-${mainbase}-fl.tex > ./diff.tex"
latexdiff "${latexdiffopt[@]}" old-"$mainbase"-fl.tex new-"$mainbase"-fl.tex > diff.tex \
|| die "latexdiff failed"
verbose "Running $LATEXDIFF_EXEC ${latexdiffopt[*]} old-${mainbase}-fl.tex new-${mainbase}-fl.tex > ./diff.tex"
"$LATEXDIFF_EXEC" "${latexdiffopt[@]}" old-"$mainbase"-fl.tex new-"$mainbase"-fl.tex > diff.tex \
|| die "$LATEXDIFF_EXEC failed"
verbose_done
verbose "mv ./diff.tex new/$main"
@ -643,9 +655,9 @@ if test "$flatten" = 1; then
mv -f diff.tex new/"$main"
verbose_done
else
verbose "Running latexdiff ${latexdiffopt[*]} old/$main new/$main > ./diff.tex"
latexdiff "${latexdiffopt[@]}" old/"$main" new/"$main" > diff.tex \
|| die "latexdiff failed"
verbose "Running $LATEXDIFF_EXEC ${latexdiffopt[*]} old/$main new/$main > ./diff.tex"
"$LATEXDIFF_EXEC" "${latexdiffopt[@]}" old/"$main" new/"$main" > diff.tex \
|| die "$LATEXDIFF_EXEC failed"
verbose_done
verbose "mv ./diff.tex new/$main"

Loading…
Cancel
Save