-
-
Save iegik/3450385 to your computer and use it in GitHub Desktop.
Oneliner to convert svn:ignore into .gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat .gitignore | sed 's/^/\.\//g;s/\(.*\)\/\([0-9a-zA-Z\*\?\.]*\)$/svn propedit svn:ignore "\2" \1 /mg' | bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
svn propget -R svn:ignore | grep -v "^$" | sed "s/\(\(.*\) - \)\(.*\)/\2\/\3/g" | sort -u >> .gitignore |
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 :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@svendhhh Sure. Thanks!