threads / patch / 5924

patchFix tracing when GIT_TRACE is set to an empty string.

Subject: [PATCH] Fix tracing when GIT_TRACE is set to an empty string.

## tl;dr

3 messages between Oct 14, 2006 and Oct 14, 2006. Diffs are folded; open one to read it.

replies: 2people: 2as markdown or json

Christian Couder· Oct 14, 2006, 14:05 UTC · lore
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
---
 trace.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
Show changes to trace.c +2 −1
diff --git a/trace.c b/trace.c
index f9efc91..495e5ed 100644
--- a/trace.c
+++ b/trace.c
@@ -55,7 +55,8 @@ static int get_trace_fd(int *need_close)
 {
 	char *trace = getenv("GIT_TRACE");
 
-	if (!trace || !strcmp(trace, "0") || !strcasecmp(trace, "false"))
+	if (!trace || !strcmp(trace, "") ||
+	    !strcmp(trace, "0") || !strcasecmp(trace, "false"))
 		return 0;
 	if (!strcmp(trace, "1") || !strcasecmp(trace, "true"))
 		return STDERR_FILENO;
-- 
1.4.3.rc2.gadba
Junio C Hamano· Oct 14, 2006, 18:11 UTC · re: Christian Couder · lore

Re: [PATCH] Fix tracing when GIT_TRACE is set to an empty string.

Christian Couder <chriscool@tuxfamily.org> writes:
Show 21 quoted lines
> Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> ---
>  trace.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/trace.c b/trace.c
> index f9efc91..495e5ed 100644
> --- a/trace.c
> +++ b/trace.c
> @@ -55,7 +55,8 @@ static int get_trace_fd(int *need_close)
>  {
>  	char *trace = getenv("GIT_TRACE");
>  
> -	if (!trace || !strcmp(trace, "0") || !strcasecmp(trace, "false"))
> +	if (!trace || !strcmp(trace, "") ||
> +	    !strcmp(trace, "0") || !strcasecmp(trace, "false"))
>  		return 0;
>  	if (!strcmp(trace, "1") || !strcasecmp(trace, "true"))
>  		return STDERR_FILENO;
> -- 
> 1.4.3.rc2.gadba
This means that
	GIT_TRACE= git-foo
and
	unset GIT_TRACE ; git-foo
should behave the same way, right?
If so that sounds sensible.
Christian Couder· Oct 14, 2006, 19:55 UTC · re: Junio C Hamano · lore

Re: [PATCH] Fix tracing when GIT_TRACE is set to an empty string.

Junio C Hamano wrote:
Show 30 quoted lines
> Christian Couder <chriscool@tuxfamily.org> writes:
> > Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
> > ---
> >  trace.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/trace.c b/trace.c
> > index f9efc91..495e5ed 100644
> > --- a/trace.c
> > +++ b/trace.c
> > @@ -55,7 +55,8 @@ static int get_trace_fd(int *need_close)
> >  {
> >  	char *trace = getenv("GIT_TRACE");
> >
> > -	if (!trace || !strcmp(trace, "0") || !strcasecmp(trace, "false"))
> > +	if (!trace || !strcmp(trace, "") ||
> > +	    !strcmp(trace, "0") || !strcasecmp(trace, "false"))
> >  		return 0;
> >  	if (!strcmp(trace, "1") || !strcasecmp(trace, "true"))
> >  		return STDERR_FILENO;
> > --
> > 1.4.3.rc2.gadba
>
> This means that
>
> 	GIT_TRACE= git-foo
> and
> 	unset GIT_TRACE ; git-foo
>
> should behave the same way, right?
Yes, that's the goal of this patch.
> If so that sounds sensible.

Thanks, Christian.

← back to recent threads