summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2020-01-18 13:51:40 +0000
committerEdward Thomson <ethomson@edwardthomson.com>2020-01-26 18:39:41 +0000
commit3f54ba8b61869f42b2bbd1a60091a0be640bc8fc (patch)
treed2ea442f1ab5ecb7a0f8c10d3a26664bc4c44cdc /examples
parent4460bf40c9e935acb853b5d61279a50014ede0b3 (diff)
downloadlibgit2-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 'examples')
-rw-r--r--examples/common.c14
-rw-r--r--examples/common.h2
2 files changed, 8 insertions, 8 deletions
diff --git a/examples/common.c b/examples/common.c
index 30f6cdc3b..b068b8488 100644
--- a/examples/common.c
+++ b/examples/common.c
@@ -176,7 +176,7 @@ static int ask(char **out, const char *prompt, char optional)
return 0;
}
-int cred_acquire_cb(git_cred **out,
+int cred_acquire_cb(git_credential **out,
const char *url,
const char *username_from_url,
unsigned int allowed_types,
@@ -195,7 +195,7 @@ int cred_acquire_cb(git_cred **out,
goto out;
}
- if (allowed_types & GIT_CREDTYPE_SSH_KEY) {
+ if (allowed_types & GIT_CREDENTIAL_SSH_KEY) {
int n;
if ((error = ask(&privkey, "SSH Key:", 0)) < 0 ||
@@ -207,14 +207,14 @@ int cred_acquire_cb(git_cred **out,
(n = snprintf(pubkey, n + 1, "%s.pub", privkey)) < 0)
goto out;
- error = git_cred_ssh_key_new(out, username, pubkey, privkey, password);
- } else if (allowed_types & GIT_CREDTYPE_USERPASS_PLAINTEXT) {
+ error = git_credential_ssh_key_new(out, username, pubkey, privkey, password);
+ } else if (allowed_types & GIT_CREDENTIAL_USERPASS_PLAINTEXT) {
if ((error = ask(&password, "Password:", 1)) < 0)
goto out;
- error = git_cred_userpass_plaintext_new(out, username, password);
- } else if (allowed_types & GIT_CREDTYPE_USERNAME) {
- error = git_cred_username_new(out, username);
+ error = git_credential_userpass_plaintext_new(out, username, password);
+ } else if (allowed_types & GIT_CREDENTIAL_USERNAME) {
+ error = git_credential_username_new(out, username);
}
out:
diff --git a/examples/common.h b/examples/common.h
index 5a029b49a..c01561b48 100644
--- a/examples/common.h
+++ b/examples/common.h
@@ -125,7 +125,7 @@ extern int resolve_refish(git_annotated_commit **commit, git_repository *repo, c
/**
* Acquire credentials via command line
*/
-extern int cred_acquire_cb(git_cred **out,
+extern int cred_acquire_cb(git_credential **out,
const char *url,
const char *username_from_url,
unsigned int allowed_types,