Skip to content

Commit

Permalink
Fix read-object hook
Browse files Browse the repository at this point in the history
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
  • Loading branch information
derrickstolee committed Aug 7, 2019
1 parent 8340d76 commit f2b20be
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
11 changes: 9 additions & 2 deletions GVFS/GVFS.Common/FileSystem/HooksInstaller.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using GVFS.Common.Tracing;
using GVFS.Common.Git;
using GVFS.Common.Tracing;
using System;
using System.Collections.Generic;
using System.Diagnostics;
Expand Down Expand Up @@ -26,7 +27,13 @@ public static string MergeHooksData(string[] defaultHooksLines, string filename,
{
IEnumerable<string> valuableHooksLines = defaultHooksLines.Where(line => !string.IsNullOrEmpty(line.Trim()));

if (!valuableHooksLines.Any())
if (valuableHooksLines.Contains(GVFSPlatform.Instance.Constants.GVFSHooksExecutableName, StringComparer.OrdinalIgnoreCase))
{
throw new HooksConfigurationException(
$"{GVFSPlatform.Instance.Constants.GVFSHooksExecutableName} should not be specified in the configuration for "
+ GVFSConstants.DotGit.Hooks.ReadObjectName + " hooks (" + filename + ").");
}
else if (!valuableHooksLines.Any())
{
return GVFSPlatform.Instance.Constants.GVFSHooksExecutableName;
}
Expand Down
3 changes: 1 addition & 2 deletions GVFS/GVFS.Common/InstallerPreRunChecker.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using GVFS.Common;
using GVFS.Common.Git;
using GVFS.Common.Tracing;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -196,7 +195,7 @@ private bool IsGVFSUpgradeAllowed(out string consoleError)
Environment.NewLine,
$"{GVFSConstants.UpgradeVerbMessages.GVFSUpgrade} is only supported after the \"Windows Projected File System\" optional feature has been enabled by a manual installation of VFS for Git, and only on versions of Windows that support this feature.",
"Check your team's documentation for how to upgrade.");
this.tracer.RelatedWarning(metadata: null, message:$"{nameof(this.IsGVFSUpgradeAllowed)}: Upgrade is not installable. {consoleError}", keywords: Keywords.Telemetry);
this.tracer.RelatedWarning(metadata: null, message: $"{nameof(this.IsGVFSUpgradeAllowed)}: Upgrade is not installable. {consoleError}", keywords: Keywords.Telemetry);
return false;
}

Expand Down
1 change: 1 addition & 0 deletions GVFS/GVFS/CommandLine/GVFSVerb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public static bool TrySetRequiredGitConfigSettings(Enlistment enlistment)
{ "core.untrackedCache", "false" },
{ "core.repositoryformatversion", "0" },
{ "core.filemode", GVFSPlatform.Instance.FileSystem.SupportsFileMode ? "true" : "false" },
{ GitConfigSetting.CoreVirtualizeObjectsName, "true" },
{ "core.bare", "false" },
{ "core.logallrefupdates", "true" },
{ "core.hookspath", expectedHooksPath },
Expand Down

0 comments on commit f2b20be

Please sign in to comment.