All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Having keywords without value is not a global error.
@ 2010-02-26  4:00 Steven Drake
  2010-02-26  4:00 ` [PATCH] t/t0001-init.sh: add test for 'init with init.templatedir set' Steven Drake
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Steven Drake @ 2010-02-26  4:00 UTC (permalink / raw)
  To: git

It is not a good Idea to give a config_error for _any_ keyword without a
value as it means that

	[section]
		keyword

sytle can not be using for setting bool type keyword.

Signed-off-by: Steven Drake <sdrake@xnet.co.nz>
---
 builtin/init-db.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/builtin/init-db.c b/builtin/init-db.c
index 9273942..edc40ff 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -170,8 +170,6 @@ static void copy_templates(const char *template_dir)
 
 static int git_init_db_config(const char *k, const char *v, void *cb)
 {
-	if (!v)
-		return config_error_nonbool(k);
 	if (!strcmp(k, "init.templatedir"))
 		return git_config_pathname(&init_db_template_dir, k, v);
 
-- 
1.6.6

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

* [PATCH] t/t0001-init.sh: add test for 'init with init.templatedir set'
  2010-02-26  4:00 [PATCH] Having keywords without value is not a global error Steven Drake
@ 2010-02-26  4:00 ` Steven Drake
  2010-02-26  5:14 ` [PATCH] Having keywords without value is not a global error Junio C Hamano
  2010-02-26  8:19 ` Alex Riesen
  2 siblings, 0 replies; 7+ messages in thread
From: Steven Drake @ 2010-02-26  4:00 UTC (permalink / raw)
  To: git

Requires a small change to wrap-for-bin.sh in order to work.

Signed-off-by: Steven Drake <sdrake@xnet.co.nz>
---
 t/t0001-init.sh |   19 +++++++++++++++++++
 wrap-for-bin.sh |    3 ++-
 2 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 5386504..6757734 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -167,6 +167,25 @@ test_expect_success 'init with --template (blank)' '
 	! test -f template-blank/.git/info/exclude
 '
 
+test_expect_success 'init with init.templatedir set' '
+	mkdir templatedir-source &&
+	echo Content >templatedir-source/file &&
+	(
+		HOME="`pwd`" &&
+		export HOME &&
+		test_config="${HOME}/.gitconfig" &&
+		git config -f "$test_config"  init.templatedir "${HOME}/templatedir-source" &&
+		mkdir templatedir-set &&
+		cd templatedir-set &&
+		unset GIT_CONFIG_NOGLOBAL &&
+		unset GIT_TEMPLATE_DIR &&
+		NO_SET_GIT_TEMPLATE_DIR=t &&
+		export NO_SET_GIT_TEMPLATE_DIR &&
+		git init
+	) &&
+	test_cmp templatedir-source/file templatedir-set/.git/file
+'
+
 test_expect_success 'init --bare/--shared overrides system/global config' '
 	(
 		HOME="`pwd`" &&
diff --git a/wrap-for-bin.sh b/wrap-for-bin.sh
index c5075c9..aece782 100644
--- a/wrap-for-bin.sh
+++ b/wrap-for-bin.sh
@@ -7,7 +7,8 @@
 # @@BUILD_DIR@@ and @@PROG@@.
 
 GIT_EXEC_PATH='@@BUILD_DIR@@'
-GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
+test -z "$NO_SET_GIT_TEMPLATE_DIR" &&
+	GIT_TEMPLATE_DIR='@@BUILD_DIR@@/templates/blt'
 GITPERLLIB='@@BUILD_DIR@@/perl/blib/lib'
 PATH='@@BUILD_DIR@@/bin-wrappers:'"$PATH"
 export GIT_EXEC_PATH GIT_TEMPLATE_DIR GITPERLLIB PATH
-- 
1.6.6

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

* Re: [PATCH] Having keywords without value is not a global error.
  2010-02-26  4:00 [PATCH] Having keywords without value is not a global error Steven Drake
  2010-02-26  4:00 ` [PATCH] t/t0001-init.sh: add test for 'init with init.templatedir set' Steven Drake
@ 2010-02-26  5:14 ` Junio C Hamano
  2010-02-26  5:44   ` Steven Drake
  2010-02-26  8:19 ` Alex Riesen
  2 siblings, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2010-02-26  5:14 UTC (permalink / raw)
  To: Steven Drake; +Cc: git

Steven Drake <sdrake@xnet.co.nz> writes:

> It is not a good Idea to give a config_error for _any_ keyword without a
> value as it means that
>
> 	[section]
> 		keyword
>
> sytle can not be using for setting bool type keyword.
>
> Signed-off-by: Steven Drake <sdrake@xnet.co.nz>
> ---
>  builtin/init-db.c |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/init-db.c b/builtin/init-db.c
> index 9273942..edc40ff 100644
> --- a/builtin/init-db.c
> +++ b/builtin/init-db.c
> @@ -170,8 +170,6 @@ static void copy_templates(const char *template_dir)
>  
>  static int git_init_db_config(const char *k, const char *v, void *cb)
>  {
> -	if (!v)
> -		return config_error_nonbool(k);
>  	if (!strcmp(k, "init.templatedir"))
>  		return git_config_pathname(&init_db_template_dir, k, v);

But then don't you need to catch init.templatedir does have a string
value?

>  
> -- 
> 1.6.6

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

* Re: [PATCH] Having keywords without value is not a global error.
  2010-02-26  5:14 ` [PATCH] Having keywords without value is not a global error Junio C Hamano
@ 2010-02-26  5:44   ` Steven Drake
  2010-02-26  5:57     ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Drake @ 2010-02-26  5:44 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Thu, 25 Feb 2010, Junio C Hamano wrote:
> Steven Drake <sdrake@xnet.co.nz> writes:
> 
> > It is not a good Idea to give a config_error for _any_ keyword without a
> > value as it means that
> >
> > 	[section]
> > 		keyword
> >
> > sytle can not be using for setting bool type keyword.
> >
> > Signed-off-by: Steven Drake <sdrake@xnet.co.nz>
> > ---
> >  builtin/init-db.c |    2 --
> >  1 files changed, 0 insertions(+), 2 deletions(-)
> >
> > diff --git a/builtin/init-db.c b/builtin/init-db.c
> > index 9273942..edc40ff 100644
> > --- a/builtin/init-db.c
> > +++ b/builtin/init-db.c
> > @@ -170,8 +170,6 @@ static void copy_templates(const char *template_dir)
> >  
> >  static int git_init_db_config(const char *k, const char *v, void *cb)
> >  {
> > -	if (!v)
> > -		return config_error_nonbool(k);
> >  	if (!strcmp(k, "init.templatedir"))
> >  		return git_config_pathname(&init_db_template_dir, k, v);
> 
> But then don't you need to catch init.templatedir does have a string
> value?

Yes, but the change dose not touch that test, it removes two lines that I
can't remember why a put there.

-- 
Steven

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

* Re: [PATCH] Having keywords without value is not a global error.
  2010-02-26  5:44   ` Steven Drake
@ 2010-02-26  5:57     ` Junio C Hamano
  0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2010-02-26  5:57 UTC (permalink / raw)
  To: Steven Drake; +Cc: Junio C Hamano, git

Steven Drake <sdrake@xnet.co.nz> writes:

>> >  	if (!strcmp(k, "init.templatedir"))
>> >  		return git_config_pathname(&init_db_template_dir, k, v);
>> 
>> But then don't you need to catch init.templatedir does have a string
>> value?
>
> Yes, but the change dose not touch that test,...

Ahh, config_pathname() does its own check for NULLness, Ok, I forgot.

Thanks.

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

* Re: [PATCH] Having keywords without value is not a global error.
  2010-02-26  4:00 [PATCH] Having keywords without value is not a global error Steven Drake
  2010-02-26  4:00 ` [PATCH] t/t0001-init.sh: add test for 'init with init.templatedir set' Steven Drake
  2010-02-26  5:14 ` [PATCH] Having keywords without value is not a global error Junio C Hamano
@ 2010-02-26  8:19 ` Alex Riesen
  2010-02-26  8:35   ` Steven Drake
  2 siblings, 1 reply; 7+ messages in thread
From: Alex Riesen @ 2010-02-26  8:19 UTC (permalink / raw)
  To: Steven Drake; +Cc: git

On Fri, Feb 26, 2010 at 05:00, Steven Drake <sdrake@xnet.co.nz> wrote:
> It is not a good Idea to give a config_error for _any_ keyword without a
> value as it means that
>
>        [section]
>                keyword
>
> sytle can not be using for setting bool type keyword.

Typo: sytle (style?)

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

* Re: [PATCH] Having keywords without value is not a global error.
  2010-02-26  8:19 ` Alex Riesen
@ 2010-02-26  8:35   ` Steven Drake
  0 siblings, 0 replies; 7+ messages in thread
From: Steven Drake @ 2010-02-26  8:35 UTC (permalink / raw)
  To: Alex Riesen; +Cc: git

[-- Attachment #1: Type: TEXT/PLAIN, Size: 390 bytes --]

On Fri, 26 Feb 2010, Alex Riesen wrote:

> On Fri, Feb 26, 2010 at 05:00, Steven Drake <sdrake@xnet.co.nz> wrote:
> > It is not a good Idea to give a config_error for _any_ keyword without a
> > value as it means that
> >
> >        [section]
> >                keyword
> >
> > sytle can not be using for setting bool type keyword.
> 
> Typo: sytle (style?)

Yes!!! 

-- 
Steven

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

end of thread, other threads:[~2010-02-26  8:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-26  4:00 [PATCH] Having keywords without value is not a global error Steven Drake
2010-02-26  4:00 ` [PATCH] t/t0001-init.sh: add test for 'init with init.templatedir set' Steven Drake
2010-02-26  5:14 ` [PATCH] Having keywords without value is not a global error Junio C Hamano
2010-02-26  5:44   ` Steven Drake
2010-02-26  5:57     ` Junio C Hamano
2010-02-26  8:19 ` Alex Riesen
2010-02-26  8:35   ` Steven Drake

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.