@@ -1863,6 +1863,7 @@ static void one_remote_ref(char *refname)
18631863 struct ref * ref ;
18641864 unsigned char remote_sha1 [20 ];
18651865 struct object * obj ;
1866+ int len = strlen (refname ) + 1 ;
18661867
18671868 if (fetch_ref (refname , remote_sha1 ) != 0 ) {
18681869 fprintf (stderr ,
@@ -1884,7 +1885,6 @@ static void one_remote_ref(char *refname)
18841885 }
18851886 }
18861887
1887- int len = strlen (refname ) + 1 ;
18881888 ref = xcalloc (1 , sizeof (* ref ) + len );
18891889 memcpy (ref -> old_sha1 , remote_sha1 , 20 );
18901890 memcpy (ref -> name , refname , len );
@@ -2313,6 +2313,8 @@ int main(int argc, char **argv)
23132313 int objects_to_send ;
23142314 int rc = 0 ;
23152315 int i ;
2316+ int new_refs ;
2317+ struct ref * ref ;
23162318
23172319 setup_git_directory ();
23182320 setup_ident ();
@@ -2347,8 +2349,8 @@ int main(int argc, char **argv)
23472349 }
23482350 }
23492351 if (!remote -> url ) {
2350- remote -> url = arg ;
23512352 char * path = strstr (arg , "//" );
2353+ remote -> url = arg ;
23522354 if (path ) {
23532355 path = index (path + 2 , '/' );
23542356 if (path )
@@ -2421,10 +2423,13 @@ int main(int argc, char **argv)
24212423 return 0 ;
24222424 }
24232425
2424- int new_refs = 0 ;
2425- struct ref * ref ;
2426+ new_refs = 0 ;
24262427 for (ref = remote_refs ; ref ; ref = ref -> next ) {
24272428 char old_hex [60 ], * new_hex ;
2429+ const char * commit_argv [4 ];
2430+ int commit_argc ;
2431+ char * new_sha1_hex , * old_sha1_hex ;
2432+
24282433 if (!ref -> peer_ref )
24292434 continue ;
24302435 if (!memcmp (ref -> old_sha1 , ref -> peer_ref -> new_sha1 , 20 )) {
@@ -2482,10 +2487,9 @@ int main(int argc, char **argv)
24822487 }
24832488
24842489 /* Set up revision info for this refspec */
2485- const char * commit_argv [4 ];
2486- int commit_argc = 3 ;
2487- char * new_sha1_hex = strdup (sha1_to_hex (ref -> new_sha1 ));
2488- char * old_sha1_hex = NULL ;
2490+ commit_argc = 3 ;
2491+ new_sha1_hex = strdup (sha1_to_hex (ref -> new_sha1 ));
2492+ old_sha1_hex = NULL ;
24892493 commit_argv [1 ] = "--objects" ;
24902494 commit_argv [2 ] = new_sha1_hex ;
24912495 if (!push_all && !is_zero_sha1 (ref -> old_sha1 )) {
0 commit comments