GitCommands.GitModule.GetLocalTrackingBranchName C# (CSharp) Method

GetLocalTrackingBranchName() public method

public GetLocalTrackingBranchName ( string remoteName, string branch ) : string
remoteName string
branch string
return string
        public string GetLocalTrackingBranchName(string remoteName, string branch)
        {
            var branchName = remoteName.Length > 0 ? branch.Substring(remoteName.Length + 1) : branch;
            foreach (var section in LocalConfigFile.GetConfigSections())
            {
                if (section.SectionName == "branch" && section.GetValue("remote") == remoteName)
                {
                    var remoteBranch = section.GetValue("merge").Replace("refs/heads/", string.Empty);
                    if (remoteBranch == branchName)
                    {
                        return section.SubSection;
                    }
                }
            }
            return branchName;
        }
GitModule