From 686a8c269e4de195df9fdcae9eebf0dd97482ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89lie=20Gouzien?= Date: Fri, 7 Feb 2020 12:16:55 +0100 Subject: [PATCH 1/3] Compatibility with recursive submodules. --- git-latexdiff | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-latexdiff b/git-latexdiff index 980399c..4971b67 100755 --- a/git-latexdiff +++ b/git-latexdiff @@ -628,7 +628,7 @@ 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 @@ -637,7 +637,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 ( From 3584933c5c869aba704ee84965e4602ba244ecca Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Sat, 8 Feb 2020 11:28:10 +0100 Subject: [PATCH 2/3] Fix path to PDF file (hopefully) in all conditions We need the code to work * When the command is called from the toplevel ($git_prefix empty) or not * With --whole-tree or not * With --build-dir (relative) or not We do need to cd to the place in new/ corresponding to where the command was called in the original repository to allow using "$builddir/$mainbase".pdf as a relative path, but we need to compute $builddir properly in all cases. This patch should do this. --- git-latexdiff | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/git-latexdiff b/git-latexdiff index 4971b67..18960b3 100755 --- a/git-latexdiff +++ b/git-latexdiff @@ -576,6 +576,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 @@ -609,20 +610,14 @@ 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) From ff78c30a428c116d73a1ba16e53961a3a8894200 Mon Sep 17 00:00:00 2001 From: Hugo Buddelmeijer Date: Fri, 14 Feb 2020 10:43:03 +0000 Subject: [PATCH 3/3] Fix tectonic support --- git-latexdiff | 19 +++++++++++++------ tests/tectonic/run-test.sh | 15 +++++++++++++++ 2 files changed, 28 insertions(+), 6 deletions(-) create mode 100755 tests/tectonic/run-test.sh diff --git a/git-latexdiff b/git-latexdiff index 18960b3..b05b9bc 100755 --- a/git-latexdiff +++ b/git-latexdiff @@ -656,12 +656,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 @@ -789,6 +791,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."