diff --git a/src/Files.App/Data/Models/CurrentInstanceViewModel.cs b/src/Files.App/Data/Models/CurrentInstanceViewModel.cs index 44985617370d..51947b9fbc13 100644 --- a/src/Files.App/Data/Models/CurrentInstanceViewModel.cs +++ b/src/Files.App/Data/Models/CurrentInstanceViewModel.cs @@ -139,7 +139,15 @@ public bool CanTagFilesInPage get => !isPageTypeRecycleBin && !isPageTypeFtp && !isPageTypeZipFolder; } - public bool IsGitRepository => !string.IsNullOrWhiteSpace(gitRepositoryPath); + private bool isGitRepository; + public bool IsGitRepository + { + get => isGitRepository; + set + { + SetProperty(ref isGitRepository, value); + } + } private string? gitRepositoryPath; public string? GitRepositoryPath @@ -147,8 +155,7 @@ public string? GitRepositoryPath get => gitRepositoryPath; set { - if (SetProperty(ref gitRepositoryPath, value)) - OnPropertyChanged(nameof(IsGitRepository)); + SetProperty(ref gitRepositoryPath, value); } } diff --git a/src/Files.App/Views/HomePage.xaml.cs b/src/Files.App/Views/HomePage.xaml.cs index 70c7539318c2..d4183ebaeccc 100644 --- a/src/Files.App/Views/HomePage.xaml.cs +++ b/src/Files.App/Views/HomePage.xaml.cs @@ -58,6 +58,7 @@ protected override async void OnNavigatedTo(NavigationEventArgs e) AppInstance.InstanceViewModel.IsPageTypeZipFolder = false; AppInstance.InstanceViewModel.IsPageTypeLibrary = false; AppInstance.InstanceViewModel.GitRepositoryPath = null; + AppInstance.InstanceViewModel.IsGitRepository = false; AppInstance.ToolbarViewModel.CanRefresh = true; AppInstance.ToolbarViewModel.CanGoBack = AppInstance.CanNavigateBackward; AppInstance.ToolbarViewModel.CanGoForward = AppInstance.CanNavigateForward; diff --git a/src/Files.App/Views/Shells/BaseShellPage.cs b/src/Files.App/Views/Shells/BaseShellPage.cs index 061cb608df52..67ed786fd265 100644 --- a/src/Files.App/Views/Shells/BaseShellPage.cs +++ b/src/Files.App/Views/Shells/BaseShellPage.cs @@ -251,6 +251,7 @@ protected async void FilesystemViewModel_DirectoryInfoUpdated(object sender, Eve if (InstanceViewModel.GitRepositoryPath != FilesystemViewModel.GitDirectory) { InstanceViewModel.GitRepositoryPath = FilesystemViewModel.GitDirectory; + InstanceViewModel.IsGitRepository = FilesystemViewModel.IsValidGitDirectory; InstanceViewModel.GitBranchName = headBranch is not null ? headBranch.Name