git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Feb 24, 2011, 21:49 UTC
Message-ID
<20110224214959.GH17412@elie>
In-Reply-To
<20110224143030.GH15477@sigill.intra.peff.net>
Jeff King wrote:
> You no longer get this output with GIT_TRACE=1; instead, you
> can do GIT_TRACE_SETUP=1.
Thank you. :)
Show 7 quoted lines
> --- 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[] = ...
Show 12 quoted lines
> @@ -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@gmail.com>
Previous: Christian CouderNext: Nguyen Thai Ngoc Duy
Message 30 of 32 in “refactor trace code”
  1. 0/8 refactor trace codeJeff King, Feb 24, 2011
  2. 1/8 compat: provide a fallback va_copy definitionJeff King, Feb 24, 2011
  3. Erik Faye-LundFeb 24, 2011
  4. compat: fall back on __va_copy if availableJonathan Nieder, Mar 8, 2011
  5. Junio C HamanoMar 8, 2011
  6. Jonathan NiederMar 8, 2011
  7. Jonathan NiederFeb 24, 2011
  8. 2/8 strbuf: add strbuf_addvJeff King, Feb 24, 2011
  9. Christian CouderFeb 24, 2011
  10. Jeff KingFeb 24, 2011
  11. Jonathan NiederFeb 24, 2011
  12. 3/8 trace: add trace_vprintfJeff King, Feb 24, 2011
  13. Jonathan NiederFeb 24, 2011
  14. 4/8 trace: refactor to support multiple env variablesJeff King, Feb 24, 2011
  15. Junio C HamanoFeb 24, 2011
  16. Jeff KingFeb 24, 2011
  17. Junio C HamanoFeb 24, 2011
  18. Jeff KingFeb 24, 2011
  19. Junio C HamanoFeb 24, 2011
  20. Jonathan NiederFeb 24, 2011
  21. 5/8 trace: factor out "do we want to trace" logicJeff King, Feb 24, 2011
  22. Christian CouderFeb 24, 2011
  23. 6/8 trace: add trace_strbufJeff King, Feb 24, 2011
  24. 7/8 add packet tracing debug codeJeff King, Feb 24, 2011
  25. Jonathan NiederFeb 24, 2011
  26. 8/8 trace: give repo_setup trace its own keyJeff King, Feb 24, 2011
  27. Andreas EricssonFeb 24, 2011
  28. Jeff KingFeb 24, 2011
  29. Christian CouderFeb 24, 2011
  30. Jonathan NiederFeb 24, 2011
  31. Nguyen Thai Ngoc DuyFeb 25, 2011
  32. Junio C HamanoFeb 26, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.