remote.c: add command line option parser for "--force-with-lease"
[gitweb.git] / builtin / send-pack.c
index e86d3b5d672a945a1a24bfc96ab5e7b451f5d7f5..a23b26db17934cb4d320d7838f5883de72a14ebb 100644 (file)
@@ -103,6 +103,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
        int flags;
        unsigned int reject_reasons;
        int progress = -1;
+       struct push_cas_option cas = {0};
 
        argv++;
        for (i = 1; i < argc; i++, argv++) {
@@ -165,6 +166,22 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
                                helper_status = 1;
                                continue;
                        }
+                       if (!strcmp(arg, "--" CAS_OPT_NAME)) {
+                               if (parse_push_cas_option(&cas, NULL, 0) < 0)
+                                       exit(1);
+                               continue;
+                       }
+                       if (!strcmp(arg, "--no-" CAS_OPT_NAME)) {
+                               if (parse_push_cas_option(&cas, NULL, 1) < 0)
+                                       exit(1);
+                               continue;
+                       }
+                       if (!prefixcmp(arg, "--" CAS_OPT_NAME "=")) {
+                               if (parse_push_cas_option(&cas,
+                                                         strchr(arg, '=') + 1, 1) < 0)
+                                       exit(1);
+                               continue;
+                       }
                        usage(send_pack_usage);
                }
                if (!dest) {