@@ -205,14 +205,12 @@ static const char *get_upstream_ref(struct branch *branch, const char *remote_na
205205static const char * setup_push_upstream (struct remote * remote , struct branch * branch ,
206206 int same_remote )
207207{
208- const char * upstream_ref ;
209- upstream_ref = get_upstream_ref (branch , remote -> name );
210208 if (!same_remote )
211209 die (_ ("You are pushing to remote '%s', which is not the upstream of\n"
212210 "your current branch '%s', without telling me what to push\n"
213211 "to update which remote branch." ),
214212 remote -> name , branch -> name );
215- return upstream_ref ;
213+ return get_upstream_ref ( branch , remote -> name ) ;
216214}
217215
218216static 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
222220
223221static const char * setup_push_simple (struct remote * remote , struct branch * branch , int same_remote )
224222{
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 )))
232225 die_push_simple (branch , remote );
233- }
234226 return branch -> refname ;
235227}
236228
0 commit comments