windowslinuxgitsvngit-svn

git mingw32 and long path/file names under windows


I have a production SVN repository that i want to clone with git. when I try to git svn clone it I get error that has to do with some files that have a long combination of path filename.

I figure that this is a limitation caused by the GNU shell mingw32 that git uses to run since neither windows or unix has this kind of limitation.

Is there anyway to overcome this limitation ? I don't want to start changing the filenames/paths before i'm sure that I want to move to git.

Thanks.


Solution

  • This is a limitation Windows in that the MAX_PATH is 260 characters, that is a path can have a maximum of 260 characters ( so once you account for the driver letter, the colon and the initial \ and the trailing NUL, you have 256 characters for your path).

    Windows has a UNC path which can have length of about 32,767. You can get such a path by prefixing the paths with \\?\

    See here for details: http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx

    You can also look at using subst to substitute a long path with a drive name and operate on that.

    http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/subst.mspx?mfr=true

    The above are ways to overcome the limitation, but may not be wasy to apply during a git svn clone,of course. Make sure the path that you start off the clone in, is as short as possible. Use subst to assign a drive letter to the path where you are cloning and use that drive.