Beispiel #1
0
        private bool IsValidRepo(string repoRoot)
        {
            WindowsGitInstallation windowsGitInstallation = new WindowsGitInstallation();
            string         gitBinPath = windowsGitInstallation.GetInstalledGitBinPath();
            string         hooksPath  = ProcessHelper.WhereDirectory(GVFSPlatform.Instance.Constants.GVFSHooksExecutableName);
            GVFSEnlistment enlistment = null;

            try
            {
                enlistment = GVFSEnlistment.CreateFromDirectory(repoRoot, gitBinPath, hooksPath, authentication: null);
            }
            catch (InvalidRepoException e)
            {
                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");

                return(false);
            }

            return(true);
        }
Beispiel #2
0
        private bool IsValidRepo(string repoRoot)
        {
            WindowsGitInstallation windowsGitInstallation = new WindowsGitInstallation();
            string         gitBinPath = windowsGitInstallation.GetInstalledGitBinPath();
            string         hooksPath  = ProcessHelper.WhereDirectory(GVFSPlatform.Instance.Constants.GVFSHooksExecutableName);
            GVFSEnlistment enlistment = null;

            try
            {
                enlistment = GVFSEnlistment.CreateFromDirectory(repoRoot, gitBinPath, hooksPath);
            }
            catch (InvalidRepoException)
            {
                return(false);
            }

            if (enlistment == null)
            {
                return(false);
            }

            return(true);
        }