@@ -97,17 +97,6 @@ GIT_EXTERN(int) git_remote_create_anonymous(
9797 */
9898GIT_EXTERN (int ) git_remote_lookup (git_remote * * out , git_repository * repo , const char * name );
9999
100- /**
101- * Save a remote to its repository's configuration
102- *
103- * One can't save a in-memory remote. Doing so will
104- * result in a GIT_EINVALIDSPEC being returned.
105- *
106- * @param remote the remote to save to config
107- * @return 0, GIT_EINVALIDSPEC or an error code
108- */
109- GIT_EXTERN (int ) git_remote_save (const git_remote * remote );
110-
111100/**
112101 * Create a copy of an existing remote. All internal strings are also
113102 * duplicated. Callbacks are not duplicated.
@@ -317,7 +306,7 @@ GIT_EXTERN(int) git_remote_ls(const git_remote_head ***out, size_t *size, git_r
317306 * download. Use NULL or an empty array to use the base refspecs
318307 * @return 0 or an error code
319308 */
320- GIT_EXTERN (int ) git_remote_download (git_remote * remote , const git_strarray * refspecs );
309+ GIT_EXTERN (int ) git_remote_download (git_remote * remote , const git_remote_callbacks * callbacks , const git_strarray * refspecs );
321310
322311/**
323312 * Create a packfile and send it to the server
@@ -330,7 +319,7 @@ GIT_EXTERN(int) git_remote_download(git_remote *remote, const git_strarray *refs
330319 * upload. Use NULL or an empty array to use the base refspecs
331320 * @return 0 or an error code
332321 */
333- GIT_EXTERN (int ) git_remote_upload (git_remote * remote , const git_strarray * refspecs , const git_push_options * opts );
322+ GIT_EXTERN (int ) git_remote_upload (git_remote * remote , const git_remote_callbacks * callbacks , const git_push_options * opts );
334323
335324/**
336325 * Check whether the remote is connected
@@ -395,42 +384,91 @@ GIT_EXTERN(int) git_remote_update_tips(
395384 */
396385GIT_EXTERN (int ) git_remote_prune (git_remote * remote );
397386
387+ /**
388+ * Automatic tag following option
389+ *
390+ * Lets us select the --tags option to use.
391+ */
392+ typedef enum {
393+ GIT_REMOTE_DOWNLOAD_TAGS_AUTO = 0 ,
394+ GIT_REMOTE_DOWNLOAD_TAGS_NONE = 1 ,
395+ GIT_REMOTE_DOWNLOAD_TAGS_ALL = 2
396+ } git_remote_autotag_option_t ;
397+
398+ typedef struct {
399+ unsigned int version ;
400+ /**
401+ * Whether to update FETCH_HEAD setting. By default,
402+ * FETCH_HEAD will be updated on every fetch. Set to 0 to
403+ * disable.
404+ */
405+ unsigned int update_fetchhead ;
406+ /**
407+ * Set to true to prune stale references after fetching
408+ */
409+ unsigned int prune ;
410+ /**
411+ * The tag auto-follow setting
412+ */
413+ git_remote_autotag_option_t autotag ;
414+ /**
415+ * The refspecs to use for this fetch. Leave empty to use the
416+ * base refspecs.
417+ */
418+ git_strarray refspecs ;
419+ /**
420+ * Identity to use to update the reflog.
421+ */
422+ const git_signature * signature ;
423+ /**
424+ * The message to insert into the reflogs. If NULL, the default is "fetch".
425+ */
426+ const char * reflog_message ;
427+ } git_fetch_options ;
428+
429+ #define GIT_FETCH_OPTIONS_VERSION 1
430+ #define GIT_FETCH_OPTIONS_INIT { GIT_FETCH_OPTIONS_VERSION, 1 }
431+
432+ /**
433+ * Initializes a `git_fetch_options` with default values. Equivalent to
434+ * creating an instance with GIT_FETCH_OPTIONS_INIT.
435+ *
436+ * @param opts the `git_fetch_options` instance to initialize.
437+ * @param version the version of the struct; you should pass
438+ * `GIT_FETCH_OPTIONS_VERSION` here.
439+ * @return Zero on success; -1 on failure.
440+ */
441+ GIT_EXTERN (int ) git_fetch_init_options (
442+ git_fetch_options * opts ,
443+ unsigned int version );
444+
398445/**
399446 * Download new data and update tips
400447 *
401448 * Convenience function to connect to a remote, download the data,
402449 * disconnect and update the remote-tracking branches.
403450 *
404451 * @param remote the remote to fetch from
405- * @param refspecs the refspecs to use for this fetch. Pass NULL or an
406- * empty array to use the base refspecs.
407- * @param signature The identity to use when updating reflogs
408- * @param reflog_message The message to insert into the reflogs. If NULL, the
409- * default is "fetch"
452+ * @param opts configuration to use for this fetch
410453 * @return 0 or an error code
411454 */
412455GIT_EXTERN (int ) git_remote_fetch (
413- git_remote * remote ,
414- const git_strarray * refspecs ,
415- const git_signature * signature ,
416- const char * reflog_message );
456+ git_remote * remote ,
457+ const git_remote_callbacks * callbacks ,
458+ const git_fetch_options * opts );
417459
418460/**
419461 * Perform a push
420462 *
421463 * Peform all the steps from a push.
422464 *
423465 * @param remote the remote to push to
424- * @param refspecs the refspecs to use for pushing. If none are
425- * passed, the configured refspecs will be used
426- * @param opts the options
427- * @param signature signature to use for the reflog of updated references
428- * @param reflog_message message to use for the reflog of upated references
466+ * @param opts the options to use for this push
429467 */
430- GIT_EXTERN (int ) git_remote_push (git_remote * remote ,
431- const git_strarray * refspecs ,
432- const git_push_options * opts ,
433- const git_signature * signature , const char * reflog_message );
468+ GIT_EXTERN (int ) git_remote_push (
469+ git_remote * remote ,
470+ const git_remote_callbacks * callbacks ,
471+ const git_push_options * opts );
434472
435473/**
436474 * Get a list of the configured remotes for a repo
@@ -548,45 +586,11 @@ GIT_EXTERN(int) git_remote_init_callbacks(
548586 git_remote_callbacks * opts ,
549587 unsigned int version );
550588
551- /**
552- * Set the callbacks for a remote
553- *
554- * Note that the remote keeps its own copy of the data and you need to
555- * call this function again if you want to change the callbacks.
556- *
557- * @param remote the remote to configure
558- * @param callbacks a pointer to the user's callback settings
559- * @return 0 or an error code
560- */
561- GIT_EXTERN (int ) git_remote_set_callbacks (git_remote * remote , const git_remote_callbacks * callbacks );
562-
563- /**
564- * Retrieve the current callback structure
565- *
566- * This provides read access to the callbacks structure as the remote
567- * sees it.
568- *
569- * @param remote the remote to query
570- * @return a pointer to the callbacks structure
571- */
572- GIT_EXTERN (const git_remote_callbacks * ) git_remote_get_callbacks (git_remote * remote );
573-
574589/**
575590 * Get the statistics structure that is filled in by the fetch operation.
576591 */
577592GIT_EXTERN (const git_transfer_progress * ) git_remote_stats (git_remote * remote );
578593
579- /**
580- * Automatic tag following option
581- *
582- * Lets us select the --tags option to use.
583- */
584- typedef enum {
585- GIT_REMOTE_DOWNLOAD_TAGS_AUTO = 0 ,
586- GIT_REMOTE_DOWNLOAD_TAGS_NONE = 1 ,
587- GIT_REMOTE_DOWNLOAD_TAGS_ALL = 2
588- } git_remote_autotag_option_t ;
589-
590594/**
591595 * Retrieve the tag auto-follow setting
592596 *
@@ -595,16 +599,6 @@ typedef enum {
595599 */
596600GIT_EXTERN (git_remote_autotag_option_t ) git_remote_autotag (const git_remote * remote );
597601
598- /**
599- * Set the tag auto-follow setting
600- *
601- * @param remote the remote to configure
602- * @param value a GIT_REMOTE_DOWNLOAD_TAGS value
603- */
604- GIT_EXTERN (void ) git_remote_set_autotag (
605- git_remote * remote ,
606- git_remote_autotag_option_t value );
607-
608602/**
609603 * Retrieve the ref-prune setting
610604 *
@@ -624,7 +618,7 @@ GIT_EXTERN(int) git_remote_prune_refs(const git_remote *remote);
624618 *
625619 * No loaded instances of a the remote with the old name will change
626620 * their name or their list of refspecs.
627- *
621+ *a
628622 * @param problems non-default refspecs cannot be renamed and will be
629623 * stored here for further processing by the caller. Always free this
630624 * strarray on successful return.
@@ -646,16 +640,7 @@ GIT_EXTERN(int) git_remote_rename(
646640 * @return the update FETCH_HEAD setting
647641 */
648642GIT_EXTERN (int ) git_remote_update_fetchhead (git_remote * remote );
649-
650- /**
651- * Sets the update FETCH_HEAD setting. By default, FETCH_HEAD will be
652- * updated on every fetch. Set to 0 to disable.
653- *
654- * @param remote the remote to configure
655- * @param value 0 to disable updating FETCH_HEAD
656- */
657- GIT_EXTERN (void ) git_remote_set_update_fetchhead (git_remote * remote , int value );
658-
643+
659644/**
660645 * Ensure the remote name is well-formed.
661646 *
0 commit comments