trevorr / vss2git

Migrate Visual SourceSafe repositories to Git
Apache License 2.0
153 stars 116 forks source link

Needs to be migrated to newer .NET Framework version to support Long File Names #61

Open GeyserLaPunk opened 3 years ago

GeyserLaPunk commented 3 years ago

Needs to be migrated to newer .NET Framework version to support Long File Names.

Throws following error if path or name is too long:

ERROR: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
   at System.IO.Path.NewNormalizePathLimitedChecks(String path, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.InternalGetDirectoryName(String path)
   at Hpdi.Vss2Git.GitExporter.WriteStream(Stream inputStream, String path)
   at Hpdi.Vss2Git.GitExporter.WriteRevisionTo(String physical, Int32 version, String destPath)
   at Hpdi.Vss2Git.GitExporter.ReplayRevision(VssPathMapper pathMapper, Revision revision, GitWrapper git, LinkedList`1 labels)
   at Hpdi.Vss2Git.GitExporter.<>c__DisplayClass24_1.<ReplayChangeset>b__0()
   at Hpdi.Vss2Git.GitExporter.AbortRetryIgnore(ThreadStart work, MessageBoxButtons buttons)

if using runtime settings like this:

<runtime>   
        <AppContextSwitchOverrides value="Switch.System.IO.BlockLongPaths=false;Switch.System.IO.UseLegacyPathHandling=false" />   
    </runtime>

then the error become:

ERROR: Could not find a part of the path 'D:\Long\File\Path|name.sql'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Hpdi.Vss2Git.GitExporter.WriteStream(Stream inputStream, String path)
   at Hpdi.Vss2Git.GitExporter.WriteRevisionTo(String physical, Int32 version, String destPath)
   at Hpdi.Vss2Git.GitExporter.ReplayRevision(VssPathMapper pathMapper, Revision revision, GitWrapper git, LinkedList`1 labels)
   at Hpdi.Vss2Git.GitExporter.<>c__DisplayClass24_1.<ReplayChangeset>b__0()
   at Hpdi.Vss2Git.GitExporter.AbortRetryIgnore(ThreadStart work, MessageBoxButtons buttons)
shirgoldbird commented 3 years ago

@GeyserLaPunk I'm running into this same issue. Have you attempted to upgrade it yourself?

GeyserLaPunk commented 3 years ago

@GeyserLaPunk I'm running into this same issue. Have you attempted to upgrade it yourself?

I did, but unsuccessful, still hit the limit. The only way I was able to convert is to limit length of the output directory to the bare minimum.

shirgoldbird commented 3 years ago

@GeyserLaPunk I was able to get this working by editing a registry key on Windows 10 v1067. I also had to create an application manifest file. I used these instructions:

https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later

Hope this helps! I will push changes to my fork in the next few days as well.

erezwanderman commented 2 years ago

Maybe the program should analyze the longest file name and directory name before starting and check if they are supported. So you won't get stuck with an error after many hours.