[linux-elitists] More fun* with Git and make

Don Marti dmarti at zgp.org
Thu May 1 22:29:52 PDT 2014


begin Greg KH quotation of Thu, May 01, 2014 at 04:20:27PM -0700:
> On Thu, May 01, 2014 at 02:04:19PM -0700, Don Marti wrote:
> > Some of you showed up for this...
> >   https://lwn.net/Articles/589196/
> > 
> > One more random idea.  Instead of keeping track of
> > which files need to be ignored/cleaned up in _both_
> > .gitignore and the "clean" target in Makefile...
> > 
> > clean :
> > 	find . -print0 | \
> > 	git check-ignore -z --stdin | xargs -0 rm -f
> > 
> > DRY, right?
> 
> Yes, but doesn't that "catch" your .git subtree containing your
> metadata?  It's not good to delete those files...

Good point. I can get it to do that by adding
.git/* to .gitignore which I haven't done before.
Probably safer...

clean :
	find . -path ./.git -prune -o -print0 | \
	git check-ignore -z --stdin | xargs -0 rm -f

-- 
Don Marti                    
http://zgp.org/~dmarti/
dmarti at zgp.org


More information about the linux-elitists mailing list