Code

gitweb: Always display link to blobdiff_plain in git_blobdiff
[git.git] / builtin-push.c
index 66b94078229c09d8105fcd7f5800a2cba567c972..2b5e6fa9ed18c20cda264dbaf9df9d3cbac93c0e 100644 (file)
@@ -8,16 +8,16 @@
 
 #define MAX_URI (16)
 
-static const char push_usage[] = "git push [--all] [--tags] [--force] <repository> [<refspec>...]";
+static const char push_usage[] = "git-push [--all] [--tags] [-f | --force] <repository> [<refspec>...]";
 
-static int all = 0, tags = 0, force = 0, thin = 1;
-static const char *execute = NULL;
+static int all, tags, force, thin = 1;
+static const char *execute;
 
 #define BUF_SIZE (2084)
 static char buffer[BUF_SIZE];
 
-static const char **refspec = NULL;
-static int refspec_nr = 0;
+static const char **refspec;
+static int refspec_nr;
 
 static void add_refspec(const char *ref)
 {
@@ -32,10 +32,8 @@ static int expand_one_ref(const char *ref, const unsigned char *sha1)
        /* Ignore the "refs/" at the beginning of the refname */
        ref += 5;
 
-       if (strncmp(ref, "tags/", 5))
-               return 0;
-
-       add_refspec(strdup(ref));
+       if (!strncmp(ref, "tags/", 5))
+               add_refspec(strdup(ref));
        return 0;
 }
 
@@ -104,7 +102,7 @@ static int get_remotes_uri(const char *repo, const char *uri[MAX_URI])
                        if (n < MAX_URI)
                                uri[n++] = strdup(s);
                        else
-                               error("more than %d URL's specified, ignoreing the rest", MAX_URI);
+                               error("more than %d URL's specified, ignoring the rest", MAX_URI);
                }
                else if (is_refspec && !has_explicit_refspec)
                        add_refspec(strdup(s));
@@ -270,10 +268,10 @@ static int do_push(const char *repo)
        return 0;
 }
 
-int cmd_push(int argc, const char **argv, char **envp)
+int cmd_push(int argc, const char **argv, const char *prefix)
 {
        int i;
-       const char *repo = "origin";    // default repository
+       const char *repo = "origin";    /* default repository */
 
        for (i = 1; i < argc; i++) {
                const char *arg = argv[i];
@@ -291,7 +289,7 @@ int cmd_push(int argc, const char **argv, char **envp)
                        tags = 1;
                        continue;
                }
-               if (!strcmp(arg, "--force")) {
+               if (!strcmp(arg, "--force") || !strcmp(arg, "-f")) {
                        force = 1;
                        continue;
                }