All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/2] t/lib-http/apache.conf: load mod_unixd module in apache 2.4
@ 2016-02-25 18:57 Jacob Keller
  2016-02-25 18:57 ` [PATCH v3 2/2] git: submodule honor -c credential.* from command line Jacob Keller
  2016-02-25 22:00 ` [PATCH v3 1/2] t/lib-http/apache.conf: load mod_unixd module in apache 2.4 Jeff King
  0 siblings, 2 replies; 15+ messages in thread
From: Jacob Keller @ 2016-02-25 18:57 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Mark Strapetz, Stefan Beller, Junio C Hamano, Jacob Keller

From: Jacob Keller <jacob.keller@gmail.com>

Since 2.4, apache will fail to load unless mod_unixd is loaded in order
to drop privileges.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
---

I am not sure why this wasn't there already, but I am unable to run
httpd 2.4.18 without it, on Fedora 23.

 t/lib-httpd/apache.conf | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/t/lib-httpd/apache.conf b/t/lib-httpd/apache.conf
index 7d15e6d44c83..f667e7ce2f33 100644
--- a/t/lib-httpd/apache.conf
+++ b/t/lib-httpd/apache.conf
@@ -64,6 +64,9 @@ LockFile accept.lock
 <IfModule !mod_mpm_prefork.c>
 	LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
 </IfModule>
+<IfModule !mod_unixd.c>
+	LoadModule unixd_module modules/mod_unixd.so
+</IfModule>
 </IfVersion>
 
 PassEnv GIT_VALGRIND
-- 
2.7.1.429.g45cd78e

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH v3 2/2] git: submodule honor -c credential.* from command line
  2016-02-25 18:57 [PATCH v3 1/2] t/lib-http/apache.conf: load mod_unixd module in apache 2.4 Jacob Keller
@ 2016-02-25 18:57 ` Jacob Keller
  2016-02-26  1:55   ` Eric Sunshine
  2016-02-25 22:00 ` [PATCH v3 1/2] t/lib-http/apache.conf: load mod_unixd module in apache 2.4 Jeff King
  1 sibling, 1 reply; 15+ messages in thread
From: Jacob Keller @ 2016-02-25 18:57 UTC (permalink / raw)
  To: git; +Cc: Jeff King, Mark Strapetz, Stefan Beller, Junio C Hamano, Jacob Keller

From: Jacob Keller <jacob.keller@gmail.com>

Due to the way that the git-submodule code works, it clears all local
git environment variables before entering submodules. This is normally
a good thing since we want to clear settings such as GIT_WORKTREE and
other variables which would affect the operation of submodule commands.
However, GIT_CONFIG_PARAMETERS is special, and we actually do want to
preserve these settings. However, we do not want to preserve all
configuration as many things should be left specific to the parent
project.

Add a git submodule--helper function, sanitize-config, which shall be
used to sanitize GIT_CONFIG_PARAMETERS, removing all key/value pairs
except a small subset that are known to be safe and necessary.

Replace all the calls to clear_local_git_env with a wrapped function
that filters GIT_CONFIG_PARAMETERS using the new helper and then
restores it to the filtered subset after clearing the rest of the
environment.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
---

This version incorporates a bunch of suggestions from the review on v2,
including a new test using httpd to verify the credentials. In addition,
it includes a fix so that the C code in submodule--helper works as well.
Previously we used cp.env = local_repo_env to clear all the variables.
Instead, we want to clear everything except use the new filter. This is
somewhat subtle but makes sense once you read how the child_process env
code works.

Notes:
    - v2
    * Clarify which paramaters are left after the sanitization, and don't seem to
      indicate it is our goal to extend the list.
    * add a comment in the submodule_config_ok function indicating the same
    
    - v3
    * Remove extraneous comments
    * add strbuf_release calls
    * rename sanitize_local_git_env
    * remove use of local
    * add C equivalent of sanitize_config
    * add a test for the credential passing

 builtin/submodule--helper.c  | 86 +++++++++++++++++++++++++++++++++++++++++++-
 git-submodule.sh             | 36 ++++++++++++-------
 t/t5550-http-fetch-dumb.sh   | 17 +++++++++
 t/t7412-submodule--helper.sh | 25 +++++++++++++
 4 files changed, 150 insertions(+), 14 deletions(-)
 create mode 100755 t/t7412-submodule--helper.sh

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index f4c3eff179b5..4b43f5dc50e5 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -124,6 +124,64 @@ static int module_name(int argc, const char **argv, const char *prefix)
 
 	return 0;
 }
+
+/*
+ * Rules to sanitize configuration variables that are Ok to be passed into
+ * submodule operations from the parent project using "-c". Should only
+ * include keys which are both (a) safe and (b) necessary for proper
+ * operation.
+ */
+static int submodule_config_ok(const char *var)
+{
+	if (starts_with(var, "credential."))
+		return 1;
+	return 0;
+}
+
+static int sanitize_submodule_config(const char *var, const char *value, void *data)
+{
+	struct strbuf quoted = STRBUF_INIT;
+	struct strbuf *out = data;
+
+	if (submodule_config_ok(var)) {
+		if (out->len)
+			strbuf_addch(out, ' ');
+
+		/*
+		 * The GIT_CONFIG_PARAMETERS parser is a bit picky and
+		 * requires that each var=value pair be quoted as a single
+		 * unit.
+		 */
+		strbuf_addstr(&quoted, var);
+		strbuf_addch(&quoted, '=');
+		strbuf_addstr(&quoted, value);
+
+		sq_quote_buf(out, quoted.buf);
+	}
+
+	strbuf_release(&quoted);
+
+	return 0;
+}
+
+static void prepare_submodule_repo_env(struct argv_array *out)
+{
+	const char * const *var;
+
+	for (var = local_repo_env; *var; var++) {
+		if (!strcmp(*var, CONFIG_DATA_ENVIRONMENT)) {
+			struct strbuf sanitized_config = STRBUF_INIT;
+			git_config_from_parameters(sanitize_submodule_config,
+						   &sanitized_config);
+			argv_array_pushf(out, "%s=%s", *var, sanitized_config.buf);
+			strbuf_release(&sanitized_config);
+		} else {
+			argv_array_push(out, *var);
+		}
+	}
+
+}
+
 static int clone_submodule(const char *path, const char *gitdir, const char *url,
 			   const char *depth, const char *reference, int quiet)
 {
@@ -145,7 +203,7 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url
 	argv_array_push(&cp.args, path);
 
 	cp.git_cmd = 1;
-	cp.env = local_repo_env;
+	prepare_submodule_repo_env(&cp.env_array);
 	cp.no_stdin = 1;
 
 	return run_command(&cp);
@@ -255,6 +313,31 @@ static int module_clone(int argc, const char **argv, const char *prefix)
 	return 0;
 }
 
+static int module_sanitize_config(int argc, const char **argv, const char *prefix)
+{
+	struct strbuf sanitized_config = STRBUF_INIT;
+
+	struct option module_sanitize_config_options[] = {
+		OPT_END()
+	};
+
+	const char *const git_submodule_helper_usage[] = {
+		N_("git submodule--helper sanitize-config"),
+		NULL
+	};
+
+	argc = parse_options(argc, argv, prefix, module_sanitize_config_options,
+			     git_submodule_helper_usage, 0);
+
+	git_config_from_parameters(sanitize_submodule_config, &sanitized_config);
+	if (sanitized_config.len)
+		printf("%s\n", sanitized_config.buf);
+
+	strbuf_release(&sanitized_config);
+
+	return 0;
+}
+
 struct cmd_struct {
 	const char *cmd;
 	int (*fn)(int, const char **, const char *);
@@ -264,6 +347,7 @@ static struct cmd_struct commands[] = {
 	{"list", module_list},
 	{"name", module_name},
 	{"clone", module_clone},
+	{"sanitize-config", module_sanitize_config},
 };
 
 int cmd_submodule__helper(int argc, const char **argv, const char *prefix)
diff --git a/git-submodule.sh b/git-submodule.sh
index 9bc5c5f94d1d..7c79e87fb7c4 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -192,6 +192,16 @@ isnumber()
 	n=$(($1 + 0)) 2>/dev/null && test "$n" = "$1"
 }
 
+# Sanitize the local git environment for use within a submodule. We
+# can't simply use clear_local_git_env since we want to preserve some
+# of the settings from GIT_CONFIG_PARAMETERS.
+sanitize_submodule_env()
+{
+	sanitized_config=$(git submodule--helper sanitize-config)
+	clear_local_git_env
+	GIT_CONFIG_PARAMETERS=$sanitized_config
+}
+
 #
 # Add a new submodule to the working tree, .gitmodules and the index
 #
@@ -349,7 +359,7 @@ Use -f if you really want to add it." >&2
 		fi
 		git submodule--helper clone ${GIT_QUIET:+--quiet} --prefix "$wt_prefix" --path "$sm_path" --name "$sm_name" --url "$realrepo" "$reference" "$depth" || exit
 		(
-			clear_local_git_env
+			sanitize_submodule_env
 			cd "$sm_path" &&
 			# ash fails to wordsplit ${branch:+-b "$branch"...}
 			case "$branch" in
@@ -418,7 +428,7 @@ cmd_foreach()
 			name=$(git submodule--helper name "$sm_path")
 			(
 				prefix="$prefix$sm_path/"
-				clear_local_git_env
+				sanitize_submodule_env
 				cd "$sm_path" &&
 				sm_path=$(relative_path "$sm_path") &&
 				# we make $path available to scripts ...
@@ -713,7 +723,7 @@ Maybe you want to use 'update --init'?")"
 			cloned_modules="$cloned_modules;$name"
 			subsha1=
 		else
-			subsha1=$(clear_local_git_env; cd "$sm_path" &&
+			subsha1=$(sanitize_submodule_env; cd "$sm_path" &&
 				git rev-parse --verify HEAD) ||
 			die "$(eval_gettext "Unable to find current revision in submodule path '\$displaypath'")"
 		fi
@@ -723,11 +733,11 @@ Maybe you want to use 'update --init'?")"
 			if test -z "$nofetch"
 			then
 				# Fetch remote before determining tracking $sha1
-				(clear_local_git_env; cd "$sm_path" && git-fetch) ||
+				(sanitize_submodule_env; cd "$sm_path" && git-fetch) ||
 				die "$(eval_gettext "Unable to fetch in submodule path '\$sm_path'")"
 			fi
-			remote_name=$(clear_local_git_env; cd "$sm_path" && get_default_remote)
-			sha1=$(clear_local_git_env; cd "$sm_path" &&
+			remote_name=$(sanitize_submodule_env; cd "$sm_path" && get_default_remote)
+			sha1=$(sanitize_submodule_env; cd "$sm_path" &&
 				git rev-parse --verify "${remote_name}/${branch}") ||
 			die "$(eval_gettext "Unable to find current ${remote_name}/${branch} revision in submodule path '\$sm_path'")"
 		fi
@@ -745,7 +755,7 @@ Maybe you want to use 'update --init'?")"
 			then
 				# Run fetch only if $sha1 isn't present or it
 				# is not reachable from a ref.
-				(clear_local_git_env; cd "$sm_path" &&
+				(sanitize_submodule_env; cd "$sm_path" &&
 					( (rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) &&
 					 test -z "$rev") || git-fetch)) ||
 				die "$(eval_gettext "Unable to fetch in submodule path '\$displaypath'")"
@@ -787,7 +797,7 @@ Maybe you want to use 'update --init'?")"
 				die "$(eval_gettext "Invalid update mode '$update_module' for submodule '$name'")"
 			esac
 
-			if (clear_local_git_env; cd "$sm_path" && $command "$sha1")
+			if (sanitize_submodule_env; cd "$sm_path" && $command "$sha1")
 			then
 				say "$say_msg"
 			elif test -n "$must_die_on_failure"
@@ -803,7 +813,7 @@ Maybe you want to use 'update --init'?")"
 		then
 			(
 				prefix="$prefix$sm_path/"
-				clear_local_git_env
+				sanitize_submodule_env
 				cd "$sm_path" &&
 				eval cmd_update
 			)
@@ -841,7 +851,7 @@ Maybe you want to use 'update --init'?")"
 
 set_name_rev () {
 	revname=$( (
-		clear_local_git_env
+		sanitize_submodule_env
 		cd "$1" && {
 			git describe "$2" 2>/dev/null ||
 			git describe --tags "$2" 2>/dev/null ||
@@ -1125,7 +1135,7 @@ cmd_status()
 		else
 			if test -z "$cached"
 			then
-				sha1=$(clear_local_git_env; cd "$sm_path" && git rev-parse --verify HEAD)
+				sha1=$(sanitize_submodule_env; cd "$sm_path" && git rev-parse --verify HEAD)
 			fi
 			set_name_rev "$sm_path" "$sha1"
 			say "+$sha1 $displaypath$revname"
@@ -1135,7 +1145,7 @@ cmd_status()
 		then
 			(
 				prefix="$displaypath/"
-				clear_local_git_env
+				sanitize_submodule_env
 				cd "$sm_path" &&
 				eval cmd_status
 			) ||
@@ -1209,7 +1219,7 @@ cmd_sync()
 			if test -e "$sm_path"/.git
 			then
 			(
-				clear_local_git_env
+				sanitize_submodule_env
 				cd "$sm_path"
 				remote=$(get_default_remote)
 				git config remote."$remote".url "$sub_origin_url"
diff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh
index 64146352ae20..48e2ab62da7a 100755
--- a/t/t5550-http-fetch-dumb.sh
+++ b/t/t5550-http-fetch-dumb.sh
@@ -91,6 +91,23 @@ test_expect_success 'configured username does not override URL' '
 	expect_askpass pass user@host
 '
 
+test_expect_success 'cmdline credential config passes into submodules' '
+	git init super &&
+	set_askpass user@host pass@host &&
+	(
+		cd super &&
+		git submodule add "$HTTPD_URL/auth/dumb/repo.git" sub &&
+		git commit -m "add submodule"
+	) &&
+	set_askpass wrong pass@host &&
+	test_must_fail git clone --recursive super super-clone &&
+	rm -rf super-clone &&
+	set_askpass wrong pass@host &&
+	git -c "credential.$HTTP_URL.username=user@host" \
+		clone --recursive super super-clone &&
+	expect_askpass pass user@host
+'
+
 test_expect_success 'fetch changes via http' '
 	echo content >>file &&
 	git commit -a -m two &&
diff --git a/t/t7412-submodule--helper.sh b/t/t7412-submodule--helper.sh
new file mode 100755
index 000000000000..0c68826c0a6f
--- /dev/null
+++ b/t/t7412-submodule--helper.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Copyright (c) 2016 Jacob Keller
+#
+
+test_description='Basic plumbing support of submodule--helper
+
+This test verifies the submodule--helper plumbing command used to implement
+git-submodule.
+'
+
+. ./test-lib.sh
+
+test_expect_success 'sanitize-config clears configuration' '
+	git -c user.name="Some User" submodule--helper sanitize-config >actual &&
+	test_must_be_empty actual
+'
+
+test_expect_success 'sanitize-config keeps credential.helper' '
+	git -c credential.helper="helper" submodule--helper sanitize-config >actual &&
+	echo "'\''credential.helper=helper'\''" >expect &&
+	test_cmp expect actual
+'
+
+test_done
-- 
2.7.1.429.g45cd78e

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 1/2] t/lib-http/apache.conf: load mod_unixd module in apache 2.4
  2016-02-25 18:57 [PATCH v3 1/2] t/lib-http/apache.conf: load mod_unixd module in apache 2.4 Jacob Keller
  2016-02-25 18:57 ` [PATCH v3 2/2] git: submodule honor -c credential.* from command line Jacob Keller
@ 2016-02-25 22:00 ` Jeff King
  2016-02-25 23:16   ` Junio C Hamano
  1 sibling, 1 reply; 15+ messages in thread
From: Jeff King @ 2016-02-25 22:00 UTC (permalink / raw)
  To: Jacob Keller
  Cc: Michael J Gruber, git, Mark Strapetz, Stefan Beller,
	Junio C Hamano, Jacob Keller

On Thu, Feb 25, 2016 at 10:57:11AM -0800, Jacob Keller wrote:

> From: Jacob Keller <jacob.keller@gmail.com>
> 
> Since 2.4, apache will fail to load unless mod_unixd is loaded in order
> to drop privileges.
> 
> Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
> ---
> 
> I am not sure why this wasn't there already, but I am unable to run
> httpd 2.4.18 without it, on Fedora 23.
> 
>  t/lib-httpd/apache.conf | 3 +++
>  1 file changed, 3 insertions(+)

Michael (cc'd) posted an identical patch with some more discussion back
in May:

  http://article.gmane.org/gmane.comp.version-control.git/268770

The series languished because none of the reviewers had systems that
reproduced the problem, and I think there's some additional work needed
to get all of the svn-over-http tests running[1].

I think this bit should be OK to take without the rest (though I like
the extra discussion in the original).

-Peff

[1] http://article.gmane.org/gmane.comp.version-control.git/284349

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 1/2] t/lib-http/apache.conf: load mod_unixd module in apache 2.4
  2016-02-25 22:00 ` [PATCH v3 1/2] t/lib-http/apache.conf: load mod_unixd module in apache 2.4 Jeff King
@ 2016-02-25 23:16   ` Junio C Hamano
  2016-02-25 23:17     ` Junio C Hamano
  2016-02-25 23:18     ` Junio C Hamano
  0 siblings, 2 replies; 15+ messages in thread
From: Junio C Hamano @ 2016-02-25 23:16 UTC (permalink / raw)
  To: Jeff King
  Cc: Jacob Keller, Michael J Gruber, git, Mark Strapetz,
	Stefan Beller, Jacob Keller

Jeff King <peff@peff.net> writes:

> On Thu, Feb 25, 2016 at 10:57:11AM -0800, Jacob Keller wrote:
>
>> From: Jacob Keller <jacob.keller@gmail.com>
>> 
>> Since 2.4, apache will fail to load unless mod_unixd is loaded in order
>> to drop privileges.
>> 
>> Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
>> ---
>> 
>> I am not sure why this wasn't there already, but I am unable to run
>> httpd 2.4.18 without it, on Fedora 23.
>> 
>>  t/lib-httpd/apache.conf | 3 +++
>>  1 file changed, 3 insertions(+)
>
> Michael (cc'd) posted an identical patch with some more discussion back
> in May:
>
>   http://article.gmane.org/gmane.comp.version-control.git/268770
>
> The series languished because none of the reviewers had systems that
> reproduced the problem, and I think there's some additional work needed
> to get all of the svn-over-http tests running[1].
>
> I think this bit should be OK to take without the rest (though I like
> the extra discussion in the original).

I can resurrect 745a5487 (t/lib-httpd: load mod_unixd, 2015-04-08),
which is still on 'pu', and apply 2/2 from Jacov on top of it.

Thanks.

>
> -Peff
>
> [1] http://article.gmane.org/gmane.comp.version-control.git/284349

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 1/2] t/lib-http/apache.conf: load mod_unixd module in apache 2.4
  2016-02-25 23:16   ` Junio C Hamano
@ 2016-02-25 23:17     ` Junio C Hamano
  2016-02-25 23:18     ` Junio C Hamano
  1 sibling, 0 replies; 15+ messages in thread
From: Junio C Hamano @ 2016-02-25 23:17 UTC (permalink / raw)
  To: Jeff King
  Cc: Jacob Keller, Michael J Gruber, git, Mark Strapetz,
	Stefan Beller, Jacob Keller



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 1/2] t/lib-http/apache.conf: load mod_unixd module in apache 2.4
  2016-02-25 23:16   ` Junio C Hamano
  2016-02-25 23:17     ` Junio C Hamano
@ 2016-02-25 23:18     ` Junio C Hamano
  2016-02-25 23:39       ` Jacob Keller
  1 sibling, 1 reply; 15+ messages in thread
From: Junio C Hamano @ 2016-02-25 23:18 UTC (permalink / raw)
  To: Jeff King
  Cc: Jacob Keller, Michael J Gruber, git, Mark Strapetz,
	Stefan Beller, Jacob Keller

Junio C Hamano <gitster@pobox.com> writes:

>> Michael (cc'd) posted an identical patch with some more discussion back
>> in May:
>>
>>   http://article.gmane.org/gmane.comp.version-control.git/268770
>>
>> The series languished because none of the reviewers had systems that
>> reproduced the problem, and I think there's some additional work needed
>> to get all of the svn-over-http tests running[1].
>>
>> I think this bit should be OK to take without the rest (though I like
>> the extra discussion in the original).
>
> I can resurrect 745a5487 (t/lib-httpd: load mod_unixd, 2015-04-08),
> which is still on 'pu', and apply 2/2 from Jacov on top of it.

Ahh, the one you quoted does have a better log message.  Let's
replace the ancieint one I have and use Jacob's 2/2 on top of it.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 1/2] t/lib-http/apache.conf: load mod_unixd module in apache 2.4
  2016-02-25 23:18     ` Junio C Hamano
@ 2016-02-25 23:39       ` Jacob Keller
  2016-02-25 23:41         ` Junio C Hamano
  0 siblings, 1 reply; 15+ messages in thread
From: Jacob Keller @ 2016-02-25 23:39 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Jeff King, Jacob Keller, Michael J Gruber, Git mailing list,
	Mark Strapetz, Stefan Beller

On Thu, Feb 25, 2016 at 3:18 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Junio C Hamano <gitster@pobox.com> writes:
>
>>> Michael (cc'd) posted an identical patch with some more discussion back
>>> in May:
>>>
>>>   http://article.gmane.org/gmane.comp.version-control.git/268770
>>>
>>> The series languished because none of the reviewers had systems that
>>> reproduced the problem, and I think there's some additional work needed
>>> to get all of the svn-over-http tests running[1].
>>>
>>> I think this bit should be OK to take without the rest (though I like
>>> the extra discussion in the original).
>>
>> I can resurrect 745a5487 (t/lib-httpd: load mod_unixd, 2015-04-08),
>> which is still on 'pu', and apply 2/2 from Jacov on top of it.
>
> Ahh, the one you quoted does have a better log message.  Let's
> replace the ancieint one I have and use Jacob's 2/2 on top of it.
>

Agreed. I did not know the source of the issue, only what fixed it.

Thanks,
Jake

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 1/2] t/lib-http/apache.conf: load mod_unixd module in apache 2.4
  2016-02-25 23:39       ` Jacob Keller
@ 2016-02-25 23:41         ` Junio C Hamano
  2016-02-25 23:43           ` Jacob Keller
  0 siblings, 1 reply; 15+ messages in thread
From: Junio C Hamano @ 2016-02-25 23:41 UTC (permalink / raw)
  To: Jacob Keller
  Cc: Jeff King, Jacob Keller, Michael J Gruber, Git mailing list,
	Mark Strapetz, Stefan Beller

On Thu, Feb 25, 2016 at 3:39 PM, Jacob Keller <jacob.keller@gmail.com> wrote:
>>
>> Ahh, the one you quoted does have a better log message.  Let's
>> replace the ancieint one I have and use Jacob's 2/2 on top of it.
>>
>
> Agreed. I did not know the source of the issue, only what fixed it.

Actually, let's wait a bit to avoid unnecessary conflicts between topics.
sb/submodule-fetch-nontip changes the way how these calls to "clean env"
helper function are made.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 1/2] t/lib-http/apache.conf: load mod_unixd module in apache 2.4
  2016-02-25 23:41         ` Junio C Hamano
@ 2016-02-25 23:43           ` Jacob Keller
  0 siblings, 0 replies; 15+ messages in thread
From: Jacob Keller @ 2016-02-25 23:43 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Jeff King, Jacob Keller, Michael J Gruber, Git mailing list,
	Mark Strapetz, Stefan Beller

On Thu, Feb 25, 2016 at 3:41 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Actually, let's wait a bit to avoid unnecessary conflicts between topics.
> sb/submodule-fetch-nontip changes the way how these calls to "clean env"
> helper function are made.

Ya there will be some superficial conflicts with some of Stefan's work.

Regards,
Jake

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 2/2] git: submodule honor -c credential.* from command line
  2016-02-25 18:57 ` [PATCH v3 2/2] git: submodule honor -c credential.* from command line Jacob Keller
@ 2016-02-26  1:55   ` Eric Sunshine
  2016-02-26  2:19     ` Jacob Keller
  0 siblings, 1 reply; 15+ messages in thread
From: Eric Sunshine @ 2016-02-26  1:55 UTC (permalink / raw)
  To: Jacob Keller
  Cc: git, Jeff King, Mark Strapetz, Stefan Beller, Junio C Hamano,
	Jacob Keller

On Thu, Feb 25, 2016 at 10:57:12AM -0800, Jacob Keller wrote:
> [...]
> Replace all the calls to clear_local_git_env with a wrapped function
> that filters GIT_CONFIG_PARAMETERS using the new helper and then
> restores it to the filtered subset after clearing the rest of the
> environment.
> 
> Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
> ---
> diff --git a/t/t7412-submodule--helper.sh b/t/t7412-submodule--helper.sh
> @@ -0,0 +1,25 @@
> +test_expect_success 'sanitize-config keeps credential.helper' '
> +	git -c credential.helper="helper" submodule--helper sanitize-config >actual &&
> +	echo "'\''credential.helper=helper'\''" >expect &&

Not worth a re-roll, but these quote sequences are brain-melting.
Easier would have been to double-quote the second argument of
test_expect_success() and then do either:

    test_expect_success 'sanitize-config keeps credential.helper' "
        git -c [...] submodule--helper sanitize-config >actual &&
        echo \'credential.helper=helper\' >expect &&
        test_cmp expect actual
    "

or:

    test_expect_success 'sanitize-config keeps credential.helper' "
        git -c [...] submodule--helper sanitize-config >actual &&
        cat >expect <<-\EOF &&
        'credential.helper=helper'
        EOF
        test_cmp expect actual
    "

> +	test_cmp expect actual
> +'
> +
> +test_done

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 2/2] git: submodule honor -c credential.* from command line
  2016-02-26  1:55   ` Eric Sunshine
@ 2016-02-26  2:19     ` Jacob Keller
  2016-02-26  2:26       ` Eric Sunshine
  0 siblings, 1 reply; 15+ messages in thread
From: Jacob Keller @ 2016-02-26  2:19 UTC (permalink / raw)
  To: Eric Sunshine
  Cc: Jacob Keller, Git mailing list, Jeff King, Mark Strapetz,
	Stefan Beller, Junio C Hamano

On Thu, Feb 25, 2016 at 5:55 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> Not worth a re-roll, but these quote sequences are brain-melting.
> Easier would have been to double-quote the second argument of
> test_expect_success() and then do either:
>

They are. I fiddled with things till I got it working. I wasn't sure
if double quotes would cause a problem or not, since most other tests
seemed to avoid it.

However this re-roll forgot to check argc in submodule--helper so
maybe worth reroll to fix both things?

Thanks
Jake

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 2/2] git: submodule honor -c credential.* from command line
  2016-02-26  2:19     ` Jacob Keller
@ 2016-02-26  2:26       ` Eric Sunshine
  2016-02-26  2:31         ` Jacob Keller
  2016-02-26  6:07         ` Jeff King
  0 siblings, 2 replies; 15+ messages in thread
From: Eric Sunshine @ 2016-02-26  2:26 UTC (permalink / raw)
  To: Jacob Keller
  Cc: Jacob Keller, Git mailing list, Jeff King, Mark Strapetz,
	Stefan Beller, Junio C Hamano

On Thu, Feb 25, 2016 at 9:19 PM, Jacob Keller <jacob.keller@gmail.com> wrote:
> On Thu, Feb 25, 2016 at 5:55 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
>> Not worth a re-roll, but these quote sequences are brain-melting.
>> Easier would have been to double-quote the second argument of
>> test_expect_success() and then do either:
>
> They are. I fiddled with things till I got it working. I wasn't sure
> if double quotes would cause a problem or not, since most other tests
> seemed to avoid it.

You normally want variable interpolations within the test to happen
when the test is actually run rather than when it is defined, which is
why single quotes are normally used. But this test doesn't use any
variable interpolations, so double quotes won't hurt it.

> However this re-roll forgot to check argc in submodule--helper so
> maybe worth reroll to fix both things?

Possibly.

One thing I elided accidentally was that when changing the second
argument of test_expect_success to double-quotes, you would altogether
drop the double-quotes around "helper" in:

    git -c credential.helper="helper" submodule--helper [...] &&

to become:

    git -c credential.helper=helper submodule--helper [...] &&

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 2/2] git: submodule honor -c credential.* from command line
  2016-02-26  2:26       ` Eric Sunshine
@ 2016-02-26  2:31         ` Jacob Keller
  2016-02-26  6:07         ` Jeff King
  1 sibling, 0 replies; 15+ messages in thread
From: Jacob Keller @ 2016-02-26  2:31 UTC (permalink / raw)
  To: Eric Sunshine
  Cc: Jacob Keller, Git mailing list, Jeff King, Mark Strapetz,
	Stefan Beller, Junio C Hamano

On Thu, Feb 25, 2016 at 6:26 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> One thing I elided accidentally was that when changing the second
> argument of test_expect_success to double-quotes, you would altogether
> drop the double-quotes around "helper" in:
>
>     git -c credential.helper="helper" submodule--helper [...] &&
>
> to become:
>
>     git -c credential.helper=helper submodule--helper [...] &&


Yes I figured that :)

Thanks,
Jake

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 2/2] git: submodule honor -c credential.* from command line
  2016-02-26  2:26       ` Eric Sunshine
  2016-02-26  2:31         ` Jacob Keller
@ 2016-02-26  6:07         ` Jeff King
  2016-02-26  7:32           ` Jacob Keller
  1 sibling, 1 reply; 15+ messages in thread
From: Jeff King @ 2016-02-26  6:07 UTC (permalink / raw)
  To: Eric Sunshine
  Cc: Jacob Keller, Jacob Keller, Git mailing list, Mark Strapetz,
	Stefan Beller, Junio C Hamano

On Thu, Feb 25, 2016 at 09:26:14PM -0500, Eric Sunshine wrote:

> On Thu, Feb 25, 2016 at 9:19 PM, Jacob Keller <jacob.keller@gmail.com> wrote:
> > On Thu, Feb 25, 2016 at 5:55 PM, Eric Sunshine <sunshine@sunshineco.com> wrote:
> >> Not worth a re-roll, but these quote sequences are brain-melting.
> >> Easier would have been to double-quote the second argument of
> >> test_expect_success() and then do either:
> >
> > They are. I fiddled with things till I got it working. I wasn't sure
> > if double quotes would cause a problem or not, since most other tests
> > seemed to avoid it.
> 
> You normally want variable interpolations within the test to happen
> when the test is actually run rather than when it is defined, which is
> why single quotes are normally used. But this test doesn't use any
> variable interpolations, so double quotes won't hurt it.

Of the two you suggested, I think I like the here-doc better, as it does
not leave any question to a reader that there is other interpolation
going on.

-Peff

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH v3 2/2] git: submodule honor -c credential.* from command line
  2016-02-26  6:07         ` Jeff King
@ 2016-02-26  7:32           ` Jacob Keller
  0 siblings, 0 replies; 15+ messages in thread
From: Jacob Keller @ 2016-02-26  7:32 UTC (permalink / raw)
  To: Jeff King
  Cc: Eric Sunshine, Jacob Keller, Git mailing list, Mark Strapetz,
	Stefan Beller, Junio C Hamano

On Thu, Feb 25, 2016 at 10:07 PM, Jeff King <peff@peff.net> wrote:
> Of the two you suggested, I think I like the here-doc better, as it does
> not leave any question to a reader that there is other interpolation
> going on.
>
> -Peff

Agreed. Since I forgot the parts about argc checking, I will do a
reroll with the heredoc rolled in as well.

Thanks,
Jake

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-02-26  7:33 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-25 18:57 [PATCH v3 1/2] t/lib-http/apache.conf: load mod_unixd module in apache 2.4 Jacob Keller
2016-02-25 18:57 ` [PATCH v3 2/2] git: submodule honor -c credential.* from command line Jacob Keller
2016-02-26  1:55   ` Eric Sunshine
2016-02-26  2:19     ` Jacob Keller
2016-02-26  2:26       ` Eric Sunshine
2016-02-26  2:31         ` Jacob Keller
2016-02-26  6:07         ` Jeff King
2016-02-26  7:32           ` Jacob Keller
2016-02-25 22:00 ` [PATCH v3 1/2] t/lib-http/apache.conf: load mod_unixd module in apache 2.4 Jeff King
2016-02-25 23:16   ` Junio C Hamano
2016-02-25 23:17     ` Junio C Hamano
2016-02-25 23:18     ` Junio C Hamano
2016-02-25 23:39       ` Jacob Keller
2016-02-25 23:41         ` Junio C Hamano
2016-02-25 23:43           ` Jacob Keller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.