Back to Blog
Smartsvn ignore folder5/21/2023 This is fine for my project, but if that’s not true for you, you need to remember to go to those directories and change the svn:ignore setting. This means that any directories called bin, gen, or proguard will be ignored by svn in my example, no matter how deeply these directories are nested. Notice that every pattern in the file was ignored for every subdirectory. Great power comes with great responsibility, and this is no exception. Things to watch out for with this approach svnignore to your repository as well, so that you and/or your team can use it again it the future. Magic! And the best thing is that you can commit. What did this do? Starting from the current directory, it recursively set svn:ignore with all of the patterns listed in. svnignore, and then I did: svn propset svn:ignore -R -F. For example, this was my file for my Android project: bin Have no fear though, for the -F ( -file) flag is here to rescue you! With -F, you can specify a file that contains a list of file name patterns to ignore. Clearly, it’s not good to set svn:ignore manually like this every time: you’re wasting time, you might make typos, you might forget to include a pattern, and if you’re working on a team, you can’t share your awesome svn:ignore settings with everyone else! If you added a new subdirectory after setting svn:ignore, your new subdirectory and everything in it will not be subject your svn:ignore settings! You will have to run svn propset again. “svn, ignore all the names on this blacklist!”: the -F flag The > are, of course, just my shell prompts. Use quotations and put each name pattern to be ignored on its own line, and you’ll get to ignore a long list of items: svn propset svn:ignore -R "*.class To ignore multiple items, you’ll need to be tricky. So, when we did svn propset for *.apk, we overwrote the svn:ignore setting for *.class, and the svn:ignore setting for *.apk was overwritten when we did svn propset for Thumbs.db! As I discovered, whenever you set svn:ignore, you’re overwriting whatever value was previously set. Now, you do svn status, and you see…what?! *.class files? *.apk files? In fact, the only files that are being ignored are those pesky Thumbs.db files. Say you execute the following lines of code to ignore *.class, *.apk, and Thumbs.db files: svn propset svn:ignore -R *.class. Like magic, *.class files are now ignored! Life is beautiful. ![]() So, that was simple enough right? However, the command we used above only sets svn:ignore for the current directory: svn will not ignore *.class files in subdirectories! Fortunately, if we want *.class to be ignored in all subdirectories as well, we just need to add the -R (or -recursive) flag to specify that the command should be applied recursively: svn propset svn:ignore -R *.class. # nope Recursive property setting with -R bin or bin/ will crash and burn, and your bin directory will not be ignored. If you want svn status to tell you about the ignored files as well, you can do: svn status -no-ignore On ignoring directoriesĪ short note that when specifying a directory to be ignored, you must not put any slashes before or after it! To ignore the directory bin, just type bin. Ah, so much less output to sift through now. If you do svn status after executing that line, you’ll find that svn will not show you any *.class files in the current directory that are not under version control. Here, you’re telling svn to set the svn:ignore property, and what you want ignored are all files in the current directory (. For example: svn propset svn:ignore *.class. Then, svn will ignore all items in this directory whose name matches the pattern. You give svn:ignore a value, which is a file name pattern. How this works is that you use the command svn propset to set the property svn:ignore on a particular directory. Svn has properties, which let you specify how your repository should be handled. Below the cut, I share my newfound wisdom with you. Hours passed before I finally got svn to relax and ignore what I wanted it to. I didn’t think it would too difficult to get svn to ignore some files for me, but it turns out that svn really likes to pay attention to my files.
0 Comments
Read More
Leave a Reply. |