/// <summary>
        /// Loads commit template from the file specified in .git/config
        /// under <c>commit.template</c> setting.
        /// </summary>
        /// <exception cref="FileNotFoundException">The specified template file cannot be found.</exception>
        /// <returns>The commit template, if it is specified; otherwise <see langword="null"/>.</returns>
        /// <remarks>
        /// Template file can be set by the following command:
        /// <c>$ git config --global commit.template ~/.git_commit_msg.txt</c>
        /// </remarks>
        public string LoadGitCommitTemplate()
        {
            string fileName = _module.GetEffectiveSetting("commit.template");

            if (string.IsNullOrEmpty(fileName))
            {
                return(null);
            }

            fileName = _fullPathResolver.Resolve(fileName);
            if (!_fileSystem.File.Exists(fileName))
            {
                throw new FileNotFoundException("File not found", fileName);
            }

            string commitTemplate = _fileSystem.File.ReadAllText(fileName);

            return(commitTemplate);
        }
        public bool ProcessRevisionSelectionChange(IGitModule currentModule, IReadOnlyCollection <GitRevision> selectedRevisions)
        {
            if (selectedRevisions.Count > 1)
            {
                return(false);
            }

            var revision = selectedRevisions.FirstOrDefault();

            var changed = !string.Equals(revision?.AuthorEmail, AuthorEmailToHighlight, StringComparison.OrdinalIgnoreCase);

            if (changed)
            {
                AuthorEmailToHighlight = revision is not null
                    ? revision.AuthorEmail
                    : currentModule.GetEffectiveSetting(SettingKeyString.UserEmail);
                return(true);
            }

            return(false);
        }
        public void LoadGitCommitTemplate_commit_template_not_defined(string template)
        {
            _module.GetEffectiveSetting("commit.template").Returns(template);

            _manager.LoadGitCommitTemplate().Should().BeNull();
        }