git and empty directories

265 weergaven
Naar het eerste ongelezen bericht

Pete Yandell

ongelezen,
26 nov 2007, 22:59:2126-11-2007
aan Ruby on Rails Oceania
Just playing with git after being inspired by RailsCamp (what a
blast...great to meet all the interstate folks!) and I've noticed that
it doesn't commit empty directories, or directories that it considers
empty thanks to files it's ignoring. That means my Rails log and tmp
directories get left out, which is a bad thing.

Anyone know if there's a simple way around this?

Pete
http://notahat.com/

Tim Lucas

ongelezen,
26 nov 2007, 23:09:4326-11-2007
aan rails-...@googlegroups.com

Yep... just touch an empty .gitignore inside the directory is the
workaround.

I followed the archived long git thread around why it doesn't index
empty directories... there's a reason... but it also came down to
those wanting it never contributed a solution (though linus did help
with stubbing out an approach w/ code).

-- tim

Pete Yandell

ongelezen,
27 nov 2007, 05:49:3027-11-2007
aan Ruby on Rails Oceania


On Nov 27, 3:09 pm, Tim Lucas <t.lu...@toolmantim.com> wrote:
> On 27/11/2007, at 2:59 PM, Pete Yandell wrote:
>
> > Just playing with git after being inspired by RailsCamp (what a
> > blast...great to meet all the interstate folks!) and I've noticed that
> > it doesn't commit empty directories, or directories that it considers
> > empty thanks to files it's ignoring. That means my Rails log and tmp
> > directories get left out, which is a bad thing.
>
> > Anyone know if there's a simple way around this?
>
> Yep... just touch an empty .gitignore inside the directory is the
> workaround.

Thanks Tim. That works for empty directories, but...

For a directory like tmp I don't want an empty .gitignore; I want
a .gitignore of "*" so nothing in there gets added to repository.

Problem is, putting "*" in the .gitignore file inside tmp makes git
ignore the .gitignore file, and thus treat the directory as empty, and
thus leave it out of the repository - and I'm back to square one.

- Pete

Clifford Heath

ongelezen,
27 nov 2007, 06:47:0727-11-2007
aan rails-...@googlegroups.com

Can you ignore "[^.]*" instead?

Clifford Heath.

Pete Yandell

ongelezen,
27 nov 2007, 07:44:0627-11-2007
aan rails-...@googlegroups.com

My read of the man page said the globbing wasn't that smart, but I
just tried it and it worked.

Thanks Cliff.

- Pete

Nick Poulden

ongelezen,
15 dec 2007, 11:33:4415-12-2007
aan Ruby on Rails Oceania
Hi all,

Here's a handy snippet for touching a .gitignore file in all empty
directories except the .git folder itself:

find . \( -type d -empty \) -and \( -not -regex ./\.git.* \) -exec
touch {}/.gitignore \;

Thanks,

Nick Poulden
http://www.midlandswebdesign.com
Allen beantwoorden
Auteur beantwoorden
Doorsturen
0 nieuwe berichten