Skip to content

Commit 8c96b8f

Browse files
authored
Fix: Fixed issue where Git submenu was shown for non-GitHub repos (#15197)
1 parent 93e5754 commit 8c96b8f

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

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

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,23 @@ public bool CanTagFilesInPage
139139
get => !isPageTypeRecycleBin && !isPageTypeFtp && !isPageTypeZipFolder;
140140
}
141141

142-
public bool IsGitRepository => !string.IsNullOrWhiteSpace(gitRepositoryPath);
142+
private bool isGitRepository;
143+
public bool IsGitRepository
144+
{
145+
get => isGitRepository;
146+
set
147+
{
148+
SetProperty(ref isGitRepository, value);
149+
}
150+
}
143151

144152
private string? gitRepositoryPath;
145153
public string? GitRepositoryPath
146154
{
147155
get => gitRepositoryPath;
148156
set
149157
{
150-
if (SetProperty(ref gitRepositoryPath, value))
151-
OnPropertyChanged(nameof(IsGitRepository));
158+
SetProperty(ref gitRepositoryPath, value);
152159
}
153160
}
154161

src/Files.App/Views/HomePage.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ protected override async void OnNavigatedTo(NavigationEventArgs e)
5858
AppInstance.InstanceViewModel.IsPageTypeZipFolder = false;
5959
AppInstance.InstanceViewModel.IsPageTypeLibrary = false;
6060
AppInstance.InstanceViewModel.GitRepositoryPath = null;
61+
AppInstance.InstanceViewModel.IsGitRepository = false;
6162
AppInstance.ToolbarViewModel.CanRefresh = true;
6263
AppInstance.ToolbarViewModel.CanGoBack = AppInstance.CanNavigateBackward;
6364
AppInstance.ToolbarViewModel.CanGoForward = AppInstance.CanNavigateForward;

src/Files.App/Views/Shells/BaseShellPage.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ protected async void FilesystemViewModel_DirectoryInfoUpdated(object sender, Eve
251251
if (InstanceViewModel.GitRepositoryPath != FilesystemViewModel.GitDirectory)
252252
{
253253
InstanceViewModel.GitRepositoryPath = FilesystemViewModel.GitDirectory;
254+
InstanceViewModel.IsGitRepository = FilesystemViewModel.IsValidGitDirectory;
254255

255256
InstanceViewModel.GitBranchName = headBranch is not null
256257
? headBranch.Name

0 commit comments

Comments
 (0)