OpenHome.Git.Repository.FindMaster C# (CSharp) Method

FindMaster() private method

private FindMaster ( ) : string
return string
        private string FindMaster()
        {
            var head = new FileStream(Path.Combine(iFolderGit.FullName, "HEAD"), FileMode.Open, FileAccess.Read);

            using (var reader = new StreamReader(head))
            {
                var contents = reader.ReadLine();

                string[] parts = contents.Split(new char[] { ' ' });

                if (parts.Length != 2)
                {
                    throw (new GitHeadCorruptException());
                }

                if (parts[0] != "ref:")
                {
                    throw (new GitHeadCorruptException());
                }

                if (!parts[1].StartsWith("refs/heads/"))
                {
                    throw (new GitHeadCorruptException());
                }

                return (parts[1].Substring(11));
            }
        }