Browse Source

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.
master^2
Matthieu Moy 5 years ago
parent
commit
3584933c5c
  1. 19
      git-latexdiff

19
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_dir=$(cd "$git_dir"; pwd)
git_worktree=$(pwd) git_worktree=$(pwd)
relative_main_dir=$(dirname "$main")
# make main relative to git root directory # make main relative to git root directory
if test -n "$git_prefix" ; then if test -n "$git_prefix" ; then
main=$git_prefix$main main=$git_prefix$main
@ -609,20 +610,14 @@ fi
if test "$subtree" = 1 && test -n "$git_prefix"; then if test "$subtree" = 1 && test -n "$git_prefix"; then
checkoutroot=$git_prefix 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 else
checkoutroot="." 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 fi
# Checkout a subtree, without touching the index ("git checkout" would) # Checkout a subtree, without touching the index ("git checkout" would)

Loading…
Cancel
Save