-
-
Save iegik/3450385 to your computer and use it in GitHub Desktop.
#!/bin/bash | |
cat .gitignore | sed 's/^/\.\//g;s/\(.*\)\/\([0-9a-zA-Z\*\?\.]*\)$/svn propedit svn:ignore "\2" \1 /mg' | bash |
#!/bin/bash | |
svn propget -R svn:ignore | grep -v "^$" | sed "s/\(\(.*\) - \)\(.*\)/\2\/\3/g" | sort -u >> .gitignore |
Can I suggest adding a -u
to the sort
of svnignore2gitignore.sh to remove duplicates?
(I'm not sure why there'd be duplicates in the SVN ignore, or if could make sense there, but I'm pretty sure it doesn't make sense in .gitignore)?
I found out why I had duplicates. I had the "root" of the SVN project checked out, so was getting some entries for all branches/tags as well as root, and some duplicates that way... might not be any use to add the -u
after all?
@svendhhh Sure. Thanks!
Nice script, but I think it does not handle the case of an svn:ignore
property with multiple entries correctly. These are stored with a line break as a separator in the property value, see the following example:
File system with one folder and two individually ignored files:
a-folder-with-two-svnignore-entries/file1
a-folder-with-two-svnignore-entries/file2
Output of svn propget svn:ignore
:
a-folder-with-two-svnignore-entries - file1
file2
Would result in the following .gitignore
:
a-folder-with-two-svnignore-entries/file1
file2
So file2 is incorrectly considered as a global ignore.
Do you have an idea of how to handle this in a one-liner?
@r-eis I have no suggestions, but You may research this question and advise some changes.
This script was created for one reason - to not do a lot by hands :)
really helpful