GitCommits Wyam.Git

Outputs documents and metadata for commits in a Git repository.

This module works in one of two ways. By default, a new document is output for each commit in the repository. These output documents have the metadata documented below to describe each commit. In this mode, all input documents are forgotten and only documents for each commit are output.

Alternatively, by calling ForEachInputDocument(), commit data is added to every input document for which the repository contains an entry. The data is added as an IDocument sequence to the specified metadata key in the input document and each document in the sequence contains the same metadata that would have been added in the default mode. All input documents are output from this module (including those that didn't have commit information).

Package

This module exists in the Wyam.Git package which is not part of the core distribution. Add the following preprocessor directive to your configuration file to use it:
#n Wyam.Git
Alternativly, you can add all modules at once with the following preprocessor directive:
#n Wyam.All

Usage

  • GitCommits()

    Gets commits from the repository the InputFolder is a part of.

  • GitCommits(DirectoryPath repositoryPath)

    Gets commits from the repository the specified path is a part of.

    • repositoryPath

      The repository path.

Fluent Methods

Chain these methods together after the constructor to modify behavior.

  • ForEachInputDocument(string commitsMetadataKey = null)

    Specifies that commit information should be added to each input document.

    • commitsMetadataKey

      The metadata key to set for commit information.

Output Metadata

The metadata values listed below apply to individual documents and are created and set by the module as indicated in their descriptions.

  • GitKeys.AuthorEmail: System.String

    The email of the author.

  • GitKeys.AuthorName: System.String

    The name of the author.

  • GitKeys.AuthorWhen: DateTimeOffset

    The date of the author signature.

  • GitKeys.Commits: IReadOnlyList<IDocument>

    The sequence of commits for the input document if ForEachInputDocument() was called (and an alternate metadata key was not provided).

  • GitKeys.CommitterEmail: System.String

    The email of the committer.

  • GitKeys.CommitterName: System.String

    The name of the committer.

  • GitKeys.CommitterWhen: DateTimeOffset

    The date of the committer signature.

  • GitKeys.Entries: IReadOnlyDictionary<string,string>

    All commit entries. The key is the path of the file and the value is the status of the file within the commit.

  • GitKeys.Message: System.String

    The commit message.

  • GitKeys.Parents: IReadOnlyList<string>

    The SHA of every parent commit.

  • GitKeys.Sha: System.String

    The SHA of the commit.

GitHub