@@ -159,6 +159,21 @@ static int credentials_cb(
159159 return payload -> exception ? GIT_ERROR : GIT_OK ;
160160}
161161
162+ void rugged_remote_init_fetch_options (VALUE rb_options , git_fetch_options * fetch_options )
163+ {
164+ rugged_remote_init_custom_headers (rb_options , & fetch_options -> custom_headers );
165+ rugged_remote_init_proxy_options (rb_options , & fetch_options -> proxy_opts );
166+
167+ if (!NIL_P (rb_options ))
168+ {
169+ VALUE depth = rb_hash_aref (rb_options , CSTR2SYM ("depth" ));
170+ if (!NIL_P (depth )) {
171+ Check_Type (depth , T_FIXNUM );
172+ fetch_options -> depth = FIX2UINT (depth );
173+ }
174+ }
175+ }
176+
162177void rugged_remote_init_callbacks_and_payload_from_options (
163178 VALUE rb_options ,
164179 git_remote_callbacks * callbacks ,
@@ -639,8 +654,7 @@ static VALUE rb_git_remote_fetch(int argc, VALUE *argv, VALUE self)
639654 TypedData_Get_Struct (self , git_remote , & rugged_remote_type , remote );
640655
641656 rugged_remote_init_callbacks_and_payload_from_options (rb_options , & opts .callbacks , & payload );
642- rugged_remote_init_custom_headers (rb_options , & opts .custom_headers );
643- rugged_remote_init_proxy_options (rb_options , & opts .proxy_opts );
657+ rugged_remote_init_fetch_options (rb_options , & opts );
644658
645659 if (!NIL_P (rb_options )) {
646660 VALUE rb_prune_type ;
0 commit comments