Skip to content

Commit 668fa07

Browse files
authored
Merge pull request libgit2#4363 from cjhoward92/typedef-push-update-reference
remote: add typedef to normalize push_update_reference callback
2 parents e2e3943 + 7138ce3 commit 668fa07

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

include/git2/remote.h

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,20 @@ typedef struct {
385385
*/
386386
typedef int (*git_push_negotiation)(const git_push_update **updates, size_t len, void *payload);
387387

388+
/**
389+
* Callback used to inform of the update status from the remote.
390+
*
391+
* Called for each updated reference on push. If `status` is
392+
* not `NULL`, the update was rejected by the remote server
393+
* and `status` contains the reason given.
394+
*
395+
* @param refname refname specifying to the remote ref
396+
* @param status status message sent from the remote
397+
* @param data data provided by the caller
398+
* @return 0 on success, otherwise an error
399+
*/
400+
typedef int (*git_push_update_reference_cb)(const char *refname, const char *status, void *data);
401+
388402
/**
389403
* The callback settings structure
390404
*
@@ -452,11 +466,9 @@ struct git_remote_callbacks {
452466
git_push_transfer_progress push_transfer_progress;
453467

454468
/**
455-
* Called for each updated reference on push. If `status` is
456-
* not `NULL`, the update was rejected by the remote server
457-
* and `status` contains the reason given.
469+
* See documentation of git_push_update_reference_cb
458470
*/
459-
int (*push_update_reference)(const char *refname, const char *status, void *data);
471+
git_push_update_reference_cb push_update_reference;
460472

461473
/**
462474
* Called once between the negotiation step and the upload. It

0 commit comments

Comments
 (0)