@@ -51,4 +51,114 @@ struct git_push {
5151 */
5252void git_push_status_free (push_status * status );
5353
54+ /**
55+ * Create a new push object
56+ *
57+ * @param out New push object
58+ * @param remote Remote instance
59+ *
60+ * @return 0 or an error code
61+ */
62+ int git_push_new (git_push * * out , git_remote * remote );
63+
64+ /**
65+ * Set options on a push object
66+ *
67+ * @param push The push object
68+ * @param opts The options to set on the push object
69+ *
70+ * @return 0 or an error code
71+ */
72+ int git_push_set_options (
73+ git_push * push ,
74+ const git_push_options * opts );
75+
76+ /**
77+ * Set the callbacks for a push
78+ *
79+ * @param push The push object
80+ * @param pack_progress_cb Function to call with progress information during
81+ * pack building. Be aware that this is called inline with pack building
82+ * operations, so performance may be affected.
83+ * @param pack_progress_cb_payload Payload for the pack progress callback.
84+ * @param transfer_progress_cb Function to call with progress information during
85+ * the upload portion of a push. Be aware that this is called inline with
86+ * pack building operations, so performance may be affected.
87+ * @param transfer_progress_cb_payload Payload for the network progress callback.
88+ * @return 0 or an error code
89+ */
90+ int git_push_set_callbacks (
91+ git_push * push ,
92+ git_packbuilder_progress pack_progress_cb ,
93+ void * pack_progress_cb_payload ,
94+ git_push_transfer_progress transfer_progress_cb ,
95+ void * transfer_progress_cb_payload );
96+
97+ /**
98+ * Add a refspec to be pushed
99+ *
100+ * @param push The push object
101+ * @param refspec Refspec string
102+ *
103+ * @return 0 or an error code
104+ */
105+ int git_push_add_refspec (git_push * push , const char * refspec );
106+
107+ /**
108+ * Update remote tips after a push
109+ *
110+ * @param push The push object
111+ * @param signature The identity to use when updating reflogs
112+ * @param reflog_message The message to insert into the reflogs. If NULL, the
113+ * default is "update by push".
114+ *
115+ * @return 0 or an error code
116+ */
117+ int git_push_update_tips (
118+ git_push * push ,
119+ const git_signature * signature ,
120+ const char * reflog_message );
121+
122+ /**
123+ * Perform the push
124+ *
125+ * This function will return an error in case of a protocol error or
126+ * the server being unable to unpack the data we sent.
127+ *
128+ * The return value does not reflect whether the server accepted or
129+ * refused any reference updates. Use `git_push_status_foreach()` in
130+ * order to find out which updates were accepted or rejected.
131+ *
132+ * @param push The push object
133+ *
134+ * @return 0 or an error code
135+ */
136+ int git_push_finish (git_push * push );
137+
138+ /**
139+ * Invoke callback `cb' on each status entry
140+ *
141+ * For each of the updated references, we receive a status report in the
142+ * form of `ok refs/heads/master` or `ng refs/heads/master <msg>`.
143+ * `msg != NULL` means the reference has not been updated for the given
144+ * reason.
145+ *
146+ * Return a non-zero value from the callback to stop the loop.
147+ *
148+ * @param push The push object
149+ * @param cb The callback to call on each object
150+ *
151+ * @return 0 on success, non-zero callback return value, or error code
152+ */
153+ int git_push_status_foreach (git_push * push ,
154+ int (* cb )(const char * ref , const char * msg , void * data ),
155+ void * data );
156+
157+ /**
158+ * Free the given push object
159+ *
160+ * @param push The push object
161+ */
162+ void git_push_free (git_push * push );
163+
54164#endif
0 commit comments