Пример #1
0
        public IGitSyncStrategy ChooseSyncStrategy(string repositoryPath, Repository repository, GitConfig config)
        {
            var syncMode = config.SyncMode;

            if (syncMode == SyncMode.Auto)
            {
                try
                {
                    executablePathResolver.Resolve(config.GitPath);
                    syncMode = SyncMode.NativeGit;
                }
                catch (ExecutableNotFoundException)
                {
                    syncMode = SyncMode.Builtin;
                }
            }

            if (syncMode == SyncMode.NativeGit)
            {
                return(new NativeGitSyncStrategy(config.GitPath, repositoryPath));
            }
            else
            {
                return(new LibGit2SharpSyncStrategy(repository));
            }
        }
Пример #2
0
        private GpgInstallation ResolveFromPath(string gpgPathSpec)
        {
            string resolved;

            try
            {
                resolved = executablePathResolver.Resolve(gpgPathSpec);
            }
            catch (ExecutableNotFoundException)
            {
                throw new GpgError($"Gpg executable not found. Please verify that '${gpgPathSpec}' points to a valid GPG executable.");
            }
            var executable = fileSystem.FileInfo.FromFileName(resolved);

            Log.Send("GPG executable found at the configured path. Assuming installation dir to be " + executable.Directory);

            return(new GpgInstallation
            {
                InstallDirectory = executable.Directory,
                GpgExecutable = executable,
                GpgAgentExecutable = ChildOf(executable.Directory, GpgAgentExeName),
                GpgConnectAgentExecutable = ChildOf(executable.Directory, GpgConnectAgentExeName)
            });
        }