diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2020-01-18 13:51:40 +0000 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2020-01-26 18:39:41 +0000 |
| commit | 3f54ba8b61869f42b2bbd1a60091a0be640bc8fc (patch) | |
| tree | d2ea442f1ab5ecb7a0f8c10d3a26664bc4c44cdc /include/git2/credential_helpers.h | |
| parent | 4460bf40c9e935acb853b5d61279a50014ede0b3 (diff) | |
| download | libgit2-3f54ba8b61869f42b2bbd1a60091a0be640bc8fc.tar.gz | |
credential: change git_cred to git_credentialethomson/credtype
We avoid abbreviations where possible; rename git_cred to
git_credential.
In addition, we have standardized on a trailing `_t` for enum types,
instead of using "type" in the name. So `git_credtype_t` has become
`git_credential_t` and its members have become `GIT_CREDENTIAL` instead
of `GIT_CREDTYPE`.
Finally, the source and header files have been renamed to `credential`
instead of `cred`.
Keep previous name and values as deprecated, and include the new header
files from the previous ones.
Diffstat (limited to 'include/git2/credential_helpers.h')
| -rw-r--r-- | include/git2/credential_helpers.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/include/git2/credential_helpers.h b/include/git2/credential_helpers.h new file mode 100644 index 000000000..9a70ecb38 --- /dev/null +++ b/include/git2/credential_helpers.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) the libgit2 contributors. All rights reserved. + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ +#ifndef INCLUDE_git_credential_helpers_h__ +#define INCLUDE_git_credential_helpers_h__ + +#include "transport.h" + +/** + * @file git2/credential_helpers.h + * @brief Utility functions for credential management + * @defgroup git_credential_helpers credential management helpers + * @ingroup Git + * @{ + */ +GIT_BEGIN_DECL + +/** + * Payload for git_credential_userpass_plaintext. + */ +typedef struct git_credential_userpass_payload { + const char *username; + const char *password; +} git_credential_userpass_payload; + + +/** + * Stock callback usable as a git_credential_acquire_cb. This calls + * git_cred_userpass_plaintext_new unless the protocol has not specified + * `GIT_CREDENTIAL_USERPASS_PLAINTEXT` as an allowed type. + * + * @param out The newly created credential object. + * @param url The resource for which we are demanding a credential. + * @param user_from_url The username that was embedded in a "user\@host" + * remote url, or NULL if not included. + * @param allowed_types A bitmask stating which credential types are OK to return. + * @param payload The payload provided when specifying this callback. (This is + * interpreted as a `git_credential_userpass_payload*`.) + */ +GIT_EXTERN(int) git_credential_userpass( + git_credential **out, + const char *url, + const char *user_from_url, + unsigned int allowed_types, + void *payload); + +/** @} */ +GIT_END_DECL +#endif |
