Skip to contentSkip to conversation

empty directories and git Question

DISCUSSION Anton 4 participants 4 messages Jun 15, 2016

lore
Share & tools
lore

Anton

author
#0 lore raw

Hi!

I am using git for a very long time with TextMate and Ruby on Rails, now I am working with Eclipse and Android and I have a stupid problem (or I am stupid...). Can anybody help me?

I have directories which I do not want to track in git (like gen/* an bin/*). They can be ignored by adding them to the .gitignore - works well.

But when I clone the project Eclipse shouts about the missing directories. So I tried the following:

added a .ignoreme file to "bin" and "gen", ignored everything else. Works fine, now the directory and the two .ignoreme files are added, but Eclipse does not like to have any file in the bin directory (can't build until I remove it).

So it there no way to manage bin folders of any kind in git when working with IDEs?

Thank you very much in advance!

Regards,
Anton

#1 lore raw
Quoted 12 lines · Anton

Hi!

I am using git for a very long time with TextMate and Ruby on Rails, now I am working with Eclipse and Android and I have a stupid problem (or I am stupid...). Can anybody help me?

I have directories which I do not want to track in git (like gen/* an bin/*). They can be ignored by adding them to the .gitignore - works well.

But when I clone the project Eclipse shouts about the missing directories. So I tried the following:

Quoted 8 lines

added a .ignoreme file to "bin" and "gen", ignored everything else. Works fine, now the directory and the two .ignoreme files are added, but Eclipse does not like to have any file in the bin directory (can't build until I remove it).

So it there no way to manage bin folders of any kind in git when working with IDEs?

You can't have empty directories in git. Eclipse forcing you to have a pre-created empty directory that it doesn't create itself if it doesn't exist sounds mightily weird though. I'd guess there's some setting in eclipse that tells it to automagically create or wipe the directory if it needs to. It's not like it's a small project, so I can't imagine a simple thing like that not being handled.

Signature · 7 lines
Andreas Ericsson                   [email protected]
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
#2 lore raw

Apologies to those who were CC'd on the original message, I'm resending to this list as I forgot to set plain text.

I've always wondered about that. Why do we still have this restriction? There is a sha1 hash that is equivalent to the empty tree (4b825dc642cb6eb9a060e54bf8d69288fbee4904). Why can't git just use that to represent an empty directory? I imagine things that touch the working copy may need to be updated to be aware of this, but the problem doesn't seem insurmountable.

-Kevin Ballard

Quoted 1 line · Andreas Ericsson

You can't have empty directories in git.

#3 lore raw

Re: empty directories and git

Quoted 7 lines · Kevin Ballard
Quoted 1 line · Andreas Ericsson

You can't have empty directories in git.

Apologies to those who were CC'd on the original message, I'm resending to this list as I forgot to set plain text.

Quoted 6 lines

I've always wondered about that. Why do we still have this restriction? There is a sha1 hash that is equivalent to the empty tree (4b825dc642cb6eb9a060e54bf8d69288fbee4904). Why can't git just use that to represent an empty directory? I imagine things that touch the working copy may need to be updated to be aware of this, but the problem doesn't seem insurmountable.

If I understand it correctly the problem is that git index is flat structure that contains only file (blob) info; there is currently no place in it to store information that some empty directory was added.

Adding an extension to have directories in index was considered in the past; it could even speed up git a bit, I think.

Signature · 3 lines
Jakub Narebski
Poland
ShadeHawk on #git