ftilmann / latexdiff

Compares two latex files and marks up significant differences between them. Releases on www.ctan.org and mirrors
GNU General Public License v3.0
513 stars 72 forks source link

latexdiff-git throws error when flatten is activated and there are empty tex files #242

Closed emiliogq closed 2 years ago

emiliogq commented 2 years ago

Dear,

First of all, thanks to ftilmann for this amazing work! This is a very useful tool.

Regarding this issue, I've experienced that if we have a main file which calls several files and one of those is a empty .tex file the executable says something like this:

latexdiff-git -r 44b9949 --flatten=keep-intermediate doc/srs/main.tex 
Working on  doc/srs/main.tex 
Checking out old dir into: ./latexdiff-vc-44b9949 (rev: 44b9949)
Running: latexdiff  '--flatten' "./latexdiff-vc-44b9949/doc/srs/main.tex" "doc/srs/main.tex" > "doc/srs/main-diff44b9949.tex"
Could not open file latexdiff-vc-44b9949/doc/srs/appendices/analysis_models.tex:  at /usr/bin/latexdiff line 1936.
Something went wrong in latexdiff. Deleting doc/srs/main-diff44b9949.tex and abort

The affected line is this one:

$replacement=flatten(read_file_with_encoding($fullfile, $encoding), $preamble,$filename,$encoding) or die "Could not open file ",$fullfile,": $!";

The analysis_model.tex file is an empty file, actually this is empty in the current revision and in revision 44b9949. And also is copied to the temporal directory:

 ls -l latexdiff-vc-44b9949/doc/srs/appendices/analysis_models.tex
-rw-r--r-- 1 emiliogq emiliogq 0 Aug  5 18:24 latexdiff-vc-44b9949/doc/srs/appendices/analysis_models.tex

I'm able to generate a pdf for both revisions

The latexdiff-git version that I use is 1.3.0 (debian package)

Please let me know if you need more information

Thanks!

ftilmann commented 2 years ago

Thanks for reporting