From cff8012f5f6d2ff26488cd76ed3d0d37e8815837 Mon Sep 17 00:00:00 2001 From: Sebastian Hofer Date: Thu, 6 Nov 2014 18:45:47 +0100 Subject: [PATCH] Fix problem with linking uncommited files $git_prefix is now correctly prepended to $main. This is important for recreating the original directory structure in the temporary directory when linking uncommited files. --- git-latexdiff | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/git-latexdiff b/git-latexdiff index 488c548..ee024f0 100755 --- a/git-latexdiff +++ b/git-latexdiff @@ -55,7 +55,7 @@ If "--" is used for NEW, then diff against the working directory. Options: --help this help message - --main name of the main LaTeX file + --main name of the main LaTeX file (must be in current directory!) --no-view don't display the resulting PDF file --bibtex, -b run bibtex as well as latex (pdflatex,bibtex,pdflatex,pdflatex) @@ -363,6 +363,7 @@ log_cmd () { fi } +# main is relative to initial_dir (if returned) if test -z "$main" ; then printf "%s" "No --main provided, trying to guess ... " main=$(git grep -l '^[ \t]*\\documentclass') @@ -398,7 +399,10 @@ git_dir="$(git rev-parse --git-dir)" || die "Not a git repository?" cd "$(git rev-parse --show-cdup)" || die "Can't cd back to repository root" git_dir=$(cd "$git_dir"; pwd) -main=$git_prefix/$main +# make main relative to git root directory +if test -n "$git_prefix" ; then + main=$git_prefix$main +fi mainbase=$(basename "$main" .tex) maindir=$(dirname "$main")