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

Re: [PATCH] Remove .git auto detection from setup_git_env()

From
Jeff King <peff@peff.net>
Date
Feb 5, 2010, 15:12 UTC
Message-ID
<20100205151239.GC14116@coredump.intra.peff.net>
In-Reply-To
<1265370468-6147-1-git-send-email-pclouds@gmail.com>
On Fri, Feb 05, 2010 at 06:47:48PM +0700, Nguyễn Thái Ngọc Duy wrote:
Show 18 quoted lines
> When GIT_DIR environment variable is not specified, .git will be
> searched if a repository is needed. Currently this can be done in two
> places: setup_git_directory_gently() and setup_git_env().
> 
> The one in setup_git_env() is no longer correct and should IMHO have
> been removed since the introduction of setup_git_directory_gently() in
> d288a70. Having two ways of auto detection may lead to obscure errors
> because .git may be misdetected by setup_git_env(),
> automatically called via git_path(), which is all over the place.
> 
> This patch makes setup_git_env() die if GIT_DIR is not explictly
> set. That's setup_git_directory_gently()'s job. If you ever want to
> touch things inside $GIT_DIR, you should have already called
> setup_git_directory_gently().
> 
> This patch breaks commands (in a good way) and obviously not for
> mainline. I still have to go through "make test" to see how many are
> impacted. But I think this is a good change. Am I missing something?

It has been a while since I looked at this code, but I think this is a good direction forward. I remember trying something like this and getting discouraged at all of the ensuing breakage. So if you can track down all of the fallouts and fix them, I think we will be better off in the long run.

-Peff
Previous: Nguyễn Thái Ngọc DuyNext: Junio C Hamano
Message 2 of 5 in “Remove .git auto detection from setup_git_env()”
  1. Remove .git auto detection from setup_git_env()Nguyễn Thái Ngọc Duy, Feb 5, 2010
  2. Jeff KingFeb 5, 2010
  3. Junio C HamanoFeb 5, 2010
  4. Junio C HamanoFeb 5, 2010
  5. René ScharfeFeb 5, 2010

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.