---
 Documentation/git-push.txt | 3 +++
 builtin/push.c             | 9 ++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt
index 3e76e99f3..e1036feaf 100644
--- a/Documentation/git-push.txt
+++ b/Documentation/git-push.txt
@@ -161,6 +161,9 @@ already exists on the remote side.
        Transmit the given string to the server, which passes them to
        the pre-receive as well as the post-receive hook. The given string
        must not contain a NUL or LF character.
+       Can be configured using "git config push.optionDefault <option-string>".
+       After configured git push will always be executed silently
+       with --push-options <options configured>.
 
 --receive-pack=<git-receive-pack>::
 --exec=<git-receive-pack>::
diff --git a/builtin/push.c b/builtin/push.c
index 2ac810422..ae3efafce 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -467,11 +467,18 @@ static int git_push_config(const char *k, const char *v, 
void *cb)
 {
        int *flags = cb;
        int status;
+       struct string_list push_options = STRING_LIST_INIT_DUP;
 
        status = git_gpg_config(k, v, NULL);
        if (status)
                return status;
 
+       const struct string_list *optionsDefault = 
git_config_get_value_multi("push.optionDefault");
+       for (int i = 0; i < optionsDefault->nr; i++) {
+               string_list_insert(&push_options, 
optionsDefault->items[i].string);
+       }
+
+
        if (!strcmp(k, "push.followtags")) {
                if (git_config_bool(k, v))
                        *flags |= TRANSPORT_PUSH_FOLLOW_TAGS;
@@ -515,7 +522,7 @@ int cmd_push(int argc, const char **argv, const char 
*prefix)
        int push_cert = -1;
        int rc;
        const char *repo = NULL;        /* default repository */
-       struct string_list push_options = STRING_LIST_INIT_DUP;
+       static struct string_list push_options = STRING_LIST_INIT_DUP;
        const struct string_list_item *item;
 
        struct option options[] = {
-- 
2.15.0.rc0.39.g2f0e14e.dirty

Reply via email to