From: Kazuki Tsujimoto Date: Sat, 21 May 2011 05:50:58 GMT Subject: Re: [BUG] realloc failed Message-ID: <20110521145056.E3F5.BA9123DE@callcc.net> In-Reply-To: <7vhb8o25tt.fsf@alter.siamese.dyndns.org> From: Junio C Hamano Date: Fri, 20 May 2011 18:35:58 -0700 > Care to send a patch with test (see Documentation/SubmittingPatches)? Thanks for your comment. Here is a patch with test. [PATCH] Avoid "realloc failed" error in alias expansion including -c option When the -c option is specified, setenv will be called. Therefore, set envchanged flag to true so that git exits with "alias '%s' changes environment variables" error. Signed-off-by: Kazuki Tsujimoto --- git.c | 2 ++ t/t1020-subdirectory.sh | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/git.c b/git.c index a5ef3c6..e04e4d4 100644 --- a/git.c +++ b/git.c @@ -153,6 +153,8 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) usage(git_usage_string); } git_config_push_parameter((*argv)[1]); + if (envchanged) + *envchanged = 1; (*argv)++; (*argc)--; } else { diff --git a/t/t1020-subdirectory.sh b/t/t1020-subdirectory.sh index ddc3921..94fed9c 100755 --- a/t/t1020-subdirectory.sh +++ b/t/t1020-subdirectory.sh @@ -119,6 +119,21 @@ test_expect_success 'alias expansion' ' ) ' +test_expect_success 'alias expansion including "-c =" option' ' + printf "%s\n%s\n" \ + "fatal: alias '"'ss'"' changes environment variables" \ + "You can use '"'!git'"' in the alias to do this.">expect && + ( + cat > .git/config < ../actual + ) && + test_cmp expect actual +' + test_expect_success '!alias expansion' ' pwd >expect && ( -- Kazuki Tsujimoto