Use the GetCommonRoot() method from the CTGitPath class instead of trying to do it...