diff options
| author | Carlos Martín Nieto <cmn@dwim.me> | 2015-01-07 12:23:05 +0000 |
|---|---|---|
| committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-03-03 14:40:50 +0100 |
| commit | 659cf2029f322ea876d663d85783b48945227e8f (patch) | |
| tree | 435e9185c38d96656e21db83fc736b5294499b10 /include/git2/repository.h | |
| parent | 99b68a2aecfaa24f252f265d61b230b8e2576dd2 (diff) | |
| download | libgit2-659cf2029f322ea876d663d85783b48945227e8f.tar.gz | |
Remove the signature from ref-modifying functions
The signature for the reflog is not something which changes
dynamically. Almost all uses will be NULL, since we want for the
repository's default identity to be used, making it noise.
In order to allow for changing the identity, we instead provide
git_repository_set_ident() and git_repository_ident() which allow a user
to override the choice of signature.
Diffstat (limited to 'include/git2/repository.h')
| -rw-r--r-- | include/git2/repository.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/include/git2/repository.h b/include/git2/repository.h index 2fb381316..a08dfcc28 100644 --- a/include/git2/repository.h +++ b/include/git2/repository.h @@ -603,14 +603,12 @@ GIT_EXTERN(int) git_repository_hashfile( * * @param repo Repository pointer * @param refname Canonical name of the reference the HEAD should point at - * @param signature The identity that will used to populate the reflog entry * @param log_message The one line long message to be appended to the reflog * @return 0 on success, or an error code */ GIT_EXTERN(int) git_repository_set_head( git_repository* repo, const char* refname, - const git_signature *signature, const char *log_message); /** @@ -627,14 +625,12 @@ GIT_EXTERN(int) git_repository_set_head( * * @param repo Repository pointer * @param commitish Object id of the Commit the HEAD should point to - * @param signature The identity that will used to populate the reflog entry * @param log_message The one line long message to be appended to the reflog * @return 0 on success, or an error code */ GIT_EXTERN(int) git_repository_set_head_detached( git_repository* repo, const git_oid* commitish, - const git_signature *signature, const char *log_message); /** @@ -651,14 +647,12 @@ GIT_EXTERN(int) git_repository_set_head_detached( * Otherwise, the HEAD will be detached and point to the peeled Commit. * * @param repo Repository pointer - * @param signature The identity that will used to populate the reflog entry * @param reflog_message The one line long message to be appended to the reflog * @return 0 on success, GIT_EUNBORNBRANCH when HEAD points to a non existing * branch or an error code */ GIT_EXTERN(int) git_repository_detach_head( git_repository* repo, - const git_signature *signature, const char *reflog_message); /** @@ -720,6 +714,31 @@ GIT_EXTERN(const char *) git_repository_get_namespace(git_repository *repo); */ GIT_EXTERN(int) git_repository_is_shallow(git_repository *repo); +/** + * Retrieve the configured identity to use for reflogs + * + * The memory is owned by the repository and must not be freed by the + * user. + * + * @param name where to store the pointer to the name + * @param email where to store the pointer to the email + * @param repo the repository + */ +GIT_EXTERN(int) git_repository_ident(const char **name, const char **email, const git_repository *repo); + +/** + * Set the identity to be used for writing reflogs + * + * If both are set, this name and email will be used to write to the + * reflog. Pass NULL to unset. When unset, the identity will be taken + * from the repository's configuration. + * + * @param repo the repository to configure + * @param name the name to use for the reflog entries + * @param name the email to use for the reflog entries + */ +GIT_EXTERN(int) git_repository_set_ident(git_repository *repo, const char *name, const char *email); + /** @} */ GIT_END_DECL #endif |
