diff options
author | Junio C Hamano <gitster@pobox.com> | 2009-06-08 23:26:44 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-10-04 14:44:34 -0700 |
commit | 3af1cae469555485cd3ef003aa2a55bd2a4f544f (patch) | |
tree | 90d51c0e12927afc0fd6e71afec182f80babdc60 /t/t3202-show-branch-octopus.sh | |
parent | 57343652a55bdc3e7f3cf8c6def94dac482c72e5 (diff) | |
download | git-3af1cae469555485cd3ef003aa2a55bd2a4f544f.tar.gz |
show-branch: fix segfault when showbranch.default exists
When running "git show-branch" without any parameter in a repository that
has showbranch.default defined, we used to rely on the fact that our
handcrafted option parsing loop never looked at av[0].
The array of default strings had the first real command line argument in
default_arg[0], but the option parser wanted to look at the array starting
at av[1], so we assigned the address of -1th element to av to force the
loop start working from default_arg[0].
This no longer worked since 5734365 (show-branch: migrate to parse-options
API, 2009-05-21), as parse_options_start() saved the incoming &av[0] in
its ctx->out and later in parse_options_end() it did memmove to ctx->out
(with ctx->cpidx == 0), overwriting the memory before default_arg[] array.
I am not sure if this is a bug in parse_options(), or a bug in the caller,
and tonight I do not have enough concentration to figure out which. In
any case, this patch works the issue around.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3202-show-branch-octopus.sh')
-rwxr-xr-x | t/t3202-show-branch-octopus.sh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/t/t3202-show-branch-octopus.sh b/t/t3202-show-branch-octopus.sh index 7fe4a6ecb0..0a5d5e669f 100755 --- a/t/t3202-show-branch-octopus.sh +++ b/t/t3202-show-branch-octopus.sh @@ -56,4 +56,12 @@ test_expect_success 'show-branch with more than 8 branches' ' ' +test_expect_success 'show-branch with showbranch.default' ' + for i in $numbers; do + git config --add showbranch.default branch$i + done && + git show-branch >out && + test_cmp expect out +' + test_done |