Use the GetCommonRoot() method from the CTGitPath class instead of trying to do it...
treea094f225594e13a36d49baad38133f5c2f2d7c0a
-rw-r--r-- 458 .gitignore
-rw-r--r-- 977 .gitmodules
-rw-r--r-- 639 .mailmap
-rw-r--r-- 231 .tgitconfig
drwxr-xr-x - Languages
-rw-r--r-- 3974 README.md
-rw-r--r-- 2983 appveyor.yml
-rw-r--r-- 6137 architecture.txt
-rw-r--r-- 2589 build.txt
drwxr-xr-x - contrib
drwxr-xr-x - doc
drwxr-xr-x - ext
-rw-r--r-- 952 release.txt
drwxr-xr-x - src
drwxr-xr-x - test