private void SetBranchName(bool supressEvent = false)
{
using (var repository = GetRepository())
{
//logic getting complicated time to break it out
if (_savedState.Operation != repository.Info.CurrentOperation)
{
_savedState.Operation = repository.Info.CurrentOperation;
_savedState.BranchName = null;
}
if (string.IsNullOrWhiteSpace(_savedState.BranchName) ||
!string.Equals(_savedState.BranchName, repository.Head.FriendlyName))
{
//if ((string.IsNullOrWhiteSpace(repository.Head.FriendlyName) && string.Equals(_cachedBranchName, "master")) )
//{
var newBranchName = string.IsNullOrWhiteSpace(repository.Head.FriendlyName)
? "master"
: repository.Head.FriendlyName;
if (string.Equals(_savedState.BranchName, newBranchName))
{
supressEvent = true;
}
else
{
_savedState.BranchName = newBranchName;
_branchDisplayName = null;
}
if (!supressEvent)
{
FireBranchChangedEvent(_savedState.BranchName);
}
//}
}
}
}