Skip to content

Commit b707b56

Browse files
authored
Fix: Fixed an issue where Git columns were incorrectly shown in search results (#13111)
1 parent b77fdd3 commit b707b56

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

src/Files.App/Data/Models/ColumnsViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class ColumnsViewModel : ObservableObject
1212
UserLength = new GridLength(24, GridUnitType.Pixel),
1313
IsResizeable = false,
1414
};
15+
1516
[LiteDB.BsonIgnore]
1617
public ColumnViewModel IconColumn
1718
{

src/Files.App/Data/Models/CurrentInstanceViewModel.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) 2023 Files Community
22
// Licensed under the MIT License. See the LICENSE.
33

4-
using LibGit2Sharp;
5-
64
namespace Files.App.Data.Models
75
{
86
public class CurrentInstanceViewModel : ObservableObject

src/Files.App/Data/Models/DirectoryPropertiesViewModel.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ namespace Files.App.Data.Models
77
{
88
public class DirectoryPropertiesViewModel : ObservableObject
99
{
10+
private IContentPageContext ContentPageContext { get; } = Ioc.Default.GetRequiredService<IContentPageContext>();
11+
1012
// The first branch will always be the active one.
1113
public const int ACTIVE_BRANCH_INDEX = 0;
1214

@@ -86,13 +88,15 @@ public string ExtendedStatusInfo
8688

8789
public DirectoryPropertiesViewModel()
8890
{
89-
NewBranchCommand = new AsyncRelayCommand(()
91+
NewBranchCommand = new AsyncRelayCommand(()
9092
=> GitHelpers.CreateNewBranch(_gitRepositoryPath!, _localBranches[ACTIVE_BRANCH_INDEX]));
9193
}
9294

9395
public void UpdateGitInfo(bool isGitRepository, string? repositoryPath, BranchItem[] branches)
9496
{
95-
GitBranchDisplayName = isGitRepository && branches.Any()
97+
GitBranchDisplayName = isGitRepository &&
98+
branches.Any() &&
99+
!(ContentPageContext.ShellPage!.InstanceViewModel.IsPageTypeSearchResults)
96100
? branches[ACTIVE_BRANCH_INDEX].Name
97101
: null;
98102

src/Files.App/Views/LayoutModes/DetailsLayoutBrowser.xaml.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ private void UpdateSortIndicator()
205205

206206
private void FilesystemViewModel_PageTypeUpdated(object? sender, PageTypeUpdatedEventArgs e)
207207
{
208-
// Show original path and date deleted columns in Recycle Bin
209208
if (e.IsTypeRecycleBin)
210209
{
211210
ColumnsViewModel.OriginalPathColumn.Show();
@@ -217,14 +216,12 @@ private void FilesystemViewModel_PageTypeUpdated(object? sender, PageTypeUpdated
217216
ColumnsViewModel.DateDeletedColumn.Hide();
218217
}
219218

220-
// Show cloud drive item status column
221219
if (e.IsTypeCloudDrive)
222220
ColumnsViewModel.StatusColumn.Show();
223221
else
224222
ColumnsViewModel.StatusColumn.Hide();
225223

226-
// Show git columns in git repository
227-
if (e.IsTypeGitRepository)
224+
if (e.IsTypeGitRepository && !e.IsTypeSearchResults)
228225
{
229226
ColumnsViewModel.GitCommitAuthorColumn.Show();
230227
ColumnsViewModel.GitLastCommitDateColumn.Show();
@@ -241,7 +238,6 @@ private void FilesystemViewModel_PageTypeUpdated(object? sender, PageTypeUpdated
241238
ColumnsViewModel.GitStatusColumn.Hide();
242239
}
243240

244-
// Show path columns in git repository
245241
if (e.IsTypeSearchResults)
246242
ColumnsViewModel.PathColumn.Show();
247243
else

0 commit comments

Comments
 (0)