X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=builtin%2Fpush.c;h=e655eb7695faba13c4d9e8f25b9649ffec7195be;hb=bb0a484e985ef8d9bbbbeb172b1fcf4982634bef;hp=62957ededdf72b93f088586f5d577ef8d38a7f6c;hpb=df9930c129d4cfe4d39e5e4688a6a55a2bca0050;p=git.git diff --git a/builtin/push.c b/builtin/push.c index 62957eded..e655eb769 100644 --- a/builtin/push.c +++ b/builtin/push.c @@ -10,7 +10,7 @@ #include "parse-options.h" static const char * const push_usage[] = { - "git push [] [ ...]", + "git push [] [ [...]]", NULL, }; @@ -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) @@ -130,8 +130,8 @@ static int push_with_options(struct transport *transport, int flags) if (nonfastforward && advice_push_nonfastforward) { fprintf(stderr, "To prevent you from losing history, non-fast-forward updates were rejected\n" - "Merge the remote changes before pushing again. See the 'Note about\n" - "fast-forwards' section of 'git push --help' for details.\n"); + "Merge the remote changes (e.g. 'git pull') before pushing again. See the\n" + "'Note about fast-forwards' section of 'git push --help' for details.\n"); } return 1;