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

Commit e48b666

Browse files
Merge remote-tracking branch 'remotes/origin/enhancements/history-detail-tree-view-rollup' into enhancements/removing-old-tree-code
2 parents 88e8585 + d54e515 commit e48b666

File tree

4 files changed

+10
-41
lines changed

4 files changed

+10
-41
lines changed

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class BranchesView : Subview
3939
[NonSerialized] private int listID = -1;
4040
[NonSerialized] private BranchesMode targetMode;
4141

42-
[SerializeField] private BranchesTree treeLocals;
43-
[SerializeField] private BranchesTree treeRemotes;
42+
[SerializeField] private BranchesTree treeLocals = new BranchesTree { Title = LocalTitle };
43+
[SerializeField] private BranchesTree treeRemotes = new BranchesTree { Title = RemoteTitle, IsRemote = true };
4444
[SerializeField] private BranchesMode mode = BranchesMode.Default;
4545
[SerializeField] private string newBranchName;
4646
[SerializeField] private Vector2 scroll;
@@ -155,18 +155,6 @@ private void Render()
155155

156156
private void BuildTree()
157157
{
158-
if (treeLocals == null)
159-
{
160-
treeLocals = new BranchesTree();
161-
treeLocals.Title = LocalTitle;
162-
163-
treeRemotes = new BranchesTree();
164-
treeRemotes.Title = RemoteTitle;
165-
treeRemotes.IsRemote = true;
166-
167-
TreeOnEnable();
168-
}
169-
170158
localBranches.Sort(CompareBranches);
171159
remoteBranches.Sort(CompareBranches);
172160

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ChangesView : Subview
2828
[SerializeField] private string currentBranch = "[unknown]";
2929

3030
[SerializeField] private Vector2 treeScroll;
31-
[SerializeField] private ChangesTree treeChanges;
31+
[SerializeField] private ChangesTree treeChanges = new ChangesTree { DisplayRootNode = false, IsCheckable = true };
3232

3333
[SerializeField] private HashSet<string> gitLocks;
3434
[SerializeField] private List<GitStatusEntry> gitStatusEntries;
@@ -212,17 +212,7 @@ private void MaybeUpdateData()
212212

213213
private void BuildTree()
214214
{
215-
if (treeChanges == null)
216-
{
217-
treeChanges = new ChangesTree();
218-
treeChanges.Title = "Changes";
219-
treeChanges.DisplayRootNode = false;
220-
treeChanges.IsCheckable = true;
221-
treeChanges.PathSeparator = Environment.FileSystem.DirectorySeparatorChar.ToString();
222-
223-
TreeOnEnable();
224-
}
225-
215+
treeChanges.PathSeparator = Environment.FileSystem.DirectorySeparatorChar.ToString();
226216
treeChanges.Load(gitStatusEntries.Select(entry => new GitStatusEntryTreeData(entry, gitLocks.Contains(entry.Path))));
227217
Redraw();
228218
}

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ class HistoryView : Subview
342342
[SerializeField] private int statusAhead;
343343
[SerializeField] private int statusBehind;
344344

345-
[SerializeField] private ChangesTree treeChanges;
345+
[SerializeField] private ChangesTree treeChanges = new ChangesTree { IsSelectable = false, DisplayRootNode = false };
346346

347347
[SerializeField] private CacheUpdateEvent lastCurrentRemoteChangedEvent;
348348
[SerializeField] private CacheUpdateEvent lastLogChangedEvent;
@@ -716,17 +716,7 @@ private void Fetch()
716716

717717
private void BuildTree()
718718
{
719-
if (treeChanges == null)
720-
{
721-
treeChanges = new ChangesTree();
722-
treeChanges.Title = "Changes";
723-
treeChanges.IsSelectable = false;
724-
treeChanges.DisplayRootNode = false;
725-
treeChanges.PathSeparator = Environment.FileSystem.DirectorySeparatorChar.ToString();
726-
727-
TreeOnEnable();
728-
}
729-
719+
treeChanges.PathSeparator = Environment.FileSystem.DirectorySeparatorChar.ToString();
730720
treeChanges.Load(selectedEntry.changes.Select(entry => new GitStatusEntryTreeData(entry)));
731721
Redraw();
732722
}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ class InitProjectView : Subview
1010
private const string NoRepoTitle = "To begin using GitHub, initialize a git repository";
1111
private const string NoUserOrEmailError = "Name and email not set in git. Go into the settings tab and enter the missing information";
1212

13-
[NonSerialized] private bool isBusy;
14-
[NonSerialized] private bool isUserDataPresent;
15-
[NonSerialized] private bool hasCompletedInitialCheck;
13+
[SerializeField] private bool hasCompletedInitialCheck;
14+
[SerializeField] private bool isUserDataPresent;
1615

1716
[SerializeField] private CacheUpdateEvent lastCheckUserChangedEvent;
17+
18+
[NonSerialized] private bool isBusy;
1819
[NonSerialized] private bool userHasChanges;
1920

2021
public override void OnEnable()

0 commit comments

Comments
 (0)