diff --git a/GVFS.sln b/GVFS.sln index 4e16b2d1c6..945509c1a7 100644 --- a/GVFS.sln +++ b/GVFS.sln @@ -65,11 +65,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.PreBuild", "GVFS\GVFS. EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{AB0D9230-3893-4486-8899-F9C871FB5D5F}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GitHooksLoader", "GitHooksLoader\GitHooksLoader.vcxproj", "{798DE293-6EDA-4DC4-9395-BE7A71C563E3}" - ProjectSection(ProjectDependencies) = postProject - {A4984251-840E-4622-AD0C-66DFCE2B2574} = {A4984251-840E-4622-AD0C-66DFCE2B2574} - EndProjectSection -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Installer.Windows", "GVFS\GVFS.Installer.Windows\GVFS.Installer.Windows.csproj", "{3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893}" ProjectSection(ProjectDependencies) = postProject {2F63B22B-EE26-4266-BF17-28A9146483A1} = {2F63B22B-EE26-4266-BF17-28A9146483A1} @@ -91,7 +86,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.SignFiles", "GVFS\GVFS ProjectSection(ProjectDependencies) = postProject {17498502-AEFF-4E70-90CC-1D0B56A8ADF5} = {17498502-AEFF-4E70-90CC-1D0B56A8ADF5} {32220664-594C-4425-B9A0-88E0BE2F3D2A} = {32220664-594C-4425-B9A0-88E0BE2F3D2A} - {798DE293-6EDA-4DC4-9395-BE7A71C563E3} = {798DE293-6EDA-4DC4-9395-BE7A71C563E3} {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B} = {B8C1DFBA-CAFD-4F7E-A1A3-E11907B5467B} {5A6656D5-81C7-472C-9DC8-32D071CB2258} = {5A6656D5-81C7-472C-9DC8-32D071CB2258} {BDA91EE5-C684-4FC5-A90A-B7D677421917} = {BDA91EE5-C684-4FC5-A90A-B7D677421917} @@ -113,7 +107,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GVFS.Mac", "GVFS\GVFS\GVFS. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GVFS.Windows", "GVFS\GVFS\GVFS.Windows.csproj", "{32220664-594C-4425-B9A0-88E0BE2F3D2A}" ProjectSection(ProjectDependencies) = postProject - {798DE293-6EDA-4DC4-9395-BE7A71C563E3} = {798DE293-6EDA-4DC4-9395-BE7A71C563E3} {5A6656D5-81C7-472C-9DC8-32D071CB2258} = {5A6656D5-81C7-472C-9DC8-32D071CB2258} {BDA91EE5-C684-4FC5-A90A-B7D677421917} = {BDA91EE5-C684-4FC5-A90A-B7D677421917} EndProjectSection @@ -211,12 +204,6 @@ Global {A4984251-840E-4622-AD0C-66DFCE2B2574}.Release.Mac|x64.ActiveCfg = Release|x64 {A4984251-840E-4622-AD0C-66DFCE2B2574}.Release.Windows|x64.ActiveCfg = Release|x64 {A4984251-840E-4622-AD0C-66DFCE2B2574}.Release.Windows|x64.Build.0 = Release|x64 - {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Debug.Mac|x64.ActiveCfg = Debug|x64 - {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Debug.Windows|x64.ActiveCfg = Debug|x64 - {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Debug.Windows|x64.Build.0 = Debug|x64 - {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Release.Mac|x64.ActiveCfg = Release|x64 - {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Release.Windows|x64.ActiveCfg = Release|x64 - {798DE293-6EDA-4DC4-9395-BE7A71C563E3}.Release.Windows|x64.Build.0 = Release|x64 {3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893}.Debug.Mac|x64.ActiveCfg = Debug|x64 {3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893}.Debug.Windows|x64.ActiveCfg = Debug|x64 {3AB4FB1F-9E23-4CD8-BFAC-8A2221C8F893}.Debug.Windows|x64.Build.0 = Debug|x64 diff --git a/GVFS/GVFS.Common/DiskLayoutUpgrades/DiskLayoutUpgrade.cs b/GVFS/GVFS.Common/DiskLayoutUpgrades/DiskLayoutUpgrade.cs index d268191abc..470a40ef0f 100644 --- a/GVFS/GVFS.Common/DiskLayoutUpgrades/DiskLayoutUpgrade.cs +++ b/GVFS/GVFS.Common/DiskLayoutUpgrades/DiskLayoutUpgrade.cs @@ -310,23 +310,19 @@ private static bool TryGetDiskLayoutVersion( out int minorVersion, out string error) { - majorVersion = 0; minorVersion = 0; string dotGVFSPath = Path.Combine(enlistmentRoot, GVFSPlatform.Instance.Constants.DotGVFSRoot); - if (!GVFSPlatform.Instance.DiskLayoutUpgrade.TryParseLegacyDiskLayoutVersion(dotGVFSPath, out majorVersion)) + if (!RepoMetadata.TryInitialize(tracer, dotGVFSPath, out error)) { - if (!RepoMetadata.TryInitialize(tracer, dotGVFSPath, out error)) - { - majorVersion = 0; - return false; - } + majorVersion = 0; + return false; + } - if (!RepoMetadata.Instance.TryGetOnDiskLayoutVersion(out majorVersion, out minorVersion, out error)) - { - return false; - } + if (!RepoMetadata.Instance.TryGetOnDiskLayoutVersion(out majorVersion, out minorVersion, out error)) + { + return false; } error = null; diff --git a/GVFS/GVFS.Common/IDiskLayoutUpgradeData.cs b/GVFS/GVFS.Common/IDiskLayoutUpgradeData.cs index edba18c9a7..06ed75a7df 100644 --- a/GVFS/GVFS.Common/IDiskLayoutUpgradeData.cs +++ b/GVFS/GVFS.Common/IDiskLayoutUpgradeData.cs @@ -7,6 +7,5 @@ public interface IDiskLayoutUpgradeData { DiskLayoutUpgrade[] Upgrades { get; } DiskLayoutVersion Version { get; } - bool TryParseLegacyDiskLayoutVersion(string dotGVFSPath, out int majorVersion); } } diff --git a/GVFS/GVFS.Platform.Windows/DiskLayoutUpgrades/WindowsDiskLayoutUpgradeData.cs b/GVFS/GVFS.Platform.Windows/DiskLayoutUpgrades/WindowsDiskLayoutUpgradeData.cs index 369a6445c0..ae9684f838 100644 --- a/GVFS/GVFS.Platform.Windows/DiskLayoutUpgrades/WindowsDiskLayoutUpgradeData.cs +++ b/GVFS/GVFS.Platform.Windows/DiskLayoutUpgrades/WindowsDiskLayoutUpgradeData.cs @@ -1,16 +1,10 @@ using GVFS.Common; using GVFS.DiskLayoutUpgrades; -using Microsoft.Isam.Esent.Collections.Generic; -using System; -using System.IO; namespace GVFS.Platform.Windows.DiskLayoutUpgrades { public class WindowsDiskLayoutUpgradeData : IDiskLayoutUpgradeData { - public const string DiskLayoutEsentVersionKey = "DiskLayoutVersion"; - public const string EsentRepoMetadataName = "RepoMetadata"; - public DiskLayoutUpgrade[] Upgrades { get @@ -25,35 +19,5 @@ public DiskLayoutUpgrade[] Upgrades currentMajorVersion: 0, currentMinorVersion: 0, minimumSupportedMajorVersion: 0); - - public bool TryParseLegacyDiskLayoutVersion(string dotGVFSPath, out int majorVersion) - { - string repoMetadataPath = Path.Combine(dotGVFSPath, EsentRepoMetadataName); - majorVersion = 0; - if (Directory.Exists(repoMetadataPath)) - { - try - { - using (PersistentDictionary oldMetadata = new PersistentDictionary(repoMetadataPath)) - { - string versionString = oldMetadata[DiskLayoutEsentVersionKey]; - if (!int.TryParse(versionString, out majorVersion)) - { - return false; - } - } - } - catch - { - return false; - } - } - else - { - return false; - } - - return true; - } } } diff --git a/GVFS/GVFS.Platform.Windows/GVFS.Platform.Windows.csproj b/GVFS/GVFS.Platform.Windows/GVFS.Platform.Windows.csproj index 9d0dfaa6d3..6d7c7c6a2d 100644 --- a/GVFS/GVFS.Platform.Windows/GVFS.Platform.Windows.csproj +++ b/GVFS/GVFS.Platform.Windows/GVFS.Platform.Windows.csproj @@ -28,21 +28,6 @@ prompt - - False - ..\..\..\packages\Microsoft.Database.Collections.Generic.1.9.4\lib\net40\Esent.Collections.dll - True - - - False - ..\..\..\packages\ManagedEsent.1.9.4\lib\net40\Esent.Interop.dll - True - - - False - ..\..\..\packages\Microsoft.Database.Isam.1.9.4\lib\net40\Esent.Isam.dll - True - diff --git a/GitHooksLoader/GitHooksLoader.cpp b/GitHooksLoader/GitHooksLoader.cpp deleted file mode 100644 index d86638ef86..0000000000 --- a/GitHooksLoader/GitHooksLoader.cpp +++ /dev/null @@ -1,153 +0,0 @@ -// GitHooksLoader.cpp : Defines the entry point for the console application. -// - -#include "stdafx.h" -#include -#include - -int ExecuteHook(const std::wstring &applicationName, wchar_t *hookName, int argc, WCHAR *argv[]); - -int wmain(int argc, WCHAR *argv[]) -{ - LARGE_INTEGER tickFrequency = { 0 }; - LARGE_INTEGER startTime = { 0 }, endTime = { 0 }; - bool perfTraceEnabled = false; - - size_t requiredCount = 0; - if (getenv_s(&requiredCount, NULL, 0, "GITHOOKSLOADER_PERFTRACE") != 0) - { - requiredCount = 0; - } - - if (requiredCount != 0) - { - // Only enable tracing if we have access to a high res perf counter. - if (QueryPerformanceFrequency(&tickFrequency) != 0) - { - perfTraceEnabled = true; - } - } - - if (argc < 2) - { - fwprintf(stderr, L"Usage: %s []\n", argv[0]); - exit(1); - } - - wchar_t hookName[_MAX_FNAME]; - errno_t err = _wsplitpath_s(argv[0], NULL, 0, NULL, 0, hookName, _MAX_FNAME, NULL, 0); - if (err != 0) - { - fwprintf(stderr, L"Error splitting the path. Error code %d.\n", err); - exit(2); - } - - std::wstring executingLoader = std::wstring(argv[0]); - size_t exePartStart = executingLoader.rfind(L".exe"); - - if (exePartStart != std::wstring::npos) - { - executingLoader.resize(exePartStart); - } - - std::wifstream hooksList(executingLoader + L".hooks"); - int numHooksExecuted = 0; - for (std::wstring hookApplication; std::getline(hooksList, hookApplication); ) - { - // Skip comments and empty lines. - if (hookApplication.empty() || hookApplication.at(0) == '#') - { - continue; - } - - numHooksExecuted++; - - if (perfTraceEnabled) - { - QueryPerformanceCounter(&startTime); - } - - int hookExitCode = ExecuteHook(hookApplication, hookName, argc, argv); - if (0 != hookExitCode) - { - return hookExitCode; - } - - if (perfTraceEnabled) - { - double elapsedTime; - QueryPerformanceCounter(&endTime); - elapsedTime = (endTime.QuadPart - startTime.QuadPart) * 1000.0 / tickFrequency.QuadPart; - fwprintf(stdout, L"%s: %s = %.2f milliseconds\n", executingLoader.c_str(), hookApplication.c_str(), elapsedTime); - } - } - - if (0 == numHooksExecuted) - { - fwprintf(stderr, L"No hooks found to execute\n"); - exit(5); - } - - return 0; -} - -int ExecuteHook(const std::wstring &applicationName, wchar_t *hookName, int argc, WCHAR *argv[]) -{ - wchar_t expandedPath[MAX_PATH + 1]; - DWORD length = ExpandEnvironmentStrings(applicationName.c_str(), expandedPath, MAX_PATH); - if (length == 0 || length > MAX_PATH) - { - fwprintf(stderr, L"Unable to expand '%s'", applicationName.c_str()); - exit(6); - } - - std::wstring commandLine = std::wstring(expandedPath) + L" " + hookName; - for (int x = 1; x < argc; x++) - { - commandLine += L" " + std::wstring(argv[x]); - } - - // Start the child process. - STARTUPINFO si; - PROCESS_INFORMATION pi; - ZeroMemory(&si, sizeof(si)); - si.cb = sizeof(si); - si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); - si.hStdError = GetStdHandle(STD_ERROR_HANDLE); - si.dwFlags = STARTF_USESTDHANDLES; - - ZeroMemory(&pi, sizeof(pi)); - if (!CreateProcess( - NULL, // Application name - const_cast(commandLine.c_str()), - NULL, // Process handle not inheritable - NULL, // Thread handle not inheritable - TRUE, // Set handle inheritance to TRUE - CREATE_NO_WINDOW, // Process creation flags - NULL, // Use parent's environment block - NULL, // Use parent's starting directory - &si, // Pointer to STARTUPINFO structure - &pi) // Pointer to PROCESS_INFORMATION structure - ) - { - fwprintf(stderr, L"Could not execute '%s'. CreateProcess error (%d).\n", applicationName.c_str(), GetLastError()); - exit(3); - } - - // Wait until child process exits. - WaitForSingleObject(pi.hProcess, INFINITE); - - // Get process exit code to pass along - DWORD exitCode; - if (!GetExitCodeProcess(pi.hProcess, &exitCode)) - { - fwprintf(stderr, L"GetExitCodeProcess failed (%d).\n", GetLastError()); - exit(4); - } - - // Close process and thread handles. - CloseHandle(pi.hProcess); - CloseHandle(pi.hThread); - - return (int)exitCode; -} \ No newline at end of file diff --git a/GitHooksLoader/GitHooksLoader.vcxproj b/GitHooksLoader/GitHooksLoader.vcxproj deleted file mode 100644 index dce7265ec4..0000000000 --- a/GitHooksLoader/GitHooksLoader.vcxproj +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - {798DE293-6EDA-4DC4-9395-BE7A71C563E3} - Win32Proj - GitHooksLoader - 10.0.10240.0 - - - - - Application - true - v141 - Unicode - - - Application - false - v141 - true - Unicode - - - - - - - - - - - - - - - true - - - false - - - - Use - Level4 - Disabled - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - true - C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt;%(AdditionalIncludeDirectories) - - - Console - true - C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;%(AdditionalLibraryDirectories) - - - $(BuildOutputDir)\$(ProjectName)\intermediate\$(Platform)\$(Configuration)\$(MSBuildProjectName).log - - - $(BuildOutputDir) - - - - - Level4 - Use - MaxSpeed - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - true - C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt;%(AdditionalIncludeDirectories) - - - Console - true - true - true - C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\x64;%(AdditionalLibraryDirectories) - - - $(BuildOutputDir)\$(ProjectName)\intermediate\$(Platform)\$(Configuration)\$(MSBuildProjectName).log - - - $(BuildOutputDir) - - - - - - - - - - - Create - Create - - - - - - - - - diff --git a/GitHooksLoader/GitHooksLoader.vcxproj.filters b/GitHooksLoader/GitHooksLoader.vcxproj.filters deleted file mode 100644 index 336e774530..0000000000 --- a/GitHooksLoader/GitHooksLoader.vcxproj.filters +++ /dev/null @@ -1,41 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/GitHooksLoader/stdafx.cpp b/GitHooksLoader/stdafx.cpp deleted file mode 100644 index 1c723ce6e8..0000000000 --- a/GitHooksLoader/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// GitHooksLoader.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/GitHooksLoader/stdafx.h b/GitHooksLoader/stdafx.h deleted file mode 100644 index 379dfbfbc0..0000000000 --- a/GitHooksLoader/stdafx.h +++ /dev/null @@ -1,11 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#include "targetver.h" -#include -#include - diff --git a/GitHooksLoader/targetver.h b/GitHooksLoader/targetver.h deleted file mode 100644 index 90e767bfce..0000000000 --- a/GitHooksLoader/targetver.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include