Merge branch 'jc/read-tree-empty-with-m' into maint
[gitweb.git] / builtin / push.c
index 9307ad56a9fb91455eaf06371382b1431d115598..a597759d8fac205f41c406d0a0e32f9240941190 100644 (file)
@@ -510,8 +510,8 @@ int cmd_push(int argc, const char **argv, const char *prefix)
        int push_cert = -1;
        int rc;
        const char *repo = NULL;        /* default repository */
-       static struct string_list push_options = STRING_LIST_INIT_DUP;
-       static struct string_list_item *item;
+       struct string_list push_options = STRING_LIST_INIT_DUP;
+       const struct string_list_item *item;
 
        struct option options[] = {
                OPT__VERBOSITY(&verbosity),
@@ -568,6 +568,8 @@ int cmd_push(int argc, const char **argv, const char *prefix)
                flags |= TRANSPORT_RECURSE_SUBMODULES_CHECK;
        else if (recurse_submodules == RECURSE_SUBMODULES_ON_DEMAND)
                flags |= TRANSPORT_RECURSE_SUBMODULES_ON_DEMAND;
+       else if (recurse_submodules == RECURSE_SUBMODULES_ONLY)
+               flags |= TRANSPORT_RECURSE_SUBMODULES_ONLY;
 
        if (tags)
                add_refspec("refs/tags/*");
@@ -582,6 +584,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
                        die(_("push options must not have new line characters"));
 
        rc = do_push(repo, flags, &push_options);
+       string_list_clear(&push_options, 0);
        if (rc == -1)
                usage_with_options(push_usage, options);
        else