nirvdrum / svn2git

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

migration of svn-ignore to .gitignore #14

Open phaidros7 opened 13 years ago

phaidros7 commented 13 years ago

would be nice to have, else I always do this after svn2git:

svn propget svn:ignore -R svn://host/repo > .gitignore git add .gitignore git commit -m 'Convert svn:ignore properties to .gitignore.'

JakeWharton commented 13 years ago

svn:ignore can be set on any directory within the repository hierarchy. You would have to recursively traverse all folders and add lines prefixed with the current directory for each property found.

phaidros7 commented 13 years ago

imho "propget svn:ignore -R" gets all the ignores recursively. of course in a useless format, but after altering it suitable for git, it seems to work.

toastkid commented 13 years ago

@phaidros7 - top tip! I used it like this:

svn propget svn:ignore -R > .gitignore then in the new .gitignore file, replace " - " with "/". Might have to do a little bit of tidying. then copy .gitignore to your git folder.

nirvdrum commented 13 years ago

Seems like a nice thing to add. Pull requests are welcome if you've already done the work.

luisfaceira commented 13 years ago

This would be nice indeed.

However, I'm not sure I like this approach. Setting every ignore in a central file is a simple solution but by doing it with isolated .gitignore files in each directory it would also solve a different related issue: empty directories are not imported into git (they are oddly not supported in git).

For logging and caching logs in our frameworks, we have "svn:ignore " and that keeps those directories empty, which then are not imported into git. But if we use ".gitignore " in each folder, they would be imported since they won't be empty anymore.

I've created a simple oneliner that helps me achieve what I was talking about. There are some issues so all the help is appreciated: https://gist.github.com/1213601

aik099 commented 11 years ago

After 2 years this is still an issue. Any plans on fixing.

Without this I got every empty folder with "svn:ignore" property set to it removed in each tag/branch of imported repository.

aik099 commented 11 years ago

It seems, that git svn create-ignore option with following description: Recursively finds the svn:ignore property on directories and creates matching .gitignore files. The resulting files are staged to be committed, but are not committed. Use -r/--revision to refer to a specific revision.

Also git svn mkdirs would create empty directories, that were deleted during import. Maybe it's good idea to place empty .gitignore file in them to prevent their deletion.

aik099 commented 11 years ago

Right now I don't see other way, rather then for each branch/tag produced by "git svn" command do a single commit with all .gitignore files. Then convert branch-tags into real tag, that svn2git already does.

jamesford42 commented 1 year ago

Um, this seem to me like an super easy solution... simply make a .gitignore inside each folder, populated with its svn ignore properties. There doesn't need to be some complicated aggregation of everything into a root level .gitignore