11/*
22 * git2r, R bindings to the libgit2 library.
3- * Copyright (C) 2013-2019 The git2r contributors
3+ * Copyright (C) 2013-2020 The git2r contributors
44 *
55 * This program is free software; you can redistribute it and/or modify
66 * it under the terms of the GNU General Public License, version 2,
3535
3636#include "git2r_arg.h"
3737#include "git2r_cred.h"
38+ #include "git2r_deprecated.h"
3839#include "git2r_S3.h"
3940#include "git2r_transfer.h"
4041
@@ -78,12 +79,12 @@ static int git2r_getenv(char **out, SEXP obj, const char *slot)
7879 * @return 0 on success, else -1.
7980 */
8081static int git2r_cred_ssh_key (
81- git_cred * * cred ,
82+ GIT2R_CREDENTIAL * * cred ,
8283 const char * username_from_url ,
8384 unsigned int allowed_types ,
8485 SEXP credentials )
8586{
86- if (GIT_CREDTYPE_SSH_KEY & allowed_types ) {
87+ if (GIT2R_CREDENTIAL_SSH_KEY & allowed_types ) {
8788 SEXP elem ;
8889 const char * publickey ;
8990 const char * privatekey = NULL ;
@@ -96,7 +97,7 @@ static int git2r_cred_ssh_key(
9697 if (Rf_length (elem ) && (NA_STRING != STRING_ELT (elem , 0 )))
9798 passphrase = CHAR (STRING_ELT (elem , 0 ));
9899
99- if (git_cred_ssh_key_new (
100+ if (GIT2R_CREDENTIAL_SSH_KEY_NEW (
100101 cred , username_from_url , publickey , privatekey , passphrase ))
101102 return -1 ;
102103
@@ -115,11 +116,11 @@ static int git2r_cred_ssh_key(
115116 * @return 0 on success, else -1.
116117 */
117118static int git2r_cred_env (
118- git_cred * * cred ,
119+ GIT2R_CREDENTIAL * * cred ,
119120 unsigned int allowed_types ,
120121 SEXP credentials )
121122{
122- if (GIT_CREDTYPE_USERPASS_PLAINTEXT & allowed_types ) {
123+ if (GIT2R_CREDENTIAL_USERPASS_PLAINTEXT & allowed_types ) {
123124 int error ;
124125 char * username = NULL ;
125126 char * password = NULL ;
@@ -134,7 +135,8 @@ static int git2r_cred_env(
134135 if (error )
135136 goto cleanup ;
136137
137- error = git_cred_userpass_plaintext_new (cred , username , password );
138+ error = GIT2R_CREDENTIAL_USERPASS_PLAINTEXT_NEW (
139+ cred , username , password );
138140
139141 cleanup :
140142 free (username );
@@ -158,11 +160,11 @@ static int git2r_cred_env(
158160 * @return 0 on success, else -1.
159161 */
160162static int git2r_cred_token (
161- git_cred * * cred ,
163+ GIT2R_CREDENTIAL * * cred ,
162164 unsigned int allowed_types ,
163165 SEXP credentials )
164166{
165- if (GIT_CREDTYPE_USERPASS_PLAINTEXT & allowed_types ) {
167+ if (GIT2R_CREDENTIAL_USERPASS_PLAINTEXT & allowed_types ) {
166168 int error ;
167169 char * token = NULL ;
168170
@@ -172,7 +174,7 @@ static int git2r_cred_token(
172174 if (error )
173175 goto cleanup ;
174176
175- error = git_cred_userpass_plaintext_new (cred , " " , token );
177+ error = GIT2R_CREDENTIAL_USERPASS_PLAINTEXT_NEW (cred , " " , token );
176178
177179 cleanup :
178180 free (token );
@@ -195,17 +197,17 @@ static int git2r_cred_token(
195197 * @return 0 on success, else -1.
196198 */
197199static int git2r_cred_user_pass (
198- git_cred * * cred ,
200+ GIT2R_CREDENTIAL * * cred ,
199201 unsigned int allowed_types ,
200202 SEXP credentials )
201203{
202- if (GIT_CREDTYPE_USERPASS_PLAINTEXT & allowed_types ) {
204+ if (GIT2R_CREDENTIAL_USERPASS_PLAINTEXT & allowed_types ) {
203205 const char * username ;
204206 const char * password ;
205207
206208 username = CHAR (STRING_ELT (git2r_get_list_element (credentials , "username" ), 0 ));
207209 password = CHAR (STRING_ELT (git2r_get_list_element (credentials , "password" ), 0 ));
208- if (git_cred_userpass_plaintext_new (cred , username , password ))
210+ if (GIT2R_CREDENTIAL_USERPASS_PLAINTEXT_NEW (cred , username , password ))
209211 return -1 ;
210212
211213 return 0 ;
@@ -347,7 +349,7 @@ static int git2r_cred_user_pass(
347349/* } */
348350
349351/* static int git2r_cred_default_ssh_key( */
350- /* git_cred **cred, */
352+ /* GIT2R_CREDENTIAL **cred, */
351353/* const char *username_from_url) */
352354/* { */
353355/* #ifdef WIN32 */
@@ -431,7 +433,7 @@ static int git2r_cred_user_pass(
431433 * @return 0 on success, else -1.
432434 */
433435int git2r_cred_acquire_cb (
434- git_cred * * cred ,
436+ GIT2R_CREDENTIAL * * cred ,
435437 const char * url ,
436438 const char * username_from_url ,
437439 unsigned int allowed_types ,
@@ -448,11 +450,11 @@ int git2r_cred_acquire_cb(
448450 td = (git2r_transfer_data * )payload ;
449451 credentials = td -> credentials ;
450452 if (Rf_isNull (credentials )) {
451- if (GIT_CREDTYPE_SSH_KEY & allowed_types ) {
453+ if (GIT2R_CREDENTIAL_SSH_KEY & allowed_types ) {
452454 if (td -> use_ssh_agent ) {
453455 /* Try to get credentials from the ssh-agent. */
454456 td -> use_ssh_agent = 0 ;
455- if (git_cred_ssh_key_from_agent (cred , username_from_url ) == 0 )
457+ if (GIT2R_CREDENTIAL_SSH_KEY_FROM_AGENT (cred , username_from_url ) == 0 )
456458 return 0 ;
457459 }
458460
0 commit comments