libgit2

git_signature_default_from_env

Version:

Create a new author and/or committer signatures with default information based on the configuration and environment variables.

If author_out is set, it will be populated with the author information. The GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL environment variables will be honored, and user.name and user.email configuration options will be honored if the environment variables are unset. For timestamps, GIT_AUTHOR_DATE will be used, otherwise the current time will be used.

If committer_out is set, it will be populated with the committer information. The GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL environment variables will be honored, and user.name and user.email configuration options will be honored if the environment variables are unset. For timestamps, GIT_COMMITTER_DATE will be used, otherwise the current time will be used.

If neither GIT_AUTHOR_DATE nor GIT_COMMITTER_DATE are set, both timestamps will be set to the same time.

It will return GIT_ENOTFOUND if either the user.name or user.email are not set and there is no fallback from an environment variable. One of author_out or committer_out must be set.

Signature

int git_signature_default_from_env(git_signature **author_out, git_signature **committer_out, git_repository *repo);

Parameters

In
author_out

pointer to set the author signature, or NULL

In
committer_out

pointer to set the committer signature, or NULL

In
repo

repository pointer

Returns

int

0 on success, GIT_ENOTFOUND if config is missing, or error code

Versions