On 2009-10-04, Jeff King wrote: > Thanks, your fix looks sane. But I am curious about whether we are > triggering some glibc pickiness that is in your setup, or if we are > somehow violating the assumption that we only ever look at > default_arg[1] and beyond. I had a look at parse-options.c. In parse_options_start, argv is assigned to ctx->out, which is overwritten from index 0 in parse_options_end. This will show the problem: diff --git a/builtin-show-branch.c b/builtin-show-branch.c index 3510a86..1c587ad 100644 --- a/builtin-show-branch.c +++ b/builtin-show-branch.c @@ -691,6 +691,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix) showbranch_use_color = git_use_color_default; /* If nothing is specified, try the default first */ + printf("default_arg = %p\n", default_arg); if (ac == 1 && default_num) { ac = default_num + 1; av = default_arg - 1; /* ick; we would not address av[0] */ diff --git a/parse-options.c b/parse-options.c index f559411..267e752 100644 --- a/parse-options.c +++ b/parse-options.c @@ -435,6 +435,7 @@ unknown: int parse_options_end(struct parse_opt_ctx_t *ctx) { + printf("Assigning to %p\n", ctx->out + ctx->cpidx); memmove(ctx->out + ctx->cpidx, ctx->argv, ctx->argc * sizeof(*ctx->out)); ctx->out[ctx->cpidx + ctx->argc] = NULL; return ctx->cpidx + ctx->argc; -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html