aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-24 18:50:35 -0400
committerJunio C Hamano <gitster@pobox.com>2011-05-24 16:25:46 -0700
commit73546c085d49694c5e54b421f80bde6bc25006fb (patch)
tree5c1ad80fbf8fb766ab25de47819c3a46b4c1c758 /t
parent06eb708f331f0829081f4f3fb3c465eaae345deb (diff)
downloadgit-73546c085d49694c5e54b421f80bde6bc25006fb.tar.gz
git-73546c085d49694c5e54b421f80bde6bc25006fb.tar.xz
handle_options(): do not miscount how many arguments were used
The handle_options() function advances the base of the argument array and returns the number of arguments it used. The caller in handle_alias() wants to reallocate the argv array it passes to this function, and attempts to do so by subtracting the returned value to compensate for the change handle_options() makes to the new_argv. But handle_options() did not correctly count when "-c <config=value>" is given, causing a wrong pointer to be passed to realloc(). Fix it by saving the original argv at the beginning of handle_options(), and return the difference between the final value of argv, which will relieve the places that move the array pointer from the additional burden of keeping track of "handled" counter. Noticed-by: Kazuki Tsujimoto Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1300-repo-config.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 52c9ac9b6..de2a014d8 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -854,7 +854,7 @@ test_expect_success 'git -c "key=value" support' '
test_must_fail git -c core.name=value config name
'
-test_expect_failure 'git -c works with aliases of builtins' '
+test_expect_success 'git -c works with aliases of builtins' '
git config alias.checkconfig "-c foo.check=bar config foo.check" &&
echo bar >expect &&
git checkconfig >actual &&