Merge branch 'ab/gc-reflog'
[gitweb.git] / parse-options.c
index acc3a93660e6b567bd8a7285dd4e43860dd0a7f3..cb24f1aa8ae980a366f6f700db15b68064e1f926 100644 (file)
@@ -288,6 +288,8 @@ static enum parse_opt_result parse_long_opt(
                                             optname(options, flags));
                        if (*rest)
                                continue;
+                       if (options->value)
+                               *(int *)options->value = options->defval;
                        p->out[p->cpidx++] = arg - 2;
                        return PARSE_OPT_DONE;
                }
@@ -529,8 +531,7 @@ static void show_negated_gitcomp(const struct option *opts, int nr_noopts)
        }
 }
 
-static int show_gitcomp(struct parse_opt_ctx_t *ctx,
-                       const struct option *opts)
+static int show_gitcomp(const struct option *opts)
 {
        const struct option *original_opts = opts;
        int nr_noopts = 0;
@@ -609,7 +610,7 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
 
                /* lone --git-completion-helper is asked by git-completion.bash */
                if (ctx->total == 1 && !strcmp(arg + 1, "-git-completion-helper"))
-                       return show_gitcomp(ctx, options);
+                       return show_gitcomp(options);
 
                if (arg[1] != '-') {
                        ctx->opt = arg + 1;