-
Notifications
You must be signed in to change notification settings - Fork 288
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Since I wasn't sure how you would prefer to address this, I only opened an issue and didn't submit a pull request directly.
Reproduction
- Demo directory structure
projects/
├── first/
│ └── .git/
├── second/
│ └── .git/
└── ...
- Set the
Default Clone Dir
to the path whereprojects
is located.

-
Click
Rescan Repositories in Default Clone Dir
. -
SourceGit will crash and exit immediately.
Cause of the Bug
Ref: 089f24b
var normalizedRoot = rootDir.FullName.Replace("\\", "/");
var prefixLen = normalizedRoot.EndsWith('/') ? normalizedRoot.Length : normalizedRoot.Length + 1;
foreach (var f in founded)
{
var fullpath = new DirectoryInfo(f);
var relative = fullpath.Parent!.FullName.Replace("\\", "/").Substring(prefixLen);
var group = FindOrCreateGroupRecursive(Preference.Instance.RepositoryNodes, relative);
Preference.Instance.FindOrAddNodeByRepositoryPath(f, group, false);
}
normalizedRoot = /Users/chiahong/Documents/projects
prefixLen = normalizedRoot.Length + 1 = 35
fullpath = /Users/chiahong/Documents/projects/first
fullpath.Parent!.FullName = /Users/chiahong/Documents/projects
.Substring(35)
--> index larger than the length of the string
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working