]> asedeno.scripts.mit.edu Git - git.git/blobdiff - builtin/push.c
apply: run setup_git_directory_gently() sooner
[git.git] / builtin / push.c
index f4358b9d230f6d8d7a9a67fdfbc60279c5ec71ee..a2cc9fdea1b22739681c26ee3723058c91018d81 100644 (file)
@@ -22,13 +22,13 @@ static int progress;
 
 static const char **refspec;
 static int refspec_nr;
+static int refspec_alloc;
 
 static void add_refspec(const char *ref)
 {
-       int nr = refspec_nr + 1;
-       refspec = xrealloc(refspec, nr * sizeof(char *));
-       refspec[nr-1] = ref;
-       refspec_nr = nr;
+       refspec_nr++;
+       ALLOC_GROW(refspec, refspec_nr, refspec_alloc);
+       refspec[refspec_nr-1] = ref;
 }
 
 static void set_refspecs(const char **refs, int nr)