Subject: Re: File extension conflict when working with git and latex

From: Junio C Hamano <[email-masked]>
Date: Fri, 21 Mar 2014 11:32:37 -0700

Matthias Beyer <[email-masked]> writes:

> I know, I can fix this by fixing the clean task in my Makefile. But
> maybe someone somewhere on this world doesn't know the git internals
> as good as me (and, of course, my coworker). Is there _any chance
> at all_ that this gets mentioned somewhere, so others don't fall into
> this pit?

Surely, we are here to please ;-)  All of us want to make sure
newbies do not shoot themselves in the foot.

But the problem is what exactly should be mentioned.  With a fresh
wound with your LaTeX project still in your mind, you may be tempted
to special case ".idx", but other newbies may inflict the same kind
of hurt on themselves with different "find" patterns, e.g.

    $ find . -name '[0-9a-f]*[0-9a-f]' -type f -print | xargs rm -f

when they know their project creates hexadecimal-numbered temoprary
files, or whatever other pattern that match the files they do not
care about, that also happens to match whatever is in $GIT_DIR.  The
only common caution that helps us to make sure "others do not fall
into this pit" is "Files and directories in $GIT_DIR are used to
record your work; do not muck with them unless you know what you are
doing e.g. manually repairing a corrupt repository", but that is a
bit lame, isn't it?

It is tempting to suggest "git clean '*.idx'", but that is a good
fit in the Makefile only when you know everybody involved in the
project works in a checkout from Git, not from a tarball extract,
and does not apply to projects in general.