Git and Empty Folders in the IDE

Just an FYI for anyone who uses Git Hub. I spent a bit of time scratching my head and thought I might pass this along.

If you create a folder in the IDE with no contents: they you commit it to GIT, anyone pulling the code will get an error.

Work around: Add a window to the folder , even if its not used buy the IDE.

yeah git like to think it knows better than you do what you want to do :stuck_out_tongue:

git is smarter than some of us (pointing finger at himself)…

not when it drops empty folder because no one needs/uses those… right ???
I mean how important could that empty folder be ?

And if Xojo Crashes and your let the IDE recover those crashes.

You pretty much blow you Git repository away…

I stopped using it a while ago precisely because of that.

we use svn for a lot of things internally but for some open source bits we HAVE to use git to keep up with their repositories

cant say I’ve ever had an issue with svn dropping stuff because it thought it knew better

now sure there isn’t an option to configure git to NOT do this

For public stuff git is quite alright. It is kind of a standard.

SVN is as well

perhaps, it should be possible to make a xojo ide script which will create .gitkeep in the empty folder.

Just an idea, I don’t know xojo scripting very well.

create a folder
put something in it
add that file to git ignore
empty folder will be preserved

trust me this isn’t new in git nor is it unique to xojo
http://bfy.tw/4FHC

there is .gitkeep exactly for this.

So the questions are:
Is it possible to automatically create this file file in each new folder created by xojo?
Is it possible to handle the create new folder event by xojo script and get location to this folder?

Create a feature request to make it an option.

Git really is a wonderful source control system but it’s true, it doesn’t see the world the same way as Xojo.

Git doesn’t care about folders. It doesn’t version them in any way, only the files within them.

So if there’s a file inside a folder that you’ve allowed Git to track, it will create the folder (and any others containing it, if necessary) when that file is recovered into your active directory. If there was no file in the folder to track, the folder doesn’t get recreated.

Interestingly, it’s not just when you create an empty folder in Xojo that it occurs. If you create a folder to hold a bunch of project externals like sounds, images, text files, and there are no items in the project folder that create an actual file on desk, then you’ll also get an empty folder on disk.

I’ve found a couple of work arounds. I either store additional project items in folders or I store a tiny 1-byte text file I call “folder holder.txt” in the folder (outside of the IDE). Then there’s no issue.

It’s one of several changes I’d like to see made to Xojo to help accommodate Git better, including automatically loading items on disk into projects. When sharing code libraries through subModules, new files don’t get integrated. It would be a nice option to have…

I think I’ve found the solution (mac/*nix only)

If to add it to the build settings, it should solve the problem

Add it to the Build Settings -> OS X -> … AFTER Build

  ' Run fill empty folders command for git
  dim currentFolder as string = CurrentBuildLocation + "/../"
  dim command as string = "find " + currentFolder + " -type d -empty -not -path ""./.git/*"" -exec touch {}/.gitkeep \\;"
  'print command
  call DoShellCommand(command)

http://take.ms/YfM6g

Jay: Project fixed

[quote=246980:@Kirill Pekarov]there is .gitkeep exactly for this.

So the questions are:
Is it possible to automatically create this file file in each new folder created by xojo?
Is it possible to handle the create new folder event by xojo script and get location to this folder?[/quote]
The problem is the IDE would need the know to do this on save. When you select “Xojo Project” it doesn’t create a git or svn specific project. It is generic. So to have the IDE create git-specific assets, when I may use svn, would just be weird and unwanted.

If version control saving was built into the IDE, I’m sure it would do this automatically. But for now, the IDE has no way to know your intentions.

[quote=246975:@Norman Palardy]create a folder

trust me this isn’t new in git nor is it unique to xojo
http://bfy.tw/4FHC[/quote]

Thats the whole value proposition of Xojo. Stupid stuff in other languages is handled.

This isn’t a language thing at all
Its a “git thinks its smarter than you are and knows better than you do what you want”