In the Jan 2022 Update we added support for Git backup as a storage option for RainyDay Backup. We discuss this a bit further and provide some details on working around the long file path limitations and the plans to address this issue.
Git Backup Support
From the beginning of RainyDay Backup development we have provided the ability to download your code repos into zip files. Whilst this works well and allows you to capture a snapshot of your code at the backup time, it does not backup the commit history, so you lose some of the details.
With the Jan 2022 update to the RainyDay Backup beta, we have added the ability to backup using Git. This allows you to capture all the details from your git repos and will allow you to restore a lost repo to a high degree of detail, rather than just the code.
We offer three different strategies for Git backups that allow you to decide which approach suits you, and backup up the data the way you want.
- Checkout all branches
- Clones and checks out all branches in a single location
- Default only
- Only clones the default branch
- Store branches in Separate Folders
- Clones each branch into a separate folder
Git support is a great addition to RainyDay backup, but there is currently an issue with long file paths. Files with paths longer than 260 characters can cause an issue when checking out backups.
Long File Paths
Traditionally Windows had a limit of 260 characters as the maximum file path length for any file on the computer and many of its APIs implemented the limit too. Newer versions of Windows and .NET itself support longer files paths.
Libgit2sharp is a library we use to implement Git functionality and it has not yet been updated to provide support for long file paths. There is new version, currently in alpha, that should fix this problem in the future.
In the meantime, that are several things that can be done to work round the problem.
Shallow output location
When configuring the output location for RainyDay Backup you should choose a folder near the root of the drive you wish to save the backups too.
If you are dedicating the whole drive to the backup then great, but otherwise create a folder with as few characters as possible. For example, my output location is E:\RDB.
Mount a folder as a drive
If you can’t put the folder in a higher location on the drive, you can mount the folder as a drive and use that as the output location.
This post provides instructions on how to do this.
Shorten connection names
When calculating the output path for files, RainyDay Backup creates a sub-folder in the root output location with the name of the Connection.
You could rename the connection, by double clicking on the Connection name in Desktop connection.
By reducing the name, you can reduce the path length considerably for example changing “Copidal Development” to “CopDev” reduces the characters from19 to 6.
Moving forward we have two choices.
Firstly, we can wait for Libgit2sharp to be updated which will provide support for long file paths. This has the benefit of being a library with methods that we can call and get the results directly.
Alternatively, we can use an existing Git installation on windows via a command line. This should fix the problem, but we lose direct control of the clone/checkout process.