Re: [BUG] realloc failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Junio C Hamano <gitster@xxxxxxxxx>
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 <kazuki@xxxxxxxxxx>
---
 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 <name>=<value>" 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 <<EOF &&
+[alias]
+ss = -c name=value status
+EOF
+		cd dir &&
+		test_must_fail git ss 2> ../actual
+	) &&
+	test_cmp expect actual
+'
+
 test_expect_success '!alias expansion' '
 	pwd >expect &&
 	(


-- 
Kazuki Tsujimoto

--
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


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]