Return an error when ssh memory credentials are not supported.

To not modify the external api.
This commit is contained in:
David Calavera 2015-03-19 14:57:15 -07:00 committed by Michał Górny
parent 7a8b85032f
commit 08e6b875c1
2 changed files with 6 additions and 4 deletions

View File

@ -299,7 +299,6 @@ GIT_EXTERN(int) git_cred_default_new(git_cred **out);
*/ */
GIT_EXTERN(int) git_cred_username_new(git_cred **cred, const char *username); GIT_EXTERN(int) git_cred_username_new(git_cred **cred, const char *username);
#ifdef GIT_SSH_MEMORY_CREDENTIALS
/** /**
* Create a new ssh key credential object reading the keys from memory. * Create a new ssh key credential object reading the keys from memory.
* *
@ -316,7 +315,6 @@ GIT_EXTERN(int) git_cred_ssh_key_memory_new(
const char *publickey, const char *publickey,
const char *privatekey, const char *privatekey,
const char *passphrase); const char *passphrase);
#endif
/** /**
* Signature of a function which acquires a credential object. * Signature of a function which acquires a credential object.

View File

@ -195,7 +195,6 @@ int git_cred_ssh_key_new(
GIT_CREDTYPE_SSH_KEY); GIT_CREDTYPE_SSH_KEY);
} }
#ifdef GIT_SSH_MEMORY_CREDENTIALS
int git_cred_ssh_key_memory_new( int git_cred_ssh_key_memory_new(
git_cred **cred, git_cred **cred,
const char *username, const char *username,
@ -203,6 +202,7 @@ int git_cred_ssh_key_memory_new(
const char *privatekey, const char *privatekey,
const char *passphrase) const char *passphrase)
{ {
#ifdef GIT_SSH_MEMORY_CREDENTIALS
return git_cred_ssh_key_type_new( return git_cred_ssh_key_type_new(
cred, cred,
username, username,
@ -210,8 +210,12 @@ int git_cred_ssh_key_memory_new(
privatekey, privatekey,
passphrase, passphrase,
GIT_CREDTYPE_SSH_MEMORY); GIT_CREDTYPE_SSH_MEMORY);
} #else
giterr_set(GITERR_INVALID,
"This version of libgit2 was not built with ssh memory credentials.");
return -1;
#endif #endif
}
static int git_cred_ssh_key_type_new( static int git_cred_ssh_key_type_new(
git_cred **cred, git_cred **cred,