@@ -205,14 +205,12 @@ static const char *get_upstream_ref(struct branch *branch, const char *remote_na
205
205
static const char * setup_push_upstream (struct remote * remote , struct branch * branch ,
206
206
int same_remote )
207
207
{
208
- const char * upstream_ref ;
209
- upstream_ref = get_upstream_ref (branch , remote -> name );
210
208
if (!same_remote )
211
209
die (_ ("You are pushing to remote '%s', which is not the upstream of\n"
212
210
"your current branch '%s', without telling me what to push\n"
213
211
"to update which remote branch." ),
214
212
remote -> name , branch -> name );
215
- return upstream_ref ;
213
+ return get_upstream_ref ( branch , remote -> name ) ;
216
214
}
217
215
218
216
static const char * setup_push_current (struct remote * remote , struct branch * branch )
@@ -222,15 +220,9 @@ static const char *setup_push_current(struct remote *remote, struct branch *bran
222
220
223
221
static const char * setup_push_simple (struct remote * remote , struct branch * branch , int same_remote )
224
222
{
225
- if (same_remote ) {
226
- const char * upstream_ref ;
227
-
228
- upstream_ref = get_upstream_ref (branch , remote -> name );
229
-
230
- /* Additional safety */
231
- if (strcmp (branch -> refname , upstream_ref ))
223
+ if (same_remote )
224
+ if (strcmp (branch -> refname , get_upstream_ref (branch , remote -> name )))
232
225
die_push_simple (branch , remote );
233
- }
234
226
return branch -> refname ;
235
227
}
236
228
0 commit comments