signature: add git_signature_default_from_env

People who are doing a commit expect a unified timestamp between
author and committer information when we're using the current timestamp.
Provide a single function that returns both author and committer
information so that they can have an identical timestamp when none is
specified in the environment.
This commit is contained in:
Edward Thomson
2024-06-14 12:50:40 +02:00
parent 24d9fe1339
commit 649ef1cca6
7 changed files with 131 additions and 108 deletions

View File

@@ -63,10 +63,8 @@ int lg2_commit(git_repository *repo, int argc, char **argv)
check_lg2(git_tree_lookup(&tree, repo, &tree_oid), "Error looking up tree", NULL);
check_lg2(git_signature_default_author(&author_signature, repo),
"Error creating author signature", NULL);
check_lg2(git_signature_default_committer(&committer_signature, repo),
"Error creating committer signature", NULL);
check_lg2(git_signature_default_from_env(&author_signature, &committer_signature, repo),
"Error creating signature", NULL);
check_lg2(git_commit_create_v(
&commit_oid,