Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh the left panel when it's shown #10285

Merged
merged 1 commit into from
Oct 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 6 additions & 9 deletions GitUI/CommandsDialogs/FormBrowse.InitRevisionGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ private void InitRevisionGrid(ObjectId? selectedId, ObjectId? firstId, bool isBl
})
.FileAndForget();
};

RevisionGrid.MenuCommands.MenuChanged += (sender, e) => _formBrowseMenus.OnMenuCommandsPropertyChanged();

RevisionGrid.FilterChanged += (sender, e) =>
{
Text = _appTitleGenerator.Generate(Module.WorkingDir, Module.IsValidGitWorkingDir(), RevisionGrid.CurrentBranch.Value, TranslatedStrings.NoBranch, e.PathFilter);
Expand All @@ -38,6 +40,7 @@ private void InitRevisionGrid(ObjectId? selectedId, ObjectId? firstId, bool isBl
revisionDiff.FallbackFollowedFile = path;
fileTree.FallbackFollowedFile = path;
};

RevisionGrid.RevisionsLoading += (sender, e) =>
{
// The FileTree tab should be shown at first start, in "filehistory" mode
Expand All @@ -54,21 +57,15 @@ private void InitRevisionGrid(ObjectId? selectedId, ObjectId? firstId, bool isBl
return;
}

// Apply filtering when:
// 1. don't show reflog, and
// 2. one of the following
// a) show the current branch only, or
// b) filter on specific branch
// (this check ignores other revision filters)
bool isFiltering = !AppSettings.ShowReflogReferences
&& (AppSettings.ShowCurrentBranchOnly || AppSettings.BranchFilterEnabled);
repoObjectsTree.Refresh(isFiltering, e.ForceRefresh, e.GetRefs);
RefreshLeftPanel(e.ForceRefresh, e.GetRefs);
};

RevisionGrid.SelectionChanged += (sender, e) =>
{
_selectedRevisionUpdatedTargets = UpdateTargets.None;
RefreshSelection();
};

RevisionGrid.ToggledBetweenArtificialAndHeadCommits += (s, e) =>
{
if (!revisionDiff.Visible)
Expand Down
18 changes: 18 additions & 0 deletions GitUI/CommandsDialogs/FormBrowse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1209,6 +1209,19 @@ private async Task FillGpgInfoAsync(GitRevision? revision)
revisionGpgInfo1.DisplayGpgInfo(info);
}

private void RefreshLeftPanel(bool forceRefresh, Func<RefsFilter, IReadOnlyList<IGitRef>> getRefs)
{
// Apply filtering when:
// 1. don't show reflog, and
// 2. one of the following
// a) show the current branch only, or
// b) filter on specific branch
// (this check ignores other revision filters)
bool isFiltering = !AppSettings.ShowReflogReferences
&& (AppSettings.ShowCurrentBranchOnly || AppSettings.BranchFilterEnabled);
repoObjectsTree.Refresh(isFiltering, forceRefresh, getRefs);
}

private void OpenToolStripMenuItemClick(object sender, EventArgs e)
{
GitModule? module = FormOpenDirectory.OpenModule(this, Module);
Expand Down Expand Up @@ -2933,6 +2946,11 @@ private void toggleBranchTreePanel_Click(object sender, EventArgs e)
new Dictionary<string, string> { { "ShowLeftPanel", MainSplitContainer.Panel1Collapsed.ToString() } });

RefreshLayoutToggleButtonStates();

if (!MainSplitContainer.Panel1Collapsed)
{
RefreshLeftPanel(forceRefresh: true, new FilteredGitRefsProvider(UICommands.GitModule).GetRefs);
RussKie marked this conversation as resolved.
Show resolved Hide resolved
}
}

private void CommitInfoPositionClick(object sender, EventArgs e)
Expand Down