tup icon indicating copy to clipboard operation
tup copied to clipboard

Tup only puts first output file into .gitignore

Open kozross opened this issue 7 years ago • 4 comments

I have the following Tupfile:

.gitignore

: memetic.tex | citations.bib |> latexmk -lualatex %f |> %B.pdf %B.fdb_latexmk %B.out %B.aux %B.log %B.fls %B.bbl %B.blg

The generated .gitignore contains memetic.pdf, but none of the other targets. Am I missing something obvious here?

kozross avatar May 07 '17 03:05 kozross

Hmm, I am having trouble reproducing this. I don't have latexmk, but the .gitignore files are generated after parsing, so I did this:

$ touch memetic.tex citations.bib
$ cat Tupfile
.gitignore
: memetic.tex | citations.bib |> latexmk -lualatex %f |> %B.pdf %B.fdb_latexmk %B.out %B.aux %B.log %B.fls %B.bbl %B.blg
$ tup init
$ tup parse
[ tup ] [0.013s] Scanning filesystem...
[ tup ] [0.029s] Reading in new environment variables...
[ tup ] [0.043s] Parsing Tupfiles...
 1) [0.002s] .
 [ ] 100%
[ tup ] [0.048s] No files to delete.                                                                                                                         
[ tup ] [0.048s] Generating .gitignore files...
$ cat .gitignore 
##### TUP GITIGNORE #####
##### Lines below automatically generated by Tup.
##### Do not edit.
.tup
/.gitignore
/memetic.aux
/memetic.bbl
/memetic.blg
/memetic.fdb_latexmk
/memetic.fls
/memetic.log
/memetic.out
/memetic.pdf

Can you put together a small tarball that shows the issue? Any other things that might be relevant? (eg: which version of tup, whether or not you're using variants, etc)

gittup avatar May 07 '17 17:05 gittup

You can find the exact structure (complete with a bunch of junk files I don't want) at this repo. My tup version is 0.7.5. My project is not using variants.

kozross avatar May 07 '17 22:05 kozross

Are you sure the files aren't listed in .gitignore? Or are you just seeing that git isn't ignoring them in commands like status and diff? I still am having trouble reproducing a .gitignore file that does not have all of the files that should be present. There could still be a bug when a Tupfile is updated that causes the gitignore to not be re-generated when it should, but I haven't found it yet.

If you are just seeing changes when using 'git status' or 'git diff', I think that's because git doesn't ignore the files if they've been added/committed to the repo. Eg if I do:

$ rm -f memetic.fdb_latexmk memetic.out memetic.aux memetic.log memetic.fls memetic.bbl memetic.blg
$ tup
$ git status
...
	modified:   memetic.blg
	modified:   memetic.fdb_latexmk
	modified:   memetic.fls
	modified:   memetic.log

But if I remove the outputs and commit that first, then when tup generates them I don't see them in the status or diff output. (In both cases, the generated .gitignore file contains all outputs) -

$ git rm memetic.fdb_latexmk memetic.out memetic.aux memetic.log memetic.fls memetic.bbl memetic.blg
$ git commit -m "remove files"
$ tup
$ git status
(no changes)

gittup avatar May 12 '17 18:05 gittup

Could it have something to do with the fact that latexmk reads and writes to those files multiple times? It's a thing it has to do (its whole job is to re-run LaTeX as many times as is necessary to get everything processed).

kozross avatar May 13 '17 00:05 kozross