From bb301c1c784b737e5c10417a5e61eabd34df506c Mon Sep 17 00:00:00 2001 From: Matthieu Moy Date: Sun, 7 Apr 2013 16:33:59 +0200 Subject: [PATCH] Don't move generated PDF file when --output is specified Moving the PDF file to the toplevel of the temporary directory was needed for partial cleanup (keeppdf), but a side effect is that it makes $pdffile absolute, and then breaks abs_pdffile="$PWD/$pdffile". Doing this file move and make the path name absolute only if --output is not active fixes the issue. --- git-latexdiff | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/git-latexdiff b/git-latexdiff index 712aaa2..204cd55 100755 --- a/git-latexdiff +++ b/git-latexdiff @@ -364,17 +364,16 @@ if test "$compile_error" = "1" ; then exit 1 fi -if [ -f "$pdffile" ]; then +if test -n "$output" ; then + abs_pdffile="$PWD/$pdffile" + (cd "$initial_dir" && mv "$abs_pdffile" "$output") + echo "Output written on $output" +elif [ -f "$pdffile" ]; then new_pdffile="$tmpdir"/"$pdffile" mv "$pdffile" "$new_pdffile" pdffile="$new_pdffile" fi -if test -n "$output" ; then - abs_pdffile="$PWD/$pdffile" - (cd "$initial_dir" && cp "$abs_pdffile" "$output") - echo "Output written on $output" -fi if test "$view" = 1 || test "$view" = maybe && test -z "$output" ; then "$PDFVIEWER" "$pdffile"