I’ve been using git-svn for about 6 months at one particular client without any major issues (we’ve our fair share of small nuances here and there though). However, I did run into a weird problem recently.
Problem
I was doing some re-factoring on some ASP.NET MVC 3 routes for the clients app. Previously we used the /{controller}.mvc/{action}/{id} approach for routes because we were all running XP with IIS5.1 (the joys of corporate XP distribution). However, we’ve all moved up to IISExpress, which means I was able to yank the .mvc extension stuff. Upon doing so, a few parts of the app broke.
Why?
We had a route that built our menu that was at http://example.org/menu . However, we had a “menu/” folder in the Web Project. Since MVC looks for a physical file first, it was trying to load the contents of this folder as the menu. That didn’t work because there’s nothing in there but .cs files. Therefore, while re-factoring I moved the folder (as it only contained .cs files for menu generation) and put the contents into a code/ folder elsewhere. Boom, back in action. I deleted the folder in my git-svn repo and committed my changes.
Then, all of a sudden, everyone who was using SVN started having problems with the menu (it didn’t load at all). However, the three of us that use git-svn were not having the problem, the menu loaded fine. After some investigation, I noticed that my local repo did not contain a menu/ folder, but SVN contained a EMPTY menu/ folder. Since git does not recognize empty folders, it did not bring them into the local repo. Therefore my routing worked as expected (the controller took over). However, on SVN users (who use TortoiseSVN or VisualSVN integration) had problems with the menu loading. They DID have the menu/ folder locally.
Fix
I deleted the menu/ folder from the SVN repository via the SVN Repository Browser and had everyone perform an update. Now, all SVN users were back to a normal working app. I’m not sure why git-svn did not perform a remote delete on that folder in the svn repo, but regardless, that’s what caused it. An empty folder. ASP.NET MVC found the menu/ directory and figured a match was found and then it fell down because nothing could be rendered (as it should be rendered from the MenuController).
Leave a Reply
You must be logged in to post a comment.