Re: [PATCH 8/8] trace: give repo_setup trace its own key

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

 



Jeff King wrote:

> You no longer get this output with GIT_TRACE=1; instead, you
> can do GIT_TRACE_SETUP=1.

Thank you. :)

> --- a/trace.c
> +++ b/trace.c
> @@ -155,10 +155,11 @@ static const char *quote_crnl(const char *path)
>  /* FIXME: move prefix to startup_info struct and get rid of this arg */
>  void trace_repo_setup(const char *prefix)
>  {
> +	static const char *key = "GIT_TRACE_SETUP";

Micronit:

	static const char key[] = ...

> @@ -170,10 +171,10 @@ void trace_repo_setup(const char *prefix)
>  	if (!prefix)
>  		prefix = "(null)";
>  
> -	trace_printf("setup: git_dir: %s\n", quote_crnl(get_git_dir()));
> -	trace_printf("setup: worktree: %s\n", quote_crnl(git_work_tree));
> -	trace_printf("setup: cwd: %s\n", quote_crnl(cwd));
> -	trace_printf("setup: prefix: %s\n", quote_crnl(prefix));
> +	trace_printf_key(key, "setup: git_dir: %s\n", quote_crnl(get_git_dir()));
> +	trace_printf_key(key, "setup: worktree: %s\n", quote_crnl(git_work_tree));
> +	trace_printf_key(key, "setup: cwd: %s\n", quote_crnl(cwd));
> +	trace_printf_key(key, "setup: prefix: %s\n", quote_crnl(prefix));

I wonder if it would make sense for this to be

	trace_printf("setup", "git_dir: %s\n", ...);

and:

 - automatically prefix each line with the key instead of "trace:"
 - enable or redirect based on the content of the GIT_TRACE_$(uc $key)
   variable

But what you have here already works, so:
Reviewed-by: Jonathan Nieder <jrnieder@xxxxxxxxx>
--
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]