credential: change git_cred to git_credential

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.
This commit is contained in:
Edward Thomson
2020-01-18 13:51:40 +00:00
parent 4460bf40c9
commit 3f54ba8b61
32 changed files with 967 additions and 762 deletions

View File

@@ -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:

View File

@@ -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,