git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: more fancy ignoring of files ('if' in .gitignore?)

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Oct 27, 2009, 09:56 UTC
Message-ID
<4AE6C3B2.9050601@drmicha.warpmail.net>
In-Reply-To
<200910271030.54571.schubert.seb@googlemail.com>
Sebastian Schubert venit, vidit, dixit 27.10.2009 10:30:
Show 9 quoted lines
> Hi,
> 
> I would like to ignore files if certain other files are present. In my 
> special case, I want to ignore foo.pdf and foo.eps if foo.fig is 
> present (both pdf and eps are generated on the fly but don't belong 
> into repository). In general, I do NOT want to ignore pdf or eps. There 
> are a lot of foos so I would like to have a general solution.
> 
> Is this possible?
No.

You can script around it by making e.g. your build process (which generated pdf/eps from fig) add a specific foo.pdf etc to .gitignore.

In fact, at the the time you add a fig to your repo you should add (& commit) corresponding lines to .gitignore. This is the common approach.

Alternatively, you can update your ignore with

rm -f .gitignore;find . -name \*.fig | while read i;do echo -e ${i%fig}pdf "\n" ${i%fig}eps >>.gitignore;done

if you have no other ignore patterns in there. (This is q&d, adjust if you have spaces in file names or such.)

Michael
Previous: Sebastian SchubertNext: Paolo Bonzini
Message 2 of 3 in “more fancy ignoring of files ('if' in .gitignore?)”
  1. Sebastian SchubertOct 27, 2009
  2. Michael J GruberOct 27, 2009
  3. Paolo BonziniOct 27, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.