\GitAssetCommitter

Synopsis

class GitAssetCommitter extends AssetCommitter implements AssetCommitterInterface {
}

Hierarchy

Members

private

  • $automatically_define_author
    If true, the currently logged in CMS user's email and name will be used as an author of commits. If nobody is logged in (for example when running tasks from the command line interface), the `--author` parameter is omitted when calling `git commit`, which makes git to use the default author of the repository.
  • $commit_file_creations
  • $commit_file_deletions
  • $commit_file_renamings
  • $commit_file_replacements
  • $push_to_after_committing
    If you want all commits to be pushed automatically to a remote repository, set this to for example "origin master" (remote name + branch name separated by a single space). Note that pushing is done immediately after each commit, which may execute multiple pushes in a short time if for example a folder containing many files is renamed/moved.
  • $repositoryExtendedGitRepository
  • $repository_path
  • $supplement_empty_author_email
    When defining an author, this string is used as the email address in case if the user's email address happens to be empty. This setting will not be used if no user is logged in or if automatically_define_author is false.
  • $supplement_empty_author_name
    When defining an author, this string is used as the person name in case if the user's name happens to be empty. This setting will not be used if no user is logged in or if automatically_define_author is false.

Methods

private

  • automatically_define_author()
  • commit()
  • getCommitAuthor() — Return's the name and email address of the currently logged in user. If nobody is logged in in the CMS, return null. This is usually the best bet for the author: if we would use the owner of the file, it would probably work when uploading files, but could be incorrect when renaming or deleting files.
  • repository()
  • repository_path()
  • reset_git_stage() — Makes sure that there's nothing staged. This is called before starting to add files to staging to make sure that we won't accidentally commit some odd changes not related to what we are doing.

public

Inherited from AssetCommitter

protected

  • getAbsoluteFilename()
  • newCommitCreated() — AssetCommitters should call this method every time they have successfully created a commit. The exact counter value is not actually needed, but it's used to determine if there are commits that should be pushed to a remote server at the end of the application's execution flow. (Of course pushing will not be done if no pushing is configured in the application's YAML config files. See AssetCommitterInterface::isPushingEnabled() for more details).

public

  • hasCreatedNewCommits() — Indicates whether there are any new commits created by the AssetCommitter subclass that can be pushed to a remote repository.