mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
signature: keep using signature_default internally
Making the various pieces that create commits automatically (eg, rebase) start paying attention to the environment variables is a Big Change. For now, this is a big change in defaults; we should treat it as breaking. We don't move to this by default; we may add `from_env` or `honor_env` type of API surface in the future.
This commit is contained in:
@@ -1268,7 +1268,7 @@ static int rebase_copy_note(
|
||||
}
|
||||
|
||||
if (!committer) {
|
||||
if((error = git_signature_default_committer(&who, rebase->repo)) < 0) {
|
||||
if((error = git_signature_default(&who, rebase->repo)) < 0) {
|
||||
if (error != GIT_ENOTFOUND ||
|
||||
(error = git_signature_now(&who, "unknown", "unknown")) < 0)
|
||||
goto done;
|
||||
|
||||
@@ -451,7 +451,7 @@ int git_reference__log_signature(git_signature **out, git_repository *repo)
|
||||
git_signature *who;
|
||||
|
||||
if(((error = refs_configured_ident(&who, repo)) < 0) &&
|
||||
((error = git_signature_default_author(&who, repo)) < 0) &&
|
||||
((error = git_signature_default(&who, repo)) < 0) &&
|
||||
((error = git_signature_now(&who, "unknown", "unknown")) < 0))
|
||||
return error;
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ static void do_time_travelling_fetch(git_oid *commit1id, git_oid *commit2id,
|
||||
cl_git_pass(git_treebuilder_new(&tb, repo1, NULL));
|
||||
cl_git_pass(git_treebuilder_write(&empty_tree_id, tb));
|
||||
cl_git_pass(git_tree_lookup(&empty_tree, repo1, &empty_tree_id));
|
||||
cl_git_pass(git_signature_default_author(&sig, repo1));
|
||||
cl_git_pass(git_signature_default(&sig, repo1));
|
||||
cl_git_pass(git_commit_create(commit1id, repo1, REPO1_REFNAME, sig,
|
||||
sig, NULL, "one", empty_tree, 0, NULL));
|
||||
cl_git_pass(git_commit_lookup(&commit1, repo1, commit1id));
|
||||
|
||||
@@ -581,7 +581,7 @@ void test_repo_init__init_with_initial_commit(void)
|
||||
* made to a repository...
|
||||
*/
|
||||
|
||||
/* Make sure we're ready to use git_signature_default_author :-) */
|
||||
/* Make sure we're ready to use git_signature_default :-) */
|
||||
{
|
||||
git_config *cfg, *local;
|
||||
cl_git_pass(git_repository_config(&cfg, g_repo));
|
||||
@@ -594,22 +594,20 @@ void test_repo_init__init_with_initial_commit(void)
|
||||
|
||||
/* Create a commit with the new contents of the index */
|
||||
{
|
||||
git_signature *author_sig, *committer_sig;
|
||||
git_signature *sig;
|
||||
git_oid tree_id, commit_id;
|
||||
git_tree *tree;
|
||||
|
||||
cl_git_pass(git_signature_default_author(&author_sig, g_repo));
|
||||
cl_git_pass(git_signature_default_committer(&committer_sig, g_repo));
|
||||
cl_git_pass(git_signature_default(&sig, g_repo));
|
||||
cl_git_pass(git_index_write_tree(&tree_id, index));
|
||||
cl_git_pass(git_tree_lookup(&tree, g_repo, &tree_id));
|
||||
|
||||
cl_git_pass(git_commit_create_v(
|
||||
&commit_id, g_repo, "HEAD", author_sig, committer_sig,
|
||||
&commit_id, g_repo, "HEAD", sig, sig,
|
||||
NULL, "First", tree, 0));
|
||||
|
||||
git_tree_free(tree);
|
||||
git_signature_free(author_sig);
|
||||
git_signature_free(committer_sig);
|
||||
git_signature_free(sig);
|
||||
}
|
||||
|
||||
git_index_free(index);
|
||||
|
||||
Reference in New Issue
Block a user