Skip to content

Conversation

paulroub
Copy link

@paulroub paulroub commented Apr 1, 2020

Use GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL if available (or
GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL)

Fall back to EMAIL if GIT_AUTHOR_EMAIL/GIT_COMMITTER_EMAIL is not available

Use the default user info (user.name, user.email) as last resorts.

Return GIT_ENOTFOUND if we don't have enough info for a signature

@paulroub paulroub force-pushed the signature-from-env branch from 304c8cf to f62cfbf Compare April 2, 2020 15:33
Base automatically changed from master to main January 7, 2021 10:09
Use GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL if available (or
GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL)

Fall back to EMAIL if GIT_AUTHOR_EMAIL/GIT_COMMITTER_EMAIL is not available

Use the default user info (user.name, user.email) as last resorts.

Return GIT_ENOTFOUND if we don't have enough info for a signature
u-quark added a commit to u-quark/libgit2 that referenced this pull request Dec 21, 2023
When creating an action signature (e.g. for a commit author and
committer) read the following environment variables that can override
the configuration options:

 * `GIT_AUTHOR_NAME` is the human-readable name in the "author" field.
 * `GIT_AUTHOR_EMAIL` is the email for the "author" field.
 * `GIT_AUTHOR_DATE` is the timestamp used for the "author" field.
 * `GIT_COMMITTER_NAME` sets the human name for the "committer" field.
 * `GIT_COMMITTER_EMAIL` is the email address for the "committer" field.
 * `GIT_COMMITTER_DATE` is used for the timestamp in the "committer"
   field.
 * `EMAIL` is the fallback email address in case the user.email
   configuration value isn't set. If this isn't set, Git falls back to
   the system user and host names.

This is taken from the git documentation chapter "10.8 Environment
Variables":

https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables

This PR adds support for reading these environment variables by adding
two new functions `git_signature_default_author` and
`git_signature_default_committer` and deprecates the
`git_signature_default` function.

Fixes: libgit2#3751

Prior work:
 * libgit2#4409
 * libgit2#5479
 * libgit2#6290
u-quark added a commit to u-quark/libgit2 that referenced this pull request Jan 14, 2024
When creating an action signature (e.g. for a commit author and
committer) read the following environment variables that can override
the configuration options:

 * `GIT_AUTHOR_NAME` is the human-readable name in the "author" field.
 * `GIT_AUTHOR_EMAIL` is the email for the "author" field.
 * `GIT_AUTHOR_DATE` is the timestamp used for the "author" field.
 * `GIT_COMMITTER_NAME` sets the human name for the "committer" field.
 * `GIT_COMMITTER_EMAIL` is the email address for the "committer" field.
 * `GIT_COMMITTER_DATE` is used for the timestamp in the "committer"
   field.
 * `EMAIL` is the fallback email address in case the user.email
   configuration value isn't set. If this isn't set, Git falls back to
   the system user and host names.

This is taken from the git documentation chapter "10.8 Environment
Variables":

https://git-scm.com/book/en/v2/Git-Internals-Environment-Variables

This PR adds support for reading these environment variables by adding
two new functions `git_signature_default_author` and
`git_signature_default_committer` and deprecates the
`git_signature_default` function.

Fixes: libgit2#3751

Prior work:
 * libgit2#4409
 * libgit2#5479
 * libgit2#6290
@ethomson
Copy link
Member

Hey @paulroub - regrets, I think that you opened this during a time where I was busy with other work. I sort of lost sight of this, and I think that this has been resolved with #6706. So I'm closing this.

Hope you're well, and apologies for ghosting you. 🙏

@ethomson ethomson closed this Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants