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

Re: [PATCH v4 3/3] config: add '--show-origin' option to print the origin of a config value

From
Jeff King <peff@peff.net>
Date
Feb 16, 2016, 22:17 UTC
Message-ID
<20160216221739.GA8370@sigill.intra.peff.net>
In-Reply-To
<56C39F55.1090903@ramsayjones.plus.com>
On Tue, Feb 16, 2016 at 10:14:45PM +0000, Ramsay Jones wrote:
Show 17 quoted lines
> > I think it's more than that one-liner. This patch shows "type:name"
> > verbatim from what is passed into do_config_from_file, as does the error
> > message. If they are going to have different output formats (e.g.,
> > "<stdin>" versus "stdin"), there needs to be logic transforming them in
> > at least one of the spots.
> 
> Ugh, yes you are right.
> 
> Hmm, I just hacked something up (see below) and, since its a bit
> ugly, I'm now in two minds! (it could be improved, of course). ;-)
> 
> So, I'll leave it to yourself and Lars to decide.
> [...]
> +	if (!strcmp(cftype, "stdin")) {
> +		cftype = "file";
> +		cfname = "<stdin>";
> +	}

I think if we go this route it would be cleaner to just make "type" an enum and convert it to the appropriate string in the callers. But other than that, I think your patch is along the correct lines.

I dunno. Personally I am fine with the change in error messages done by Lars. I could go either way.

-Peff
PS Thanks also for your patch fixing the prototypes. I completely missed
   that.
Previous: Ramsay JonesNext: Junio C Hamano
Message 24 of 32 in “config: add '--sources' option to print the source of a config value”
  1. 0/3 config: add '--sources' option to print the source of a config valuelarsxschneider@gmail.com, Feb 15, 2016
  2. 1/3 t: do not hide Git's exit code in testslarsxschneider@gmail.com, Feb 15, 2016
  3. Jeff KingFeb 15, 2016
  4. Lars SchneiderFeb 16, 2016
  5. 2/3 config: add 'type' to config_source struct that identifies config typelarsxschneider@gmail.com, Feb 15, 2016
  6. Jeff KingFeb 15, 2016
  7. Ramsay JonesFeb 16, 2016
  8. Ramsay JonesFeb 15, 2016
  9. Johannes SchindelinFeb 17, 2016
  10. Lars SchneiderFeb 18, 2016
  11. 3/3 config: add '--show-origin' option to print the origin of a config valuelarsxschneider@gmail.com, Feb 15, 2016
  12. Jeff KingFeb 15, 2016
  13. Eric SunshineFeb 15, 2016
  14. Jeff KingFeb 15, 2016
  15. Lars SchneiderFeb 17, 2016
  16. Junio C HamanoFeb 17, 2016
  17. Ramsay JonesFeb 15, 2016
  18. Jeff KingFeb 15, 2016
  19. Ramsay JonesFeb 15, 2016
  20. Lars SchneiderFeb 16, 2016
  21. Ramsay JonesFeb 16, 2016
  22. Jeff KingFeb 16, 2016
  23. Ramsay JonesFeb 16, 2016
  24. Jeff KingFeb 16, 2016
  25. Junio C HamanoFeb 15, 2016
  26. Lars SchneiderFeb 16, 2016
  27. Junio C HamanoFeb 15, 2016
  28. Jeff KingFeb 15, 2016
  29. Junio C HamanoFeb 15, 2016
  30. Lars SchneiderFeb 16, 2016
  31. Jeff KingFeb 15, 2016
  32. Lars SchneiderFeb 16, 2016

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.