]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin-push.c
t1010-mktree: Adjust expected result to code and documentation
[thirdparty/git.git] / builtin-push.c
index 5df66081a6ff0ca5087ff9a2ac4042d8ec651499..9fc69312472828a5d6c467799823fc96d94334cd 100644 (file)
@@ -10,7 +10,7 @@
 #include "parse-options.h"
 
 static const char * const push_usage[] = {
-       "git push [<options>] [<repository> <refspec>...]",
+       "git push [<options>] [<repository> [<refspec>...]]",
        NULL,
 };
 
@@ -52,7 +52,7 @@ static void set_refspecs(const char **refs, int nr)
                } else if (deleterefs && !strchr(ref, ':')) {
                        char *delref;
                        int len = strlen(ref)+1;
-                       delref = xmalloc(len);
+                       delref = xmalloc(len+1);
                        strcpy(delref, ":");
                        strcat(delref, ref);
                        ref = delref;
@@ -68,7 +68,7 @@ static void setup_push_tracking(void)
        struct branch *branch = branch_get(NULL);
        if (!branch)
                die("You are not currently on a branch.");
-       if (!branch->merge_nr)
+       if (!branch->merge_nr || !branch->merge)
                die("The current branch %s is not tracking anything.",
                    branch->name);
        if (branch->merge_nr != 1)