Skip to content

Function to parse author and committer information from environment #3751

@joshtriplett

Description

@joshtriplett

git_signature_default parses the user.name and user.email values from git_config, but does not allow for other sources of that information. Per man git-commit-tree:

       author and
       committer information is taken from the following environment
       variables, if set:

           GIT_AUTHOR_NAME
           GIT_AUTHOR_EMAIL
           GIT_AUTHOR_DATE
           GIT_COMMITTER_NAME
           GIT_COMMITTER_EMAIL
           GIT_COMMITTER_DATE

       (nb "<", ">" and "\n"s are stripped)

       In case (some of) these environment variables are not set, the
       information is taken from the configuration items user.name and
       user.email, or, if not present, the environment variable EMAIL

While the existing behavior of git_signature_default should likely not change to take environment variables into account, I'd suggest adding a git_signature_author_env and git_signature_committer_env that do. Those would be the appropriate defaults to pass when creating a commit, for any program mimicking the git command-line tools.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions