nirvdrum / svn2git

Ruby tool for importing existing svn projects into git.
MIT License
2.11k stars 443 forks source link

Option to create empty directories. #32

Open lancew opened 12 years ago

lancew commented 12 years ago

It might be useful to have an option to handle empty directories. Perhaps something that would, when a empty directory is identified, create a empty flag file in that directory so git would maintain identical directory structure to svn? Thoughts?

jmena commented 12 years ago

I think this feature would be nice.

jpawlowski commented 12 years ago

This is definitely needed as (unfortunately) many build scripts rely on existing directories even if they are empty. As a workaround, one could use:

find . -type d -empty -exec touch {}/.gitignore \;

However this does not help in case svn2git handles multiple branches, trunks and tags as this command needs to be processed after git-svn command before the actual magic of svn2git.

andresriancho commented 11 years ago

+1 on this feature request. I migrated my project's SVN to GIT and it was a pain to identify why some stuff was failing: it was because some (empty) directories were missing. Solved it manually by adding an empty .gitignore in the empty directory.

inka commented 11 years ago

+1

BiswajitDey commented 10 years ago

+1 This feature would be helpful

jerenmb commented 9 years ago

+1

treksler commented 8 years ago

it's easy enough to add the code to preserve empty folders.

--- migration.rb.backup 2016-08-23 13:43:59.000000000 -0600
+++ migration.rb    2016-09-30 13:37:51.000000000 -0600
@@ -202,6 +202,10 @@
         run_command(cmd, true, true)
       end

+      # preserve empty directories
+      run_command("#{git_config_command} svn-remote.svn.preserve-empty-dirs true")
+      run_command("#{git_config_command} svn-remote.svn.placeholder-filename .gitkeep")
+
       run_command("#{git_config_command} svn.authorsfile #{authors}") unless authors.nil?

       cmd = "git svn fetch "

but sometimes I see this error half way through the import,

Failed to strip path '<some-path>/.gitkeep' ((?^:^trunk(/|$)))

command failed:
git svn fetch 

It seems to be resolved by re-running git svn fetch and svn2git

There are some ideas in this post, but it all seems kind of hacky https://www.semitwist.com/articles/article/view/the-better-svn-git-guide

danny13-33 commented 6 years ago

+1