diff --git a/git-latexdiff b/git-latexdiff index 1186508..00c3d6f 100755 --- a/git-latexdiff +++ b/git-latexdiff @@ -597,6 +597,7 @@ cd "$(git rev-parse --show-cdup)" || die "Can't cd back to repository root" git_dir=$(cd "$git_dir"; pwd) git_worktree=$(pwd) +relative_main_dir=$(dirname "$main") # make main relative to git root directory if test -n "$git_prefix" ; then main=$git_prefix$main @@ -630,26 +631,20 @@ fi if test "$subtree" = 1 && test -n "$git_prefix"; then checkoutroot=$git_prefix - # create the build directory (containing the final PDFs) if the param was set - if test -n "$use_build_dir" ; then - builddir="$git_prefix/$use_build_dir" - else - builddir="$git_prefix" - fi else checkoutroot="." - # create the build directory (containing the final PDFs) if the param was set - if test -n "$use_build_dir" ; then - builddir="$use_build_dir" - else - builddir="." - fi +fi +# create the build directory (containing the final PDFs) if the param was set +if test -n "$use_build_dir" ; then + builddir="$use_build_dir" +else + builddir="$relative_main_dir" fi # Checkout a subtree, without touching the index ("git checkout" would) (cd "$git_dir" && git archive --format=tar "$old" "$checkoutroot") | tar -xf - # Also expand the possible submodules -(cd "$git_worktree" && git submodule foreach 'git archive --format=tar "$sha1" | tar -xf - --directory '$tmpdir/old'/$path') +(cd "$git_worktree" && git submodule foreach --recursive 'git archive --format=tar "$sha1" | tar -xf - --directory '$tmpdir/old'/$displaypath') verbose_progress cd ../new || die "Cannot cd to new/" if test "$new" == "--"; then @@ -658,7 +653,7 @@ if test "$new" == "--"; then else # checkout new revision (cd "$git_dir" && git archive --format=tar "$new" "$checkoutroot") | tar -xf - - (cd "$git_worktree" && git submodule foreach 'git archive --format=tar "$sha1" | tar -xf - --directory '$tmpdir/new'/$path') + (cd "$git_worktree" && git submodule foreach --recursive 'git archive --format=tar "$sha1" | tar -xf - --directory '$tmpdir/new'/$displaypath') fi if test "$ln_untracked" = 1; then ( @@ -682,12 +677,14 @@ do verbose_done done -if [ "$ignorelatexerrors" = 1 ]; then - latexopt="$latexopt -interaction=batchmode" -elif [ "$quiet" = 1 ]; then - latexopt="$latexopt -interaction=nonstopmode" -else - latexopt="$latexopt -interaction=errorstopmode" +if test $tectonic != 1; then + if [ "$ignorelatexerrors" = 1 ]; then + latexopt="$latexopt -interaction=batchmode" + elif [ "$quiet" = 1 ]; then + latexopt="$latexopt -interaction=nonstopmode" + else + latexopt="$latexopt -interaction=errorstopmode" + fi fi # Option to use latexdiff --flatten instead of latexpand @@ -815,6 +812,11 @@ elif test "$uselatexmk" = 1; then compile_error=1 error_msg="command 'latexmk' failed." } +elif test "$tectonic" = 1; then + log_cmd tectonic.log tectonic $latexopt "$mainbase.tex" || { + compile_error=1 + error_msg="command 'tectonic' failed." + } else log_cmd pdflatex1.log $LATEX_EXEC $latexopt "$mainbase" || { compile_error=1 diff --git a/tests/tectonic/run-test.sh b/tests/tectonic/run-test.sh new file mode 100755 index 0000000..4c768eb --- /dev/null +++ b/tests/tectonic/run-test.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +die () { + echo "fatal: $*" + exit 1 +} + +cd "$(dirname "$0")/../bib" || exit + +old=b9a200a6a0c45d6c594cb3c5473edd81a7edb52c +new=cbce899ba408849a471461bb9b5d648bf02039ef + +echo "git latexdiff with --tectonic should work" +../../git-latexdiff --tectonic -v $old $new > tectonic.log 2>&1 || + die "latexdiff with --tectonic failed."