{"thread":{"id":"21372","subject":"more fancy ignoring of files ('if' in .gitignore?)","startedAt":"2009-10-27T09:30:50Z","lastAt":"2009-10-27T10:00:27Z","messageCount":3,"participants":["Sebastian Schubert","Michael J Gruber","Paolo Bonzini"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"125996","messageId":"200910271030.54571.schubert.seb@googlemail.com","threadId":"21372","inReplyTo":null,"subject":"more fancy ignoring of files ('if' in .gitignore?)","fromName":"Sebastian Schubert","fromEmail":"schubert.seb@googlemail.com","sentAt":"2009-10-27T09:30:50Z","receivedAt":"2009-10-27T09:30:50Z","isPatch":false,"sender":{"key":"schubert.seb@googlemail.com","avatar":null},"body":"Hi,\n\nI would like to ignore files if certain other files are present. In my \nspecial case, I want to ignore foo.pdf and foo.eps if foo.fig is \npresent (both pdf and eps are generated on the fly but don't belong \ninto repository). In general, I do NOT want to ignore pdf or eps. There \nare a lot of foos so I would like to have a general solution.\n\nIs this possible?\n\nCheers\nSebastian\n\nPS: Please CC my personal email address.\n"},{"id":"125998","messageId":"4AE6C3B2.9050601@drmicha.warpmail.net","threadId":"21372","inReplyTo":"200910271030.54571.schubert.seb@googlemail.com","subject":"Re: more fancy ignoring of files ('if' in .gitignore?)","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-10-27T09:56:02Z","receivedAt":"2009-10-27T09:56:02Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Sebastian Schubert venit, vidit, dixit 27.10.2009 10:30:\n> Hi,\n> \n> I would like to ignore files if certain other files are present. In my \n> special case, I want to ignore foo.pdf and foo.eps if foo.fig is \n> present (both pdf and eps are generated on the fly but don't belong \n> into repository). In general, I do NOT want to ignore pdf or eps. There \n> are a lot of foos so I would like to have a general solution.\n> \n> Is this possible?\n\nNo.\n\nYou can script around it by making e.g. your build process (which\ngenerated pdf/eps from fig) add a specific foo.pdf etc to .gitignore.\n\nIn fact, at the the time you add a fig to your repo you should add (&\ncommit) corresponding lines to .gitignore. This is the common approach.\n\nAlternatively, you can update your ignore with\n\nrm -f .gitignore;find . -name \\*.fig | while read i;do echo -e\n${i%fig}pdf \"\\n\" ${i%fig}eps >>.gitignore;done\n\nif you have no other ignore patterns in there. (This is q&d, adjust if\nyou have spaces in file names or such.)\n\nMichael\n"},{"id":"125999","messageId":"4AE6C4BB.5060403@gnu.org","threadId":"21372","inReplyTo":"200910271030.54571.schubert.seb@googlemail.com","subject":"Re: more fancy ignoring of files ('if' in .gitignore?)","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2009-10-27T10:00:27Z","receivedAt":"2009-10-27T10:00:27Z","isPatch":false,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"On 10/27/2009 10:30 AM, Sebastian Schubert wrote:\n> Hi,\n>\n> I would like to ignore files if certain other files are present. In my\n> special case, I want to ignore foo.pdf and foo.eps if foo.fig is\n> present (both pdf and eps are generated on the fly but don't belong\n> into repository). In general, I do NOT want to ignore pdf or eps. There\n> are a lot of foos so I would like to have a general solution.\n>\n> Is this possible?\n\nI suggesting adding to your makefile a rule like\n\n.gitignore: $(wildcard *.fig)\n\t(grep -ve \\.pdf$ \\.eps$ .gitignore;\n\tfor i in $^; do echo $i; done | \\\n\t\tsed -n 's/fig$/eps/p; s/eps$/pdf/p') > .gitignore.tmp\n\tmv .gitignore.tmp .gitignore\n\nPaolo\n"}]}