private void UpdateBranches(
            IReadOnlyList <Branch> sourceBranches,
            List <Commit> commits,
            RepositoryViewModel repositoryViewModel)
        {
            int maxColumn = 0;
            var branches  = repositoryViewModel.Branches;

            SetNumberOfItems(branches, sourceBranches.Count, i => branchViewModelProvider());

            int index = 0;
            List <BranchViewModel> addedBranchColumns = new List <BranchViewModel>();

            foreach (Branch sourceBranch in sourceBranches)
            {
                BranchViewModel branch = branches[index++];
                branch.Branch = sourceBranch;

                branch.ActiveBranches = repositoryViewModel.HidableBranches;
                branch.ShownBranches  = repositoryViewModel.ShownBranches;

                branch.TipRowIndex   = commits.FindIndex(c => c == sourceBranch.TipCommit);
                branch.FirstRowIndex = commits.FindIndex(c => c == sourceBranch.FirstCommit);
                int height = Converters.ToY(branch.FirstRowIndex - branch.TipRowIndex) + 8;

                branch.BranchColumn = FindFreeBranchColumn(addedBranchColumns, branch);
                maxColumn           = Math.Max(branch.BranchColumn, maxColumn);
                addedBranchColumns.Add(branch);

                branch.X = branch.Branch.IsLocalPart && branch.Branch.MainbBranch.Commits.Any()
                                        ? Converters.ToX(branch.BranchColumn) - 10
                                        : Converters.ToX(branch.BranchColumn);


                branch.HoverBrush = Brushes.Transparent;
                branch.Dashes     = sourceBranch.IsLocalPart ? "1" : "";

                branch.Rect = new Rect(
                    branch.X + 3,
                    (double)Converters.ToY(branch.TipRowIndex) + Converters.HalfRow - 6,
                    10,
                    height + 4);

                int top = sourceBranch == sourceBranch.Repository.CurrentBranch ? -3 : 2;
                branch.Line = $"M 4,{top} L 4,{height}";

                if (branch.FirstRowIndex == branch.TipRowIndex)
                {
                    branch.Line = "";
                }

                branch.SetColor(themeService.GetBranchBrush(sourceBranch));


                branch.BranchToolTip     = GetBranchToolTip(sourceBranch);
                branch.CurrentBranchName = repositoryMgr.Repository.CurrentBranch.Name;

                branch.SetNormal();

                branch.NotifyAll();

                if (branch.IsMultiBranch)
                {
                    Log.Usage($"Multibranch: {branch.Branch} in {branch.Branch.Repository.MRepository.WorkingFolder}, can be:");
                    foreach (BranchName name in branch.Branch.ChildBranchNames)
                    {
                        Log.Usage($"   Branch: {name}");
                    }
                }
            }

            repositoryViewModel.GraphWidth = Converters.ToX(maxColumn + 1);
        }