@@ -202,30 +202,6 @@ static const char *get_upstream_ref(struct branch *branch, const char *remote_na
202
202
return branch -> merge [0 ]-> src ;
203
203
}
204
204
205
- static const char * setup_push_upstream (struct remote * remote , struct branch * branch ,
206
- int same_remote )
207
- {
208
- if (!same_remote )
209
- die (_ ("You are pushing to remote '%s', which is not the upstream of\n"
210
- "your current branch '%s', without telling me what to push\n"
211
- "to update which remote branch." ),
212
- remote -> name , branch -> name );
213
- return get_upstream_ref (branch , remote -> name );
214
- }
215
-
216
- static const char * setup_push_current (struct remote * remote , struct branch * branch )
217
- {
218
- return branch -> refname ;
219
- }
220
-
221
- static const char * setup_push_simple (struct remote * remote , struct branch * branch , int same_remote )
222
- {
223
- if (same_remote )
224
- if (strcmp (branch -> refname , get_upstream_ref (branch , remote -> name )))
225
- die_push_simple (branch , remote );
226
- return branch -> refname ;
227
- }
228
-
229
205
static int is_same_remote (struct remote * remote )
230
206
{
231
207
struct remote * fetch_remote = remote_get (NULL );
@@ -259,15 +235,23 @@ static void setup_default_push_refspecs(struct remote *remote)
259
235
default :
260
236
case PUSH_DEFAULT_UNSPECIFIED :
261
237
case PUSH_DEFAULT_SIMPLE :
262
- dst = setup_push_simple (remote , branch , same_remote );
238
+ if (same_remote )
239
+ if (strcmp (branch -> refname , get_upstream_ref (branch , remote -> name )))
240
+ die_push_simple (branch , remote );
241
+ dst = branch -> refname ;
263
242
break ;
264
243
265
244
case PUSH_DEFAULT_UPSTREAM :
266
- dst = setup_push_upstream (remote , branch , same_remote );
245
+ if (!same_remote )
246
+ die (_ ("You are pushing to remote '%s', which is not the upstream of\n"
247
+ "your current branch '%s', without telling me what to push\n"
248
+ "to update which remote branch." ),
249
+ remote -> name , branch -> name );
250
+ dst = get_upstream_ref (branch , remote -> name );
267
251
break ;
268
252
269
253
case PUSH_DEFAULT_CURRENT :
270
- dst = setup_push_current ( remote , branch ) ;
254
+ dst = branch -> refname ;
271
255
break ;
272
256
}
273
257
0 commit comments