@@ -180,6 +180,10 @@ int git_push_update_tips(git_push *push)
180180 git_vector_foreach (& push -> status , i , status ) {
181181 int fire_callback = 1 ;
182182
183+ /* Skip unsuccessful updates which have non-empty messages */
184+ if (status -> msg )
185+ continue ;
186+
183187 /* Find the corresponding remote ref */
184188 fetch_spec = git_remote__matching_refspec (push -> remote , status -> ref );
185189 if (!fetch_spec )
@@ -198,21 +202,18 @@ int git_push_update_tips(git_push *push)
198202 if (j == push -> specs .length )
199203 continue ;
200204
201- /* If this ref update was successful (ok, not ng), it will have an empty message */
202- if (status -> msg == NULL ) {
203- /* Update the remote ref */
204- if (git_oid_iszero (& push_spec -> loid )) {
205- error = git_reference_lookup (& remote_ref , push -> remote -> repo , git_buf_cstr (& remote_ref_name ));
205+ /* Update the remote ref */
206+ if (git_oid_iszero (& push_spec -> loid )) {
207+ error = git_reference_lookup (& remote_ref , push -> remote -> repo , git_buf_cstr (& remote_ref_name ));
206208
207- if (error >= 0 ) {
208- error = git_reference_delete (remote_ref );
209- git_reference_free (remote_ref );
210- }
211- } else {
212- error = git_reference_create (NULL , push -> remote -> repo ,
213- git_buf_cstr (& remote_ref_name ), & push_spec -> loid , 1 ,
214- "update by push" );
209+ if (error >= 0 ) {
210+ error = git_reference_delete (remote_ref );
211+ git_reference_free (remote_ref );
215212 }
213+ } else {
214+ error = git_reference_create (NULL , push -> remote -> repo ,
215+ git_buf_cstr (& remote_ref_name ), & push_spec -> loid , 1 ,
216+ "update by push" );
216217 }
217218
218219 if (error < 0 ) {
0 commit comments