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

Re: [PATCH 1/3] Use startup_info->prefix rather than prefix.

From
Jared Hance <jaredhance@gmail.com>
Date
Mar 3, 2012, 23:23 UTC
Message-ID
<loom.20120304T002121-25@post.gmane.org>
In-Reply-To
<7vbood742a.fsf@alter.siamese.dyndns.org>
Junio C Hamano <gitster <at> pobox.com> writes:
Show 12 quoted lines
> Hrm, that explanation is understandable, but it strongly makes me suspect
> that this change is making the code _more_ error prone in the longer term.
> 
> When somebody wants to add a new caller to a non-builtin, they need to
> think about what prefix to pass, and would realize that they need to call
> setup_git_directory() to get it. With the updated code, they can totally
> forget and call it without any initialized startup_info.
> 
> Adding a totally new command is rare, new non-builtin is rarer, and adding
> trace to it is even more so, so it may not be worth worrying about, but I
> wonder if there is a cheap way to check such a programming mistake.
> 
Well, there are really four options:
- Old code, where user must pass in prefix
- New code, where user must call setup_git_directory()
- Have the function deliver a nice diagnostic error message if startup_info
hasn't been initialized
- Have the function call setup_git_directory() if startup_info hasn't been
initialized
I think one of the latter two is the most sane here.
Previous: Junio C HamanoNext: Jared Hance
Message 6 of 18 in “Fix some documented fixmes”
  1. 0/3 Fix some documented fixmesJared Hance, Mar 3, 2012
  2. 1/3 Use startup_info->prefix rather than prefix.Jared Hance, Mar 3, 2012
  3. Junio C HamanoMar 3, 2012
  4. Nguyen Thai Ngoc DuyMar 3, 2012
  5. Junio C HamanoMar 3, 2012
  6. Jared HanceMar 3, 2012
  7. 2/3 Fix memory leak in apply_patch in apply.c.Jared Hance, Mar 3, 2012
  8. Junio C HamanoMar 3, 2012
  9. 3/3 Add threaded versions of functions in symlinks.c.Jared Hance, Mar 3, 2012
  10. Junio C HamanoMar 3, 2012
  11. 0/3 Fix a few documents fixmesJared Hance, Mar 3, 2012
  12. 1/3 Use startup_info->prefix rather than prefix.Jared Hance, Mar 3, 2012
  13. Jeff EplerMar 3, 2012
  14. 2/3 Fix memory leak in apply_patch in apply.c.Jared Hance, Mar 3, 2012
  15. Jared HanceMar 3, 2012
  16. Junio C HamanoMar 3, 2012
  17. 3/3 Add threaded versions of functions in symlinks.c.Jared Hance, Mar 3, 2012
  18. Thomas RastMar 5, 2012

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.