Skip to content
This repository was archived by the owner on Dec 5, 2024. It is now read-only.

Commit cb3b60f

Browse files
committed
Remove redundant overload and simplify comparison
Other places in the code call IsFavourite with other types of objects that aren't strings (like a GitBranch instance). We either have overloads for all of them or we just take a string and the caller should know what to pass us, less of an API footprint to worry about.
1 parent 676e8ff commit cb3b60f

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/UnityExtension/Assets/Editor/GitHub.Unity/UI/BranchesView.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -309,19 +309,9 @@ private int CompareBranches(GitBranch a, GitBranch b)
309309
return 0;
310310
}
311311

312-
private bool IsFavourite(BranchTreeNode branch)
313-
{
314-
return IsFavourite(branch.Name);
315-
}
316-
317312
private bool IsFavourite(string branchName)
318313
{
319-
if (string.IsNullOrEmpty(branchName))
320-
{
321-
return false;
322-
}
323-
324-
return favouritesList.Contains(branchName);
314+
return !String.IsNullOrEmpty(branchName) && favouritesList.Contains(branchName);
325315
}
326316

327317
private void OnLocalBranchesUpdate(IEnumerable<GitBranch> list)
@@ -636,7 +626,7 @@ private void OnTreeNodeGUI(BranchTreeNode node)
636626

637627
if (node.Type != NodeType.Folder)
638628
{
639-
var favourite = IsFavourite(node);
629+
var favourite = IsFavourite(node.Name);
640630
if (Event.current.type == EventType.Repaint)
641631
{
642632
GUI.DrawTexture(favouriteRect, favourite ? Styles.FavouriteIconOn : Styles.FavouriteIconOff);

0 commit comments

Comments
 (0)