@@ -59,28 +59,33 @@ git2r_nothing_to_push(
5959 * @param name The remote to push to
6060 * @param refspec The string vector of refspec to push
6161 * @param credentials The credentials for remote repository access.
62+ * @param proxy_val The proxy settings
6263 * @return R_NilValue
6364 */
6465SEXP attribute_hidden
6566git2r_push (
6667 SEXP repo ,
6768 SEXP name ,
6869 SEXP refspec ,
69- SEXP credentials )
70+ SEXP credentials ,
71+ SEXP proxy_val )
7072{
7173 int error ;
7274 git_remote * remote = NULL ;
7375 git_repository * repository = NULL ;
7476 git_strarray c_refspecs = {0 };
7577 git_push_options opts = GIT_PUSH_OPTIONS_INIT ;
7678 git2r_transfer_data payload = GIT2R_TRANSFER_DATA_INIT ;
79+ git_proxy_options proxy_opts = GIT_PROXY_OPTIONS_INIT ;
7780
7881 if (git2r_arg_check_string (name ))
7982 git2r_error (__func__ , NULL , "'name'" , git2r_err_string_arg );
8083 if (git2r_arg_check_string_vec (refspec ))
8184 git2r_error (__func__ , NULL , "'refspec'" , git2r_err_string_vec_arg );
8285 if (git2r_arg_check_credentials (credentials ))
8386 git2r_error (__func__ , NULL , "'credentials'" , git2r_err_credentials_arg );
87+ if (git2r_arg_check_proxy (proxy_val ))
88+ git2r_error (__func__ , NULL , "'proxy_val'" , git2r_err_proxy_arg );
8489
8590 if (git2r_nothing_to_push (refspec ))
8691 return R_NilValue ;
@@ -93,6 +98,16 @@ git2r_push(
9398 if (error )
9499 goto cleanup ;
95100
101+ /* Initialize proxy options */
102+ error = git2r_set_proxy_options (& proxy_opts , proxy_val );
103+ if (error )
104+ git2r_error (
105+ __func__ ,
106+ git_error_last (),
107+ git2r_err_unable_to_set_proxy_options ,
108+ NULL );
109+ opts .proxy_opts = proxy_opts ;
110+
96111 payload .credentials = credentials ;
97112 opts .callbacks .payload = & payload ;
98113 opts .callbacks .credentials = & git2r_cred_acquire_cb ;
0 commit comments