git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* more fancy ignoring of files ('if' in .gitignore?)
@ 2009-10-27  9:30 Sebastian Schubert
  2009-10-27  9:56 ` Michael J Gruber
  2009-10-27 10:00 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: Sebastian Schubert @ 2009-10-27  9:30 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 440 bytes --]

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?

Cheers
Sebastian

PS: Please CC my personal email address.

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: more fancy ignoring of files ('if' in .gitignore?)
  2009-10-27  9:30 more fancy ignoring of files ('if' in .gitignore?) Sebastian Schubert
@ 2009-10-27  9:56 ` Michael J Gruber
  2009-10-27 10:00 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Michael J Gruber @ 2009-10-27  9:56 UTC (permalink / raw)
  To: Sebastian Schubert; +Cc: git

Sebastian Schubert venit, vidit, dixit 27.10.2009 10:30:
> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: more fancy ignoring of files ('if' in .gitignore?)
  2009-10-27  9:30 more fancy ignoring of files ('if' in .gitignore?) Sebastian Schubert
  2009-10-27  9:56 ` Michael J Gruber
@ 2009-10-27 10:00 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2009-10-27 10:00 UTC (permalink / raw)
  To: Sebastian Schubert; +Cc: git

On 10/27/2009 10:30 AM, Sebastian Schubert wrote:
> 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?

I suggesting adding to your makefile a rule like

.gitignore: $(wildcard *.fig)
	(grep -ve \.pdf$ \.eps$ .gitignore;
	for i in $^; do echo $i; done | \
		sed -n 's/fig$/eps/p; s/eps$/pdf/p') > .gitignore.tmp
	mv .gitignore.tmp .gitignore

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-27 10:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-27  9:30 more fancy ignoring of files ('if' in .gitignore?) Sebastian Schubert
2009-10-27  9:56 ` Michael J Gruber
2009-10-27 10:00 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).