diff --git a/GVFS/FastFetch/GitEnlistment.cs b/GVFS/FastFetch/GitEnlistment.cs index a97318f9e7..fd08cdda01 100644 --- a/GVFS/FastFetch/GitEnlistment.cs +++ b/GVFS/FastFetch/GitEnlistment.cs @@ -13,7 +13,6 @@ private GitEnlistment(string repoRoot, string gitBinPath) repoRoot, null, gitBinPath, - gvfsHooksRoot: null, flushFileBuffersForPacks: false, authentication: null) { diff --git a/GVFS/GVFS.Common/DiskLayoutUpgrades/DiskLayoutUpgrade.cs b/GVFS/GVFS.Common/DiskLayoutUpgrades/DiskLayoutUpgrade.cs index 12f73cf97d..d268191abc 100644 --- a/GVFS/GVFS.Common/DiskLayoutUpgrades/DiskLayoutUpgrade.cs +++ b/GVFS/GVFS.Common/DiskLayoutUpgrades/DiskLayoutUpgrade.cs @@ -177,7 +177,6 @@ protected bool TrySetGitConfig(ITracer tracer, string enlistmentRoot, Dictionary enlistment = GVFSEnlistment.CreateFromDirectory( enlistmentRoot, GVFSPlatform.Instance.GitInstallation.GetInstalledGitBinPath(), - ProcessHelper.GetCurrentProcessLocation(), authentication: null); } catch (InvalidRepoException e) diff --git a/GVFS/GVFS.Common/Enlistment.cs b/GVFS/GVFS.Common/Enlistment.cs index 1c23354bae..3f061257fb 100644 --- a/GVFS/GVFS.Common/Enlistment.cs +++ b/GVFS/GVFS.Common/Enlistment.cs @@ -13,7 +13,6 @@ protected Enlistment( string workingDirectoryBackingRoot, string repoUrl, string gitBinPath, - string gvfsHooksRoot, bool flushFileBuffersForPacks, GitAuthentication authentication) { @@ -27,7 +26,6 @@ protected Enlistment( this.WorkingDirectoryBackingRoot = workingDirectoryBackingRoot; this.DotGitRoot = Path.Combine(this.WorkingDirectoryBackingRoot, GVFSConstants.DotGit.Root); this.GitBinPath = gitBinPath; - this.GVFSHooksRoot = gvfsHooksRoot; this.FlushFileBuffersForPacks = flushFileBuffersForPacks; GitProcess gitProcess = new GitProcess(this); @@ -72,7 +70,6 @@ protected Enlistment( public bool FlushFileBuffersForPacks { get; } public string GitBinPath { get; } - public string GVFSHooksRoot { get; } public GitAuthentication Authentication { get; } diff --git a/GVFS/GVFS.Common/GVFSEnlistment.cs b/GVFS/GVFS.Common/GVFSEnlistment.cs index 0b6e01fbb7..436aff18f2 100644 --- a/GVFS/GVFS.Common/GVFSEnlistment.cs +++ b/GVFS/GVFS.Common/GVFSEnlistment.cs @@ -20,14 +20,13 @@ public partial class GVFSEnlistment : Enlistment private string gvfsHooksVersion; // New enlistment - public GVFSEnlistment(string enlistmentRoot, string repoUrl, string gitBinPath, string gvfsHooksRoot, GitAuthentication authentication) + public GVFSEnlistment(string enlistmentRoot, string repoUrl, string gitBinPath, GitAuthentication authentication) : base( enlistmentRoot, Path.Combine(enlistmentRoot, GVFSConstants.WorkingDirectoryRootName), Path.Combine(enlistmentRoot, GVFSPlatform.Instance.Constants.WorkingDirectoryBackingRootPath), repoUrl, gitBinPath, - gvfsHooksRoot, flushFileBuffersForPacks: true, authentication: authentication) { @@ -40,12 +39,11 @@ public GVFSEnlistment(string enlistmentRoot, string repoUrl, string gitBinPath, } // Existing, configured enlistment - private GVFSEnlistment(string enlistmentRoot, string gitBinPath, string gvfsHooksRoot, GitAuthentication authentication) + private GVFSEnlistment(string enlistmentRoot, string gitBinPath, GitAuthentication authentication) : this( enlistmentRoot, null, gitBinPath, - gvfsHooksRoot, authentication) { } @@ -85,7 +83,6 @@ public string GVFSHooksVersion public static GVFSEnlistment CreateFromDirectory( string directory, string gitBinRoot, - string gvfsHooksRoot, GitAuthentication authentication, bool createWithoutRepoURL = false) { @@ -100,10 +97,10 @@ public static GVFSEnlistment CreateFromDirectory( if (createWithoutRepoURL) { - return new GVFSEnlistment(enlistmentRoot, string.Empty, gitBinRoot, gvfsHooksRoot, authentication); + return new GVFSEnlistment(enlistmentRoot, string.Empty, gitBinRoot, authentication); } - return new GVFSEnlistment(enlistmentRoot, gitBinRoot, gvfsHooksRoot, authentication); + return new GVFSEnlistment(enlistmentRoot, gitBinRoot, authentication); } throw new InvalidRepoException($"Directory '{directory}' does not exist"); diff --git a/GVFS/GVFS.Common/GVFSPlatform.cs b/GVFS/GVFS.Common/GVFSPlatform.cs index 9338a14f68..dc0c995514 100644 --- a/GVFS/GVFS.Common/GVFSPlatform.cs +++ b/GVFS/GVFS.Common/GVFSPlatform.cs @@ -95,7 +95,7 @@ public static void Register(GVFSPlatform platform) public abstract void ConfigureVisualStudio(string gitBinPath, ITracer tracer); - public abstract bool TryGetGVFSHooksPathAndVersion(out string hooksPaths, out string hooksVersion, out string error); + public abstract bool TryGetGVFSHooksVersion(out string hooksVersion, out string error); public abstract bool TryInstallGitCommandHooks(GVFSContext context, string executingDirectory, string hookName, string commandHookPath, out string errorMessage); public abstract bool TryVerifyAuthenticodeSignature(string path, out string subject, out string issuer, out string error); @@ -206,18 +206,15 @@ public class UnderConstructionFlags public UnderConstructionFlags( bool supportsGVFSUpgrade = true, bool supportsGVFSConfig = true, - bool requiresDeprecatedGitHooksLoader = false, bool supportsNuGetEncryption = true) { this.SupportsGVFSUpgrade = supportsGVFSUpgrade; this.SupportsGVFSConfig = supportsGVFSConfig; - this.RequiresDeprecatedGitHooksLoader = requiresDeprecatedGitHooksLoader; this.SupportsNuGetEncryption = supportsNuGetEncryption; } public bool SupportsGVFSUpgrade { get; } public bool SupportsGVFSConfig { get; } - public bool RequiresDeprecatedGitHooksLoader { get; } public bool SupportsNuGetEncryption { get; } } } diff --git a/GVFS/GVFS.Common/Git/GitProcess.cs b/GVFS/GVFS.Common/Git/GitProcess.cs index 2d8ecef6d3..c3f4c53b0f 100644 --- a/GVFS/GVFS.Common/Git/GitProcess.cs +++ b/GVFS/GVFS.Common/Git/GitProcess.cs @@ -32,7 +32,6 @@ public class GitProcess : ICredentialStore private string gitBinPath; private string workingDirectoryRoot; private string dotGitRoot; - private string gvfsHooksRoot; private Process executingProcess; private bool stopping; @@ -62,11 +61,11 @@ static GitProcess() } public GitProcess(Enlistment enlistment) - : this(enlistment.GitBinPath, enlistment.WorkingDirectoryBackingRoot, enlistment.GVFSHooksRoot) + : this(enlistment.GitBinPath, enlistment.WorkingDirectoryBackingRoot) { } - public GitProcess(string gitBinPath, string workingDirectoryRoot, string gvfsHooksRoot) + public GitProcess(string gitBinPath, string workingDirectoryRoot) { if (string.IsNullOrWhiteSpace(gitBinPath)) { @@ -75,7 +74,6 @@ public GitProcess(string gitBinPath, string workingDirectoryRoot, string gvfsHoo this.gitBinPath = gitBinPath; this.workingDirectoryRoot = workingDirectoryRoot; - this.gvfsHooksRoot = gvfsHooksRoot; if (this.workingDirectoryRoot != null) { @@ -93,27 +91,27 @@ public static Result Init(Enlistment enlistment) public static ConfigResult GetFromGlobalConfig(string gitBinPath, string settingName) { return new ConfigResult( - new GitProcess(gitBinPath, workingDirectoryRoot: null, gvfsHooksRoot: null).InvokeGitOutsideEnlistment("config --global " + settingName), + new GitProcess(gitBinPath, workingDirectoryRoot: null).InvokeGitOutsideEnlistment("config --global " + settingName), settingName); } public static ConfigResult GetFromSystemConfig(string gitBinPath, string settingName) { return new ConfigResult( - new GitProcess(gitBinPath, workingDirectoryRoot: null, gvfsHooksRoot: null).InvokeGitOutsideEnlistment("config --system " + settingName), + new GitProcess(gitBinPath, workingDirectoryRoot: null).InvokeGitOutsideEnlistment("config --system " + settingName), settingName); } public static ConfigResult GetFromFileConfig(string gitBinPath, string configFile, string settingName) { return new ConfigResult( - new GitProcess(gitBinPath, workingDirectoryRoot: null, gvfsHooksRoot: null).InvokeGitOutsideEnlistment("config --file " + configFile + " " + settingName), + new GitProcess(gitBinPath, workingDirectoryRoot: null).InvokeGitOutsideEnlistment("config --file " + configFile + " " + settingName), settingName); } public static bool TryGetVersion(string gitBinPath, out GitVersion gitVersion, out string error) { - GitProcess gitProcess = new GitProcess(gitBinPath, null, null); + GitProcess gitProcess = new GitProcess(gitBinPath, null); Result result = gitProcess.InvokeGitOutsideEnlistment("--version"); string version = result.Output; @@ -683,11 +681,6 @@ public Process GetGitProcess(string command, string workingDirectory, string dot processInfo.EnvironmentVariables["GIT_TERMINAL_PROMPT"] = "0"; processInfo.EnvironmentVariables["GCM_VALIDATE"] = "0"; - processInfo.EnvironmentVariables["PATH"] = - string.Join( - ";", - this.gitBinPath, - this.gvfsHooksRoot ?? string.Empty); if (gitObjectsDirectory != null) { diff --git a/GVFS/GVFS.Mount/InProcessMountVerb.cs b/GVFS/GVFS.Mount/InProcessMountVerb.cs index dc0522255d..17d373b7c2 100644 --- a/GVFS/GVFS.Mount/InProcessMountVerb.cs +++ b/GVFS/GVFS.Mount/InProcessMountVerb.cs @@ -190,7 +190,7 @@ private GVFSEnlistment CreateEnlistment(string enlistmentRootPath) GVFSEnlistment enlistment = null; try { - enlistment = GVFSEnlistment.CreateFromDirectory(enlistmentRootPath, gitBinPath, ProcessHelper.GetCurrentProcessLocation(), authentication: null); + enlistment = GVFSEnlistment.CreateFromDirectory(enlistmentRootPath, gitBinPath, authentication: null); } catch (InvalidRepoException e) { diff --git a/GVFS/GVFS.PerfProfiling/ProfilingEnvironment.cs b/GVFS/GVFS.PerfProfiling/ProfilingEnvironment.cs index e2a3a0771e..c58d212d98 100644 --- a/GVFS/GVFS.PerfProfiling/ProfilingEnvironment.cs +++ b/GVFS/GVFS.PerfProfiling/ProfilingEnvironment.cs @@ -26,9 +26,7 @@ public ProfilingEnvironment(string enlistmentRootPath) private GVFSEnlistment CreateEnlistment(string enlistmentRootPath) { string gitBinPath = GVFSPlatform.Instance.GitInstallation.GetInstalledGitBinPath(); - string hooksPath = ProcessHelper.GetProgramLocation(GVFSPlatform.Instance.Constants.ProgramLocaterCommand, GVFSPlatform.Instance.Constants.GVFSHooksExecutableName); - - return GVFSEnlistment.CreateFromDirectory(enlistmentRootPath, gitBinPath, hooksPath, authentication: null); + return GVFSEnlistment.CreateFromDirectory(enlistmentRootPath, gitBinPath, authentication: null); } private GVFSContext CreateContext() diff --git a/GVFS/GVFS.Platform.Mac/MacPlatform.cs b/GVFS/GVFS.Platform.Mac/MacPlatform.cs index d03a6ec4ea..ec7db94062 100644 --- a/GVFS/GVFS.Platform.Mac/MacPlatform.cs +++ b/GVFS/GVFS.Platform.Mac/MacPlatform.cs @@ -85,7 +85,7 @@ public override string GetUpgradeHighestAvailableVersionDirectory() /// /// This is the directory in which the upgradelogs directory should go. /// There can be multiple logs directories, so here we return the containing - // directory. + /// directory. /// public override string GetUpgradeLogDirectoryParentDirectory() { diff --git a/GVFS/GVFS.Platform.POSIX/POSIXPlatform.cs b/GVFS/GVFS.Platform.POSIX/POSIXPlatform.cs index 9aaef96e97..b74eb1e990 100644 --- a/GVFS/GVFS.Platform.POSIX/POSIXPlatform.cs +++ b/GVFS/GVFS.Platform.POSIX/POSIXPlatform.cs @@ -38,15 +38,8 @@ public override void ConfigureVisualStudio(string gitBinPath, ITracer tracer) { } - public override bool TryGetGVFSHooksPathAndVersion(out string hooksPaths, out string hooksVersion, out string error) + public override bool TryGetGVFSHooksVersion(out string hooksVersion, out string error) { - hooksPaths = string.Empty; - string binPath = Path.Combine(this.Constants.GVFSBinDirectoryPath, GVFSPlatform.Instance.Constants.GVFSHooksExecutableName); - if (File.Exists(binPath)) - { - hooksPaths = binPath; - } - // TODO(#1044): Get the hooks version rather than the GVFS version (and share that code with the Windows platform) hooksVersion = ProcessHelper.GetCurrentProcessVersion(); error = null; diff --git a/GVFS/GVFS.Platform.Windows/WindowsPlatform.cs b/GVFS/GVFS.Platform.Windows/WindowsPlatform.cs index 4f08d4375f..9698d61292 100644 --- a/GVFS/GVFS.Platform.Windows/WindowsPlatform.cs +++ b/GVFS/GVFS.Platform.Windows/WindowsPlatform.cs @@ -25,7 +25,7 @@ public partial class WindowsPlatform : GVFSPlatform private const string BuildLabRegistryValue = "BuildLab"; private const string BuildLabExRegistryValue = "BuildLabEx"; - public WindowsPlatform() : base(underConstruction: new UnderConstructionFlags(requiresDeprecatedGitHooksLoader: true)) + public WindowsPlatform() : base(underConstruction: new UnderConstructionFlags()) { } @@ -256,11 +256,11 @@ public override void ConfigureVisualStudio(string gitBinPath, ITracer tracer) } } - public override bool TryGetGVFSHooksPathAndVersion(out string hooksPath, out string hooksVersion, out string error) + public override bool TryGetGVFSHooksVersion(out string hooksVersion, out string error) { error = null; hooksVersion = null; - hooksPath = ProcessHelper.GetProgramLocation(GVFSPlatform.Instance.Constants.ProgramLocaterCommand, GVFSPlatform.Instance.Constants.GVFSHooksExecutableName); + string hooksPath = ProcessHelper.GetProgramLocation(GVFSPlatform.Instance.Constants.ProgramLocaterCommand, GVFSPlatform.Instance.Constants.GVFSHooksExecutableName); if (hooksPath == null) { error = "Could not find " + GVFSPlatform.Instance.Constants.GVFSHooksExecutableName; diff --git a/GVFS/GVFS.Service/Handlers/GetActiveRepoListHandler.cs b/GVFS/GVFS.Service/Handlers/GetActiveRepoListHandler.cs index 46e60fdd14..44f8cb40cb 100644 --- a/GVFS/GVFS.Service/Handlers/GetActiveRepoListHandler.cs +++ b/GVFS/GVFS.Service/Handlers/GetActiveRepoListHandler.cs @@ -69,18 +69,16 @@ public void Run() private bool IsValidRepo(string repoRoot) { string gitBinPath = GVFSPlatform.Instance.GitInstallation.GetInstalledGitBinPath(); - string hooksPath = null; string hooksVersion = null; string error = null; - if (GVFSPlatform.Instance.TryGetGVFSHooksPathAndVersion(out hooksPath, out hooksVersion, out error)) + if (GVFSPlatform.Instance.TryGetGVFSHooksVersion(out hooksVersion, out error)) { try { GVFSEnlistment enlistment = GVFSEnlistment.CreateFromDirectory( repoRoot, gitBinPath, - hooksPath, authentication: null); } catch (InvalidRepoException e) @@ -88,7 +86,6 @@ private bool IsValidRepo(string repoRoot) EventMetadata metadata = new EventMetadata(); metadata.Add(nameof(repoRoot), repoRoot); metadata.Add(nameof(gitBinPath), gitBinPath); - metadata.Add(nameof(hooksPath), hooksPath); metadata.Add("Exception", e.ToString()); this.tracer.RelatedInfo(metadata, $"{nameof(this.IsValidRepo)}: Found invalid repo"); @@ -97,7 +94,7 @@ private bool IsValidRepo(string repoRoot) } else { - this.tracer.RelatedError($"{nameof(this.IsValidRepo)}: {nameof(GVFSPlatform.Instance.TryGetGVFSHooksPathAndVersion)} failed. {error}"); + this.tracer.RelatedError($"{nameof(this.IsValidRepo)}: {nameof(GVFSPlatform.Instance.TryGetGVFSHooksVersion)} failed. {error}"); return false; } diff --git a/GVFS/GVFS.UnitTests/Common/GVFSEnlistmentTests.cs b/GVFS/GVFS.UnitTests/Common/GVFSEnlistmentTests.cs index dfec57f33f..66ddebbc5c 100644 --- a/GVFS/GVFS.UnitTests/Common/GVFSEnlistmentTests.cs +++ b/GVFS/GVFS.UnitTests/Common/GVFSEnlistmentTests.cs @@ -32,7 +32,7 @@ private class TestGVFSEnlistment : GVFSEnlistment private MockGitProcess gitProcess; public TestGVFSEnlistment() - : base("mock:\\path", "mock://repoUrl", "mock:\\git", gvfsHooksRoot: null, authentication: null) + : base("mock:\\path", "mock://repoUrl", "mock:\\git", authentication: null) { this.gitProcess = new MockGitProcess(); this.gitProcess.SetExpectedCommandResult( diff --git a/GVFS/GVFS.UnitTests/Common/GitStatusCacheTests.cs b/GVFS/GVFS.UnitTests/Common/GitStatusCacheTests.cs index 6571c182c3..75e754afea 100644 --- a/GVFS/GVFS.UnitTests/Common/GitStatusCacheTests.cs +++ b/GVFS/GVFS.UnitTests/Common/GitStatusCacheTests.cs @@ -44,7 +44,7 @@ public void SetUp() this.gitProcess = new MockGitProcess(); this.gitProcess.SetExpectedCommandResult($"--no-optional-locks status \"--serialize={statusCachePath}", () => new GitProcess.Result(string.Empty, string.Empty, 0), true); - MockGVFSEnlistment enlistment = new MockGVFSEnlistment(enlistmentRoot, "fake://repoUrl", "fake://gitBinPath", null, this.gitProcess); + MockGVFSEnlistment enlistment = new MockGVFSEnlistment(enlistmentRoot, "fake://repoUrl", "fake://gitBinPath", this.gitProcess); enlistment.InitializeCachePathsFromKey("fake:\\gvfsSharedCache", "fakeCacheKey"); this.gitParentPath = enlistment.WorkingDirectoryBackingRoot; diff --git a/GVFS/GVFS.UnitTests/Git/GVFSGitObjectsTests.cs b/GVFS/GVFS.UnitTests/Git/GVFSGitObjectsTests.cs index afd8a6b4be..ca60827838 100644 --- a/GVFS/GVFS.UnitTests/Git/GVFSGitObjectsTests.cs +++ b/GVFS/GVFS.UnitTests/Git/GVFSGitObjectsTests.cs @@ -138,7 +138,7 @@ private void AssertRetryableExceptionOnDownload( private GVFSGitObjects CreateTestableGVFSGitObjects(MockHttpGitObjects httpObjects, MockFileSystemWithCallbacks fileSystem) { MockTracer tracer = new MockTracer(); - GVFSEnlistment enlistment = new GVFSEnlistment(TestEnlistmentRoot, "https://fakeRepoUrl", "fakeGitBinPath", gvfsHooksRoot: null, authentication: null); + GVFSEnlistment enlistment = new GVFSEnlistment(TestEnlistmentRoot, "https://fakeRepoUrl", "fakeGitBinPath", authentication: null); enlistment.InitializeCachePathsFromKey(TestLocalCacheRoot, TestObjectRoot); GitRepo repo = new GitRepo(tracer, enlistment, fileSystem, () => new MockLibGit2Repo(tracer)); diff --git a/GVFS/GVFS.UnitTests/Mock/Common/MockGVFSEnlistment.cs b/GVFS/GVFS.UnitTests/Mock/Common/MockGVFSEnlistment.cs index 75761c2e16..2292149b65 100644 --- a/GVFS/GVFS.UnitTests/Mock/Common/MockGVFSEnlistment.cs +++ b/GVFS/GVFS.UnitTests/Mock/Common/MockGVFSEnlistment.cs @@ -10,15 +10,15 @@ public class MockGVFSEnlistment : GVFSEnlistment private MockGitProcess gitProcess; public MockGVFSEnlistment() - : base(Path.Combine("mock:", "path"), "mock://repoUrl", Path.Combine("mock:", "git"), gvfsHooksRoot: null, authentication: null) + : base(Path.Combine("mock:", "path"), "mock://repoUrl", Path.Combine("mock:", "git"), authentication: null) { this.GitObjectsRoot = Path.Combine("mock:", "path", ".git", "objects"); this.LocalObjectsRoot = this.GitObjectsRoot; this.GitPackRoot = Path.Combine("mock:", "path", ".git", "objects", "pack"); } - public MockGVFSEnlistment(string enlistmentRoot, string repoUrl, string gitBinPath, string gvfsHooksRoot, MockGitProcess gitProcess) - : base(enlistmentRoot, repoUrl, gitBinPath, gvfsHooksRoot, authentication: null) + public MockGVFSEnlistment(string enlistmentRoot, string repoUrl, string gitBinPath, MockGitProcess gitProcess) + : base(enlistmentRoot, repoUrl, gitBinPath, authentication: null) { this.gitProcess = gitProcess; } diff --git a/GVFS/GVFS.UnitTests/Mock/Common/MockPlatform.cs b/GVFS/GVFS.UnitTests/Mock/Common/MockPlatform.cs index 79219216ef..c1310d3085 100644 --- a/GVFS/GVFS.UnitTests/Mock/Common/MockPlatform.cs +++ b/GVFS/GVFS.UnitTests/Mock/Common/MockPlatform.cs @@ -40,7 +40,7 @@ public override void ConfigureVisualStudio(string gitBinPath, ITracer tracer) throw new NotSupportedException(); } - public override bool TryGetGVFSHooksPathAndVersion(out string hooksPaths, out string hooksVersion, out string error) + public override bool TryGetGVFSHooksVersion(out string hooksVersion, out string error) { throw new NotSupportedException(); } diff --git a/GVFS/GVFS.UnitTests/Virtual/CommonRepoSetup.cs b/GVFS/GVFS.UnitTests/Virtual/CommonRepoSetup.cs index 89da089f01..85c6aa42bb 100644 --- a/GVFS/GVFS.UnitTests/Virtual/CommonRepoSetup.cs +++ b/GVFS/GVFS.UnitTests/Virtual/CommonRepoSetup.cs @@ -15,7 +15,7 @@ public CommonRepoSetup() MockTracer tracer = new MockTracer(); string enlistmentRoot = Path.Combine("mock:", "GVFS", "UnitTests", "Repo"); - GVFSEnlistment enlistment = new GVFSEnlistment(enlistmentRoot, "fake://repoUrl", "fake://gitBinPath", gvfsHooksRoot: null, authentication: null); + GVFSEnlistment enlistment = new GVFSEnlistment(enlistmentRoot, "fake://repoUrl", "fake://gitBinPath", authentication: null); enlistment.InitializeCachePathsFromKey("fake:\\gvfsSharedCache", "fakeCacheKey"); this.GitParentPath = enlistment.WorkingDirectoryRoot; diff --git a/GVFS/GVFS.Upgrader/UpgradeOrchestrator.cs b/GVFS/GVFS.Upgrader/UpgradeOrchestrator.cs index 99db243a2e..8e81d8c144 100644 --- a/GVFS/GVFS.Upgrader/UpgradeOrchestrator.cs +++ b/GVFS/GVFS.Upgrader/UpgradeOrchestrator.cs @@ -188,7 +188,7 @@ private bool TryInitialize(out string errorMessage) return false; } - ICredentialStore credentialStore = new GitProcess(gitBinPath, workingDirectoryRoot: null, gvfsHooksRoot: null); + ICredentialStore credentialStore = new GitProcess(gitBinPath, workingDirectoryRoot: null); ProductUpgrader upgrader; if (!ProductUpgrader.TryCreateUpgrader(this.tracer, this.fileSystem, new LocalGVFSConfig(), credentialStore, this.DryRun, this.NoVerify, out upgrader, out errorMessage)) diff --git a/GVFS/GVFS/CommandLine/CloneVerb.cs b/GVFS/GVFS/CommandLine/CloneVerb.cs index f75040e18b..d608c003e3 100644 --- a/GVFS/GVFS/CommandLine/CloneVerb.cs +++ b/GVFS/GVFS/CommandLine/CloneVerb.cs @@ -307,7 +307,7 @@ private Result TryCreateEnlistment( return new Result(GVFSConstants.GitIsNotInstalledError); } - string hooksPath = this.GetGVFSHooksPathAndCheckVersion(tracer: null, hooksVersion: out _); + this.CheckGVFSHooksVersion(tracer: null, hooksVersion: out _); try { @@ -315,7 +315,6 @@ private Result TryCreateEnlistment( normalizedEnlistementRootPath, this.RepositoryURL, gitBinPath, - hooksPath, authentication: null); } catch (InvalidRepoException e) diff --git a/GVFS/GVFS/CommandLine/GVFSVerb.cs b/GVFS/GVFS/CommandLine/GVFSVerb.cs index 2aa63c3a57..ac6b09f70c 100644 --- a/GVFS/GVFS/CommandLine/GVFSVerb.cs +++ b/GVFS/GVFS/CommandLine/GVFSVerb.cs @@ -371,7 +371,7 @@ protected void ValidateClientVersions(ITracer tracer, GVFSEnlistment enlistment, this.CheckGitVersion(tracer, enlistment, out string gitVersion); enlistment.SetGitVersion(gitVersion); - this.GetGVFSHooksPathAndCheckVersion(tracer, out string hooksVersion); + this.CheckGVFSHooksVersion(tracer, out string hooksVersion); enlistment.SetGVFSHooksVersion(hooksVersion); this.CheckFileSystemSupportsRequiredFeatures(tracer, enlistment); @@ -416,11 +416,10 @@ protected bool TryCreateAlternatesFile(PhysicalFileSystem fileSystem, GVFSEnlist return true; } - protected string GetGVFSHooksPathAndCheckVersion(ITracer tracer, out string hooksVersion) + protected void CheckGVFSHooksVersion(ITracer tracer, out string hooksVersion) { string error; - string hooksPath; - if (!GVFSPlatform.Instance.TryGetGVFSHooksPathAndVersion(out hooksPath, out hooksVersion, out error)) + if (!GVFSPlatform.Instance.TryGetGVFSHooksVersion(out hooksVersion, out error)) { this.ReportErrorAndExit(tracer, error); } @@ -430,8 +429,6 @@ protected string GetGVFSHooksPathAndCheckVersion(ITracer tracer, out string hook { this.ReportErrorAndExit(tracer, "GVFS.Hooks version ({0}) does not match GVFS version ({1}).", hooksVersion, gvfsVersion); } - - return hooksPath; } protected void BlockEmptyCacheServerUrl(string userInput) @@ -1101,29 +1098,12 @@ private GVFSEnlistment CreateEnlistment(string enlistmentRootPath, GitAuthentica this.ReportErrorAndExit("Error: " + GVFSConstants.GitIsNotInstalledError); } - string hooksPath = null; - if (GVFSPlatform.Instance.UnderConstruction.RequiresDeprecatedGitHooksLoader) - { - // On Windows, the soon-to-be deprecated GitHooksLoader tries to call out to the hooks process without - // its full path, so we have to pass the path along to our background git processes via the PATH - // environment variable. On Mac this is not needed because we just copy our own hook directly into - // the .git/hooks folder, and once Windows does the same, this hooksPath can be removed (from here - // and all the classes that handle it on the way to GitProcess) - - hooksPath = ProcessHelper.GetProgramLocation(GVFSPlatform.Instance.Constants.ProgramLocaterCommand, GVFSPlatform.Instance.Constants.GVFSHooksExecutableName); - if (hooksPath == null) - { - this.ReportErrorAndExit("Could not find " + GVFSPlatform.Instance.Constants.GVFSHooksExecutableName); - } - } - GVFSEnlistment enlistment = null; try { enlistment = GVFSEnlistment.CreateFromDirectory( enlistmentRootPath, gitBinPath, - hooksPath, authentication, createWithoutRepoURL: !this.validateOriginURL); } diff --git a/GVFS/GVFS/CommandLine/RepairVerb.cs b/GVFS/GVFS/CommandLine/RepairVerb.cs index 8f6d00d706..67e4fb2e97 100644 --- a/GVFS/GVFS/CommandLine/RepairVerb.cs +++ b/GVFS/GVFS/CommandLine/RepairVerb.cs @@ -38,7 +38,7 @@ public override void Execute() { this.ValidatePathParameter(this.EnlistmentRootPathParameter); - string hooksPath = this.GetGVFSHooksPathAndCheckVersion(tracer: null, hooksVersion: out _); + this.CheckGVFSHooksVersion(tracer: null, hooksVersion: out _); if (!Directory.Exists(this.EnlistmentRootPathParameter)) { @@ -59,7 +59,6 @@ public override void Execute() enlistment = GVFSEnlistment.CreateFromDirectory( this.EnlistmentRootPathParameter, GVFSPlatform.Instance.GitInstallation.GetInstalledGitBinPath(), - hooksPath, authentication: null, createWithoutRepoURL: true); } diff --git a/GVFS/GVFS/CommandLine/UpgradeVerb.cs b/GVFS/GVFS/CommandLine/UpgradeVerb.cs index 8420ed1418..668d6c7860 100644 --- a/GVFS/GVFS/CommandLine/UpgradeVerb.cs +++ b/GVFS/GVFS/CommandLine/UpgradeVerb.cs @@ -120,7 +120,7 @@ private bool TryInitializeUpgrader(out string error) return false; } - ICredentialStore credentialStore = new GitProcess(gitBinPath, workingDirectoryRoot: null, gvfsHooksRoot: null); + ICredentialStore credentialStore = new GitProcess(gitBinPath, workingDirectoryRoot: null); ProductUpgrader upgrader; if (ProductUpgrader.TryCreateUpgrader(this.tracer, this.fileSystem, new LocalGVFSConfig(), credentialStore, this.DryRun, this.NoVerify, out upgrader, out error)) diff --git a/GVFS/GVFS/RepairJobs/GitConfigRepairJob.cs b/GVFS/GVFS/RepairJobs/GitConfigRepairJob.cs index 04eeccc222..6c488ca942 100644 --- a/GVFS/GVFS/RepairJobs/GitConfigRepairJob.cs +++ b/GVFS/GVFS/RepairJobs/GitConfigRepairJob.cs @@ -52,7 +52,6 @@ public override IssueType HasIssue(List messages) GVFSEnlistment enlistment = GVFSEnlistment.CreateFromDirectory( this.Enlistment.EnlistmentRoot, this.Enlistment.GitBinPath, - this.Enlistment.GVFSHooksRoot, authentication: null); string authError;