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

Re: [PATCH] setup: suppress implicit "." work-tree for bare repos

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 8, 2013, 07:54 UTC
Message-ID
<7vboaujphx.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20130308071554.GB24429@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 12 quoted lines
> diff --git a/cache.h b/cache.h
> index e493563..070169a 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -344,6 +344,7 @@ static inline enum object_type object_type(unsigned int mode)
>  #define GIT_DIR_ENVIRONMENT "GIT_DIR"
>  #define GIT_NAMESPACE_ENVIRONMENT "GIT_NAMESPACE"
>  #define GIT_WORK_TREE_ENVIRONMENT "GIT_WORK_TREE"
> +#define GIT_IMPLICIT_WORK_TREE_ENVIRONMENT "GIT_IMPLICIT_WORK_TREE"
>  #define DEFAULT_GIT_DIR_ENVIRONMENT ".git"
>  #define DB_ENVIRONMENT "GIT_OBJECT_DIRECTORY"
>  #define INDEX_ENVIRONMENT "GIT_INDEX_FILE"

Not adding any user documentation is fine (you explained why in the log message), but I would really prefer to have some in-code comment to clarify its meaning. Is it "Please do use implicit work tree" boolean? Is it "This is the path to the work tree we have already figured out" string? Is it something else? What is it used for, who sets it, what other codepath that will be invented in the future need to be careful to set it (or unset it) and how does one who writes that new codepath decides that he needs to do so (or shouldn't)?

I would know *today* that it is a bool to affect us, after having discovered that we are in bare and we have set GIT_DIR (so if the end user already had GIT_DIR, we shouldn't set it ourselves), and also our child processes, but I am not confident that I will remember this thread 6 months down the road.

Previous: Jeff KingNext: Jeff King
Message 8 of 16 in “[BUG] bare repository detection does not work with aliases”
  1. Mark LodatoMar 7, 2013
  2. Jeff KingMar 8, 2013
  3. Junio C HamanoMar 8, 2013
  4. Jeff KingMar 8, 2013
  5. setup: suppress implicit "." work-tree for bare reposJeff King, Mar 8, 2013
  6. Johannes SixtMar 8, 2013
  7. Jeff KingMar 8, 2013
  8. Junio C HamanoMar 8, 2013
  9. Jeff KingMar 8, 2013
  10. [PATCHv2] setup and GIT_IMPLICIT_WORK_TREEJeff King, Mar 8, 2013
  11. 1/3 cache.h: drop LOCAL_REPO_ENV_SIZEJeff King, Mar 8, 2013
  12. 2/3 environment: add GIT_PREFIX to local_repo_envJeff King, Mar 8, 2013
  13. Eric SunshineMar 8, 2013
  14. Jeff KingMar 8, 2013
  15. Junio C HamanoMar 8, 2013
  16. 3/3 setup: suppress implicit "." work-tree for bare reposJeff King, Mar 8, 2013

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.