Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

cpoerschke
Copy link
Contributor

work-in-progress for issue #3751 (Function to parse author and committer information from environment)

cd build
cmake --build . && ./libgit2_clar -v -srepo::init

(Function to parse author and committer information from environment)
@cpoerschke
Copy link
Contributor Author

Hi @neshang - it was nice to meet you at the hackathon yesterday and to collaborate on the #3751 issue. Thanks especially for spotting that the initial git_signature_..._env implementations did not work if only one of GIT_..._NAME and GIT_..._EMAIL was supplied -- this in test-driven-development (TDD) sort of style is now reflected in the test_repo_init__init_with_initial_commit_with_env_author_name_only and test_repo_init__init_with_initial_commit_with_env_author_email_only tests.

With the latest batch of commits the test failures we were debugging at the end of the hackathon are now also fixed: the problem was with the test code itself i.e. if test A sets an environment variable then it also needs to unset (or reset) it afterwards or else test B (running after test A) could fail if it assumes that the environment variable concerned is unset.

Also now present is some test coverage for the git_signature_committer_env function, though I'm not sure if the

static void impl_test_repo_init__init_with_initial_commit(
        ...
        int (*git_signature_func)(git_signature **out, git_repository *repo))

function pointer way of implementing that is perhaps a little too fancy a solution.

Next steps:

  1. completion of the include/git2/signature.h changes
  2. addition of the new APIs in CHANGELOG.md
  3. revisions in response to pull request (continuous integration and/or human) code review feedback

@cpoerschke
Copy link
Contributor Author

Pull request now updated to include docs in signature.h and CHANGELOG.md entry. Yet to look fully at the 'AppVeyor build failed' partial failure, from a quick look it seems unrelated?

@cpoerschke cpoerschke changed the title (work-in-progress) issue #3751 (Function to parse author and committer information from environment) issue #3751 (Function to parse author and committer information from environment) Dec 22, 2017
@ethomson
Copy link
Member

I agree that this looks unrelated - I'll restart the AppVeyor build so that it passes and will review this soon. Thanks! 😁

@craigds craigds mentioned this pull request Sep 2, 2020
3 tasks
Base automatically changed from master to main January 7, 2021 10:09
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

ethomson commented Oct 1, 2024

Closing as stale 🙏

@ethomson ethomson closed this Oct 1, 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.

3 participants