commit: add support to take ENV variables for commit info #6290
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes issue: #3751
This will add support for git_commit__create_internal() for getting AUTHOR and COMMITTER information from the ENVIRONMENT.
variables considered as follows,
GIT_AUTHOR_NAME
GIT_AUTHOR_EMAIL // for AUTHOR information
and
GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL // for information
if one of the env variable in a set(AUTHOR env pair)
and other is not set or set to empty string(eg.: GIT_AUTHOR_NAME is set and GIT_AUTHOR_EMAIL is set to empty string or not setted at all) this patch will
defaults to global values for the empty string value or unsetted ENV variable and takes the properly set ENV variable with non-empty string and stores as a
git_signature
structure ingit_commit__create_internal
, but in git CLI the commit will fail instead of defaulting toglobal defaults for empty string value for a ENV variable such as GIT_AUTHOR_EMAIL.
on the other hand if one of a variable in pair is not set(eg. GIT_AUTHOR_NAME is set and GIT_AUTHOR_EMAIL is not set) and other one is set to valid value ENV git CLI sets global defaults values for unsetted ENV variable.
I'm using git version 2.36.0.