/// <summary>
 ///     Initializes a new instance of the <see cref="GravatarFetcher" /> class.
 /// </summary>
 /// <param name="committers">
 ///     The list of committers. Ideally, this should already have been de-duplicated.
 ///     Duplicate entries are not necessarily fatal but could result in redundant
 ///     web requests and possibly some failed operations due to file locking semantics.
 /// </param>
 /// <param name="client">
 ///     An HttpClient to be used for making web requests (dependency injection).
 ///     If null or omitted, then a new instance is created internally.
 /// </param>
 /// <param name="filesystem">
 ///     A <see cref="FakeFileSystemWrapper" /> to be used for accessing the file system (dependency injection).
 ///     If null or omitted, then a new instance is created internally.
 /// </param>
 public GravatarFetcher(IEnumerable <Committer> committers,
                        HttpClient client = null,
                        FakeFileSystemWrapper filesystem = null)
 {
     fileSystem             = filesystem ?? new FakeFileSystemWrapper();
     httpClient             = client ?? new HttpClient();
     httpClient.BaseAddress = new Uri(GravatarBaseUrl);
     UniqueCommitters       = committers;
 }
        /// <summary>
        ///     Initializes a new instance of the <see cref="GitLog" /> class.
        /// </summary>
        /// <param name="pathToWorkingCopy">The path to a Git working copy.</param>
        /// <param name="fakeFileSystemWrapper">
        ///     A helper class that provides file system
        ///     services (optional).
        /// </param>
        /// <exception cref="ArgumentException">Thrown if the path is invalid.</exception>
        /// <exception cref="InvalidOperationException">
        ///     Thrown if there is no Git repository at
        ///     the specified path.
        /// </exception>
        public GitLog(string pathToWorkingCopy, FakeFileSystemWrapper fakeFileSystemWrapper = null)
        {
            fileSystem = fakeFileSystemWrapper ?? new FakeFileSystemWrapper();
            var fullPath = fileSystem.GetFullPath(pathToWorkingCopy); // ArgumentException if path invalid.

            if (!fileSystem.DirectoryExists(fullPath))
            {
                throw new ArgumentException("The specified working copy directory does not exist.");
            }
            GitWorkingCopyPath = pathToWorkingCopy;
            var git = fileSystem.PathCombine(fullPath, ".git");

            if (!fileSystem.DirectoryExists(git))
            {
                throw new InvalidOperationException(
                          "There does not appear to be a Git repository at the specified location.");
            }
        }